2017-09-27 20:29:38 +00:00
|
|
|
{ stdenv, lib, fetchurl, fetchpatch, pkgconfig
|
2017-10-03 18:05:57 +00:00
|
|
|
, freetype, harfbuzz, openjpeg, jbig2dec, libjpeg
|
2017-09-27 20:29:38 +00:00
|
|
|
, enableX11 ? true, libX11, libXext
|
|
|
|
, enableCurl ? true, curl, openssl
|
|
|
|
}:
|
2015-04-19 06:57:45 +00:00
|
|
|
|
2010-08-09 20:59:38 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2017-05-26 15:24:37 +00:00
|
|
|
version = "1.11";
|
2014-06-13 09:29:52 +00:00
|
|
|
name = "mupdf-${version}";
|
2010-08-09 20:59:38 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-05-15 20:13:31 +00:00
|
|
|
url = "http://mupdf.com/downloads/archive/${name}-source.tar.gz";
|
2017-05-26 15:24:37 +00:00
|
|
|
sha256 = "02phamcchgsmvjnb3ir7r5sssvx9fcrscn297z73b82n1jl79510";
|
2010-08-09 20:59:38 +00:00
|
|
|
};
|
|
|
|
|
2016-08-03 12:07:50 +00:00
|
|
|
patches = [
|
2016-08-18 12:12:07 +00:00
|
|
|
# Compatibility with new openjpeg
|
|
|
|
(fetchpatch {
|
2017-05-26 15:24:37 +00: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 12:12:07 +00:00
|
|
|
})
|
2017-02-25 08:58:51 +00:00
|
|
|
|
|
|
|
(fetchurl {
|
2017-05-26 15:24:37 +00: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 08:58:51 +00:00
|
|
|
})
|
2017-10-03 18:05:57 +00:00
|
|
|
|
|
|
|
(fetchpatch {
|
|
|
|
name = "mupdf-1.11-shared_libs-1.patch";
|
2017-10-05 21:41:29 +00:00
|
|
|
url = "https://ftp.osuosl.org/pub/blfs/conglomeration/mupdf/mupdf-1.11-shared_libs-1.patch";
|
2017-10-03 18:05:57 +00:00
|
|
|
sha256 = "127x8jhyj3i9cn3mxw9mm5barw2yk43rvmghg54bhn4rjalx857j";
|
|
|
|
})
|
2017-10-25 23:43:45 +00:00
|
|
|
|
|
|
|
(fetchurl {
|
|
|
|
name = "mupdf-1.11-CVE-2017-14685.patch";
|
|
|
|
url = "http://git.ghostscript.com/?p=mupdf.git;a=patch;h=ab1a420613dec93c686acbee2c165274e922f82a";
|
|
|
|
sha256 = "120xapwj0af333n3a32ypxk0jmjv2ia476jg8pzsfqk9a5qqkx46";
|
|
|
|
})
|
|
|
|
|
|
|
|
(fetchurl {
|
|
|
|
name = "mupdf-1.11-CVE-2017-14686.patch";
|
|
|
|
url = "http://git.ghostscript.com/?p=mupdf.git;a=patch;h=0f0fbc07d9be31f5e83ec5328d7311fdfd8328b1";
|
|
|
|
sha256 = "0pkn7mfqhmnsyia4rh4mw4q435bzvlc22crqa1bxpaa0gcyky51c";
|
|
|
|
})
|
|
|
|
|
|
|
|
(fetchurl {
|
|
|
|
name = "mupdf-1.11-CVE-2017-14687.patch";
|
|
|
|
url = "http://git.ghostscript.com/?p=mupdf.git;a=patch;h=2b16dbd8f73269cb15ca61ece75cf8d2d196ed28";
|
|
|
|
sha256 = "01v41cwrdnz3k32fcadk2gk4knqrm3mavzp6pxhn19nwgmqkshjd";
|
|
|
|
})
|
|
|
|
|
|
|
|
(fetchurl {
|
|
|
|
name = "mupdf-1.11-CVE-2017-15587.patch";
|
|
|
|
url = "http://git.ghostscript.com/?p=mupdf.git;a=patch;h=82df2631d7d0446b206ea6b434ea609b6c28b0e8";
|
|
|
|
sha256 = "04kfww7y0wazg6372g44fa2k5kiiigq4616ihkvmp18rz86903n9";
|
|
|
|
})
|
2016-08-03 12:07:50 +00:00
|
|
|
];
|
|
|
|
|
2016-08-18 12:12:07 +00:00
|
|
|
makeFlags = [ "prefix=$(out)" ];
|
2015-11-25 15:28:57 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2017-10-03 18:05:57 +00:00
|
|
|
buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg ]
|
2017-09-27 20:29:38 +00:00
|
|
|
++ lib.optionals enableX11 [ libX11 libXext ]
|
|
|
|
++ lib.optionals enableCurl [ curl openssl ];
|
2017-07-11 09:14:14 +00:00
|
|
|
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
2010-08-09 20:59:38 +00:00
|
|
|
|
2016-08-18 12:12:07 +00:00
|
|
|
preConfigure = ''
|
|
|
|
# Don't remove mujs because upstream version is incompatible
|
2017-08-02 23:39:41 +00:00
|
|
|
rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,libjpeg,openjpeg,zlib}
|
2016-08-18 12:12:07 +00:00
|
|
|
'';
|
2014-05-17 12:14:42 +00:00
|
|
|
|
2016-08-18 12:12:07 +00:00
|
|
|
postInstall = ''
|
2014-05-17 12:14:42 +00: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 14:58:12 +00:00
|
|
|
Version: ${version}
|
2016-08-18 12:12:07 +00:00
|
|
|
Libs: -L$out/lib -lmupdf -lmupdfthird
|
2016-08-31 10:12:11 +00:00
|
|
|
Cflags: -I$dev/include
|
2014-05-17 12:14:42 +00:00
|
|
|
EOF
|
|
|
|
|
2016-08-18 12:12:07 +00:00
|
|
|
moveToOutput "bin" "$bin"
|
|
|
|
mkdir -p $bin/share/applications
|
|
|
|
cat > $bin/share/applications/mupdf.desktop <<EOF
|
2013-08-29 17:29:22 +00:00
|
|
|
[Desktop Entry]
|
|
|
|
Type=Application
|
|
|
|
Version=1.0
|
|
|
|
Name=mupdf
|
|
|
|
Comment=PDF viewer
|
2016-08-18 12:12:07 +00:00
|
|
|
Exec=$bin/bin/mupdf-x11 %f
|
2013-08-29 17:29:22 +00:00
|
|
|
Terminal=false
|
|
|
|
EOF
|
|
|
|
'';
|
2016-08-18 12:12:07 +00:00
|
|
|
|
2016-06-12 03:34:57 +00:00
|
|
|
enableParallelBuilding = true;
|
2013-08-29 17:29:22 +00:00
|
|
|
|
2016-06-12 03:34:57 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://mupdf.com;
|
2014-04-03 04:55:17 +00:00
|
|
|
repositories.git = git://git.ghostscript.com/mupdf.git;
|
2017-05-26 15:24:37 +00:00
|
|
|
description = "Lightweight PDF, XPS, and E-book viewer and toolkit written in portable C";
|
2017-10-29 16:19:18 +00:00
|
|
|
license = licenses.agpl3Plus;
|
2016-09-26 13:53:40 +00:00
|
|
|
maintainers = with maintainers; [ viric vrthra fpletz ];
|
2016-06-12 03:34:57 +00:00
|
|
|
platforms = platforms.linux;
|
2010-08-09 20:59:38 +00:00
|
|
|
};
|
|
|
|
}
|