2014-05-17 12:14:52 +02:00
|
|
|
{ stdenv, fetchurl, fetchpatch, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
|
2010-08-09 22:59:38 +02:00
|
|
|
, libX11, libXext }:
|
2015-04-19 08:57:45 +02:00
|
|
|
|
2010-08-09 22:59:38 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2015-11-25 15:58:12 +01:00
|
|
|
version = "1.8";
|
2014-06-13 11:29:52 +02:00
|
|
|
name = "mupdf-${version}";
|
2010-08-09 22:59:38 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2012-10-04 08:37:54 +02:00
|
|
|
url = "http://mupdf.com/download/archive/${name}-source.tar.gz";
|
2015-11-25 15:58:12 +01:00
|
|
|
sha256 = "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2";
|
2010-08-09 22:59:38 +02:00
|
|
|
};
|
|
|
|
|
2015-11-25 16:28:57 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
propagatedBuildInputs = [ openjpeg libjpeg jbig2dec ];
|
|
|
|
buildInputs = [ zlib freetype libX11 libXext ];
|
2010-08-09 22:59:38 +02:00
|
|
|
|
2013-11-05 14:44:54 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2014-05-17 14:14:42 +02:00
|
|
|
my_soname = "libmupdf.so.1.3";
|
|
|
|
my_soname_js_none = "libmupdf-js-none.so.1.3";
|
2010-08-09 22:59:38 +02:00
|
|
|
preBuild = ''
|
2014-05-17 14:14:07 +02:00
|
|
|
export makeFlags="prefix=$out build=release XCFLAGS=-fpic"
|
2012-10-04 08:37:54 +02:00
|
|
|
export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
|
2014-05-17 14:14:42 +02:00
|
|
|
|
|
|
|
# Copied from Gentoo ebuild
|
|
|
|
rm -rf thirdparty
|
|
|
|
sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \
|
|
|
|
-e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \
|
|
|
|
-e "/^MUPDF_LIB :=/s:=.*:= \$(OUT)/${my_soname}:" \
|
|
|
|
-e "\$a\$(MUPDF_JS_NONE_LIB):" \
|
|
|
|
-e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \
|
|
|
|
-e "/^MUPDF_JS_NONE_LIB :=/s:=.*:= \$(OUT)/${my_soname_js_none}:" \
|
|
|
|
-i Makefile
|
|
|
|
|
|
|
|
sed -e "s/libopenjpeg1/libopenjp2/" -i Makerules
|
2010-08-09 22:59:38 +02:00
|
|
|
'';
|
|
|
|
|
2013-08-29 19:29:22 +02:00
|
|
|
postInstall = ''
|
2014-05-17 14:14:42 +02:00
|
|
|
ln -s ${my_soname} $out/lib/libmupdf.so
|
|
|
|
|
|
|
|
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
|
|
|
|
Requires: freetype2 libopenjp2 libcrypto
|
2015-11-25 15:58:12 +01:00
|
|
|
Version: ${version}
|
2014-05-17 14:14:42 +02:00
|
|
|
Libs: -L$out/lib -lmupdf
|
|
|
|
Cflags: -I$out/include
|
|
|
|
EOF
|
|
|
|
|
2013-08-29 19:29:22 +02:00
|
|
|
mkdir -p $out/share/applications
|
|
|
|
cat > $out/share/applications/mupdf.desktop <<EOF
|
|
|
|
[Desktop Entry]
|
|
|
|
Type=Application
|
|
|
|
Version=1.0
|
|
|
|
Name=mupdf
|
|
|
|
Comment=PDF viewer
|
2015-08-07 06:42:37 +02:00
|
|
|
Exec=$out/bin/mupdf-x11 %f
|
2013-08-29 19:29:22 +02:00
|
|
|
Terminal=false
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2010-08-09 22:59:38 +02:00
|
|
|
meta = {
|
|
|
|
homepage = http://mupdf.com/;
|
2014-04-03 06:55:17 +02:00
|
|
|
repositories.git = git://git.ghostscript.com/mupdf.git;
|
2010-08-09 22:59:38 +02:00
|
|
|
description = "Lightweight PDF viewer and toolkit written in portable C";
|
2014-06-19 06:19:00 +02:00
|
|
|
license = stdenv.lib.licenses.gpl3Plus;
|
2010-08-09 22:59:38 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ viric ];
|
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
2014-06-13 11:29:52 +02:00
|
|
|
inherit version;
|
2010-08-09 22:59:38 +02:00
|
|
|
};
|
|
|
|
}
|