2016-06-12 03:34:57 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, pkgconfig
|
|
|
|
, zlib, freetype, libjpeg, jbig2dec, openjpeg
|
|
|
|
, libX11, libXcursor, libXrandr, libXinerama, libXext, harfbuzz, mesa }:
|
2015-04-19 06:57:45 +00:00
|
|
|
|
2010-08-09 20:59:38 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2017-02-01 17:57:11 +00:00
|
|
|
version = "1.10a";
|
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-02-01 17:57:11 +00:00
|
|
|
sha256 = "0dm8wcs8i29aibzkqkrn8kcnk4q0kd1v66pg48h5c3qqp4v1zk5a";
|
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 {
|
2016-09-26 13:53:40 +00:00
|
|
|
name = "mupdf-1.9a-openjpeg-2.1.1.patch";
|
2017-02-01 17:57:11 +00:00
|
|
|
url = "https://git.archlinux.org/svntogit/community.git/plain/mupdf/trunk/0001-mupdf-openjpeg.patch?id=5a28ad0a8999a9234aa7848096041992cc988099";
|
|
|
|
sha256 = "1i24qr4xagyapx4bijjfksj4g3bxz8vs5c2mn61nkm29c63knp75";
|
2016-08-18 12:12:07 +00:00
|
|
|
})
|
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 ];
|
2016-08-18 12:12:07 +00:00
|
|
|
buildInputs = [ zlib libX11 libXcursor libXext harfbuzz mesa libXrandr libXinerama freetype libjpeg jbig2dec openjpeg ];
|
2016-08-31 10:12:11 +00:00
|
|
|
outputs = [ "bin" "dev" "out" "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
|
|
|
|
rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,jpeg,openjpeg,zlib}
|
|
|
|
'';
|
2014-05-17 12:14:42 +00:00
|
|
|
|
2016-08-18 12:12:07 +00: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 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;
|
2010-08-09 20:59:38 +00:00
|
|
|
description = "Lightweight PDF viewer and toolkit written in portable C";
|
2016-06-12 03:34:57 +00:00
|
|
|
license = licenses.gpl3Plus;
|
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
|
|
|
};
|
|
|
|
}
|