nixpkgs/pkgs/applications/misc/mupdf/default.nix

84 lines
2.7 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, fetchpatch, pkgconfig
, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXcursor, libXrandr, libXinerama, libXext, harfbuzz, mesa }:
2015-04-19 08:57:45 +02:00
stdenv.mkDerivation rec {
2017-05-26 17:24:37 +02:00
version = "1.11";
name = "mupdf-${version}";
src = fetchurl {
2016-05-15 22:13:31 +02:00
url = "http://mupdf.com/downloads/archive/${name}-source.tar.gz";
2017-05-26 17:24:37 +02:00
sha256 = "02phamcchgsmvjnb3ir7r5sssvx9fcrscn297z73b82n1jl79510";
};
patches = [
2016-08-18 14:12:07 +02:00
# Compatibility with new openjpeg
(fetchpatch {
2017-05-26 17:24:37 +02:00
name = "mupdf-1.11-openjpeg-2.1.1.patch";
url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/0001-mupdf-openjpeg.patch?h=packages/mupdf&id=3d997e7ff2ac20c44856ede22760ba6fbca81a5c";
sha256 = "1vr12kpzmmfr8pp3scwfhrm5laqwd58xm6vx971c4y8bxy60b2ig";
2016-08-18 14:12:07 +02:00
})
2017-02-25 09:58:51 +01:00
(fetchurl {
2017-05-26 17:24:37 +02:00
name = "mupdf-1.11-CVE-2017-6060.patch";
url = "http://git.ghostscript.com/?p=mupdf.git;a=blobdiff_plain;f=platform/x11/jstest_main.c;h=f158d9628ed0c0a84e37fe128277679e8334422a;hp=13c3a0a3ba3ff4aae29f6882d23740833c1d842f;hb=06a012a42c9884e3cd653e7826cff1ddec04eb6e;hpb=34e18d127a02146e3415b33c4b67389ce1ddb614";
sha256 = "163bllvjrbm0gvjb25lv7b6sih4zr4g4lap3h0cbq8dvpjxx0jfc";
2017-02-25 09:58:51 +01:00
})
];
2016-08-18 14:12:07 +02:00
makeFlags = [ "prefix=$(out)" ];
2015-11-25 16:28:57 +01:00
nativeBuildInputs = [ pkgconfig ];
2016-08-18 14:12:07 +02:00
buildInputs = [ zlib libX11 libXcursor libXext harfbuzz mesa libXrandr libXinerama freetype libjpeg jbig2dec openjpeg ];
2016-08-31 12:12:11 +02:00
outputs = [ "bin" "dev" "out" "doc" ];
2016-08-18 14:12:07 +02:00
preConfigure = ''
# Don't remove mujs because upstream version is incompatible
2017-08-03 01:39:41 +02:00
rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,libjpeg,openjpeg,zlib}
2016-08-18 14:12:07 +02:00
'';
2014-05-17 14:14:42 +02:00
2016-08-18 14:12:07 +02:00
postInstall = ''
for i in $out/lib/*.a; do
so="''${i%.a}.so"
gcc -shared -o $so.${version} -Wl,--whole-archive $i -Wl,--no-whole-archive
ln -s $so.${version} $so
rm $i
done
2014-05-17 14:14:42 +02:00
mkdir -p "$out/lib/pkgconfig"
cat >"$out/lib/pkgconfig/mupdf.pc" <<EOF
prefix=$out
libdir=$out/lib
includedir=$out/include
Name: mupdf
Description: Library for rendering PDF documents
2015-11-25 15:58:12 +01:00
Version: ${version}
2016-08-18 14:12:07 +02:00
Libs: -L$out/lib -lmupdf -lmupdfthird
2016-08-31 12:12:11 +02:00
Cflags: -I$dev/include
2014-05-17 14:14:42 +02:00
EOF
2016-08-18 14:12:07 +02:00
moveToOutput "bin" "$bin"
mkdir -p $bin/share/applications
cat > $bin/share/applications/mupdf.desktop <<EOF
[Desktop Entry]
Type=Application
Version=1.0
Name=mupdf
Comment=PDF viewer
2016-08-18 14:12:07 +02:00
Exec=$bin/bin/mupdf-x11 %f
Terminal=false
EOF
'';
2016-08-18 14:12:07 +02:00
enableParallelBuilding = true;
meta = with stdenv.lib; {
homepage = http://mupdf.com;
2014-04-03 06:55:17 +02:00
repositories.git = git://git.ghostscript.com/mupdf.git;
2017-05-26 17:24:37 +02:00
description = "Lightweight PDF, XPS, and E-book viewer and toolkit written in portable C";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ viric vrthra fpletz ];
platforms = platforms.linux;
};
}