at 22.05-pre 79 lines 2.4 kB view raw
1{ mkDerivation, lib, fetchzip, libarchive, autoPatchelfHook, libsecret, libGL, zlib, openssl, qtbase, qtwebkit, qtxmlpatterns }: 2 3mkDerivation rec { 4 pname = "foxitreader"; 5 version = "2.4.4.0911"; 6 7 src = fetchzip { 8 url = "https://cdn01.foxitsoftware.com/pub/foxit/reader/desktop/linux/${lib.versions.major version}.x/${lib.versions.majorMinor version}/en_us/FoxitReader.enu.setup.${version}.x64.run.tar.gz"; 9 sha256 = "0ff4xs9ipc7sswq0czfhpsd7qw7niw0zsf9wgsqhbbgzcpbdhcb7"; 10 stripRoot = false; 11 }; 12 13 buildInputs = [ libGL libsecret openssl qtbase qtwebkit qtxmlpatterns zlib ]; 14 15 nativeBuildInputs = [ autoPatchelfHook libarchive ]; 16 17 buildPhase = '' 18 runHook preBuild 19 20 input_file=$src/*.run 21 mkdir -p extracted 22 # Look for all 7z files and extract them 23 grep --only-matching --byte-offset --binary \ 24 --text -P '7z\xBC\xAF\x27\x1C\x00\x03' $input_file | cut -d: -f1 | 25 while read position; do 26 tail -c +$(($position + 1)) $input_file > file.7z 27 bsdtar xf file.7z -C extracted 28 done 29 30 runHook postBuild 31 ''; 32 33 installPhase = '' 34 runHook preInstall 35 36 mkdir -p $out/lib 37 cd extracted 38 39 cp -r \ 40 CollectStrategy.txt \ 41 cpdf_settings \ 42 fxplugins \ 43 lang \ 44 resource \ 45 run \ 46 stamps \ 47 welcome \ 48 Wrappers \ 49 $out/lib/ 50 51 patchelf $out/lib/fxplugins/librms.so \ 52 --replace-needed libssl.so.10 libssl.so \ 53 --replace-needed libcrypto.so.10 libcrypto.so 54 55 # FIXME: Doing this with one invocation is broken right now 56 patchelf $out/lib/fxplugins/librmscrypto.so \ 57 --replace-needed libssl.so.10 libssl.so 58 patchelf $out/lib/fxplugins/librmscrypto.so \ 59 --replace-needed libcrypto.so.10 libcrypto.so 60 61 install -D -m 755 FoxitReader -t $out/bin 62 63 # Install icon and desktop files 64 install -D -m 644 images/FoxitReader.png -t $out/share/pixmaps/ 65 install -D -m 644 FoxitReader.desktop -t $out/share/applications/ 66 echo Exec=FoxitReader %F >> $out/share/applications/FoxitReader.desktop 67 68 runHook postInstall 69 ''; 70 71 qtWrapperArgs = [ "--set appname FoxitReader" "--set selfpath $out/lib" ]; 72 73 meta = with lib; { 74 description = "A viewer for PDF documents"; 75 homepage = "https://www.foxitsoftware.com/"; 76 license = licenses.unfree; 77 maintainers = with maintainers; [ p-h rhoriguchi ]; 78 }; 79}