You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

124 lines
4.4 KiB

{ stdenv, requireFile, runCommand, fetchurl, libsForQt5, p7zip, openssl, libsecret, glib
, qt5, dbus, fontconfig, freetype, xorg, libGL }:
let
license = fetchurl {
url = "https://www.foxitsoftware.com/products/pdf-reader/eula.html";
sha256 = "0513x9i503h3yxf69j6d0k461pyr7pyvffdbxx364z9lanw4hb1z";
};
version = "2.4.4.0911";
unpacked = stdenv.mkDerivation {
pname = "foxit-reader-files";
inherit version;
src = if stdenv.system == "x86_64-linux" then
# /nix/store/l6xwnm2h3jy25yq3sinwikqw8sjx2rw4-FoxitReader-2.4.4.0911.x64
requireFile {
url = "http://foxitsoftware.com";
#name = "FoxitReader.2.4.4.0911.x64.tar.gz";
#sha256 = "0if5wn6jw2jz9jrdmxfnwkbggk2y0mn25x0ny7kqmlkk6snfwqkg";
name = "FoxitReader.enu.setup.2.4.4.0911.x64.run.tar.gz";
sha256 = "144v4jyclhi4qjpxdc1ip22m02ys272qd6001bkzg1nzxka9nmvb";
} else fetchurl {
url = "http://cdn09.foxitsoftware.com/pub/foxit/reader/desktop/linux/2.x/2.4/en_us/FoxitReader2.4.0.14978_Server_x86_enu_Setup.run.tar.gz";
sha256 = "1x3j76faflh84mnl119prgqskg4a90adry8mp0bc82q9dg6vy10q";
};
nativeBuildInputs = [ p7zip ];
phases = [ "installPhase" ];
positions = [
27055774 # fxplugins
30563301 # imageformats
30673930 # images
30727824 # lang
#30866319 # lib (actual content, replaced with nixpkgs libs)
63397954 # platforminputcontexts
63490947 # platforms (inputmethods)
63965424 # platformthemes (gtk adapter)
63991419 # printsupport
64284448 # resource (again, icons)
64299491 # rmssdk (some logging framework)
64836796 # sensors (fingerprint?!)
64854050 # sqldrivers (cloud, I guess)
65195808 # stamps (clipart)
66470077 # welcome
66585904 # Wrappers
# 66636680 # top-level (binary), handled separately
];
top_level_pos = 66636680; # keep updated with positions!
installPhase = ''
mkdir -p $out
tar xf $src
src=$(ls *.run)
for pos in ''${positions[@]}; do
tail -c +$pos $src > tmp$pos.7z
7z x -o$out tmp$pos.7z
rm tmp$pos.7z
done
pos=$top_level_pos
tail -c +$pos $src >tmp$pos.7z
7z x -o$out tmp$pos.7z FoxitReader FoxitReader.desktop
rm tmp$pos.7z
'';
};
openssl-so-wrapper = with stdenv.lib; runCommand "openssl-so-10" {} ''
mkdir -p $out/lib
ln -s ${getLib openssl}/lib/libssl.so $out/lib/libssl.so.10
ln -s ${getLib openssl}/lib/libcrypto.so $out/lib/libcrypto.so.10
'';
in
stdenv.mkDerivation rec {
pname = "foxit-reader";
inherit version;
src = unpacked;
buildInputs = [ qt5.wrapQtAppsHook ];
libPath = with qt5; with xorg; stdenv.lib.makeLibraryPath
[ stdenv.cc.cc stdenv.cc.cc.lib
glib libsecret openssl-so-wrapper libX11 libxcb libGL
dbus fontconfig freetype
qtwebkit qtbase qtxmlpatterns ];
phases = "unpackPhase installPhase fixupPhase";
installPhase = ''
mkdir -p $out/{bin,lib,share/{pixmaps,applications,licenses}}
cp -r * $out/lib
#rm -rf $out/lib/lib
mv $out/lib/FoxitReader.desktop $out/share/applications
echo 'Exec=FoxitReader %U' >> $out/share/applications/FoxitReader.desktop
mv $out/lib/images/FoxitReader.png $out/share/pixmaps
ln -s $out/lib/FoxitReader $out/bin/FoxitReader
ln -s ${license} $out/share/licenses/eula.html
find $out/lib -type d -name .svn -exec rm -rf {} +
find $out/lib -type f -name .directory -exec rm -rf {} +
for f in $out/lib/fxplugins $out/lib/platforminputcontexts $out/lib/platformthemes $out/lib/printsupport $out/lib/rmssdk $out/lib/sensors $out/lib/sqldrivers ; do
find $f -type f -executable -exec patchelf --set-rpath $libPath:$out/lib/fxplugins {} \;
done
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath $libPath $out/lib/FoxitReader
'';
dontStrip = true;
dontPatchELF = true;
meta = {
description = "A versatile PDF reader application";
homepage = http://www.foxitsoftware.com;
license = stdenv.lib.licenses.unfree // { fullName = "Foxit EULA"; };
maintainer = [ stdenv.lib.maintainers.spacefrogg ];
platforms = [ "i686-linux" "x86_64-linux" ];
};
}