Merge pull request #16160 from vrthra/mupdf

mupdf: 1.8 -> 1.9
This commit is contained in:
zimbatm 2016-06-12 23:26:34 +01:00 committed by GitHub
commit ae34904ee9
6 changed files with 69 additions and 66 deletions

View File

@ -1,33 +1,36 @@
{ stdenv, makeWrapper, fetchgit, pkgconfig, ninja, ocaml, findlib, mupdf, lablgl
, gtk3, openjpeg, jbig2dec, mujs, xsel, openssl }:
, gtk3, openjpeg, jbig2dec, mujs, xsel, openssl, freetype, ncurses }:
let ocamlVersion = (builtins.parseDrvName (ocaml.name)).version;
in stdenv.mkDerivation rec {
name = "llpp-${version}";
version = "21-git-2015-07-30";
version = "21-git-2016-05-07";
src = fetchgit {
url = "git://repo.or.cz/llpp.git";
rev = "e9fe06d684b145a104cc319673076e069e853cac";
sha256 = "0w6kdjmh6jp5j88m213r0dg66ma42nxl6j4hjy4xnhkf52mg0iwx";
rev = "1beb003ca0f4ed90fda2823cb07c2eb674fc3ca4";
sha256 = "1r59yfm81zmiij401d3wc3zb1zc873ss02gkplbwi4lad2l0chba";
fetchSubmodules = false;
};
buildInputs = [ pkgconfig ninja makeWrapper ocaml findlib mupdf lablgl
gtk3 jbig2dec openjpeg mujs openssl ];
gtk3 jbig2dec openjpeg mujs openssl freetype ncurses ];
dontStrip = true;
configurePhase = ''
sh configure.sh -O -F ${mupdf}
sed -i 's;-lopenjpeg;-lopenjp2;g' .config
sed -i 's;$builddir/link\.so;link.so;g' build.ninja
sed -i -e 's+-I \$srcdir/mupdf/include -I \$srcdir/mupdf/thirdparty/freetype/include+-I ${freetype}/include+' build.sh
sed -i -e 's+-lmupdf +-lfreetype -lz -lharfbuzz -ljbig2dec -lopenjp2 -ljpeg -lmupdf +' build.sh
sed -i -e 's+-L\$srcdir/mupdf/build/native ++' build.sh
'';
buildPhase = "${ninja}/bin/ninja";
buildPhase = ''
sh ./build.sh build
'';
installPhase = ''
install -d $out/bin $out/lib
install build/llpp $out/bin
install link.so $out/lib
wrapProgram $out/bin/llpp \
--prefix CAML_LD_LIBRARY_PATH ":" "${lablgl}/lib/ocaml/${ocamlVersion}/site-lib/lablgl" \
--prefix CAML_LD_LIBRARY_PATH ":" "$out/lib" \

View File

@ -1,42 +1,25 @@
{ stdenv, fetchurl, fetchpatch, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXext }:
{ stdenv, fetchurl, fetchpatch, pkgconfig
, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXcursor, libXrandr, libXinerama, libXext, harfbuzz, mesa }:
stdenv.mkDerivation rec {
version = "1.8";
version = "1.9";
name = "mupdf-${version}";
src = fetchurl {
url = "http://mupdf.com/downloads/archive/${name}-source.tar.gz";
sha256 = "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2";
sha256 = "15p2k1n3afc7bnqrc0zfqz31fjfq3rrrrj4fwwy5az26d11ynxhp";
};
NIX_CFLAGS_COMPILE= [ "-fPIC" ];
nativeBuildInputs = [ pkgconfig ];
propagatedBuildInputs = [ openjpeg libjpeg jbig2dec ];
buildInputs = [ zlib freetype libX11 libXext ];
buildInputs = [ zlib freetype libX11 libXcursor libXext harfbuzz mesa libXrandr libXinerama];
enableParallelBuilding = true;
installPhase = ''
make install prefix=$out
gcc -shared -o $out/lib/libmupdf.so.${version} -Wl,--whole-archive $out/lib/libmupdf.a -Wl,--no-whole-archive
my_soname = "libmupdf.so.1.3";
my_soname_js_none = "libmupdf-js-none.so.1.3";
preBuild = ''
export makeFlags="prefix=$out build=release XCFLAGS=-fpic"
export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
# 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
'';
postInstall = ''
ln -s ${my_soname} $out/lib/libmupdf.so
ln -s $out/lib/libmupdf.so.${version} $out/lib/libmupdf.so
mkdir -p "$out/lib/pkgconfig"
cat >"$out/lib/pkgconfig/mupdf.pc" <<EOF
@ -63,14 +46,14 @@ stdenv.mkDerivation rec {
Terminal=false
EOF
'';
enableParallelBuilding = true;
meta = {
homepage = http://mupdf.com/;
meta = with stdenv.lib; {
homepage = http://mupdf.com;
repositories.git = git://git.ghostscript.com/mupdf.git;
description = "Lightweight PDF viewer and toolkit written in portable C";
license = stdenv.lib.licenses.gpl3Plus;
maintainers = with stdenv.lib.maintainers; [ viric ];
platforms = with stdenv.lib.platforms; linux;
inherit version;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ viric vrthra ];
platforms = platforms.linux;
};
}

View File

@ -1,17 +0,0 @@
--- zathura-pdf-mupdf-0.2.7/config.mk
+++ zathura-pdf-mupdf-0.2.7/config.mk
@@ -32,10 +32,11 @@
OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
-MUPDF_LIB ?= -lmupdf -lmujs
+MUPDF_INC ?= $(shell pkg-config --cflags mupdf)
+MUPDF_LIB ?= $(shell pkg-config --libs mupdf)
-INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
-LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
+INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC} ${MUPDF_INC}
+LIBS = ${GTK_LIB} ${GIRARA_LIB} ${OPENSSL_LIB} ${MUPDF_LIB} -ljbig2dec -ljpeg
# flags
CFLAGS += -std=c99 -fPIC -pedantic -Wall -Wno-format-zero-length $(INCS)

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl }:
{ stdenv, lib, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl, libjpeg, jbig2dec, openjpeg, fetchpatch}:
stdenv.mkDerivation rec {
version = "0.3.0";
@ -9,13 +9,15 @@ stdenv.mkDerivation rec {
sha256 = "1j3j3wbp49walb19f0966qsnlqbd26wnsjpcxfbf021dav8vk327";
};
buildInputs = [ pkgconfig zathura_core gtk girara openssl mupdf ];
buildInputs = [ pkgconfig zathura_core gtk girara openssl mupdf libjpeg jbig2dec openjpeg ];
makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
patches = [
./config.patch
];
patches = [(fetchpatch {
name = "mupdf-1.9.patch";
url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/mupdf-1.9.patch?h=packages/zathura-pdf-mupdf";
sha256 = "185wgg0z4b0z5aybcnnyvbs50h43imn5xz3nqmya4rk4v5bwy49y";
})];
meta = with lib; {
homepage = http://pwmt.org/projects/zathura/;

View File

@ -31,6 +31,10 @@ stdenv.mkDerivation rec {
imlib2
];
patches = [
./mupdf-1.9.patch
];
configurePhase = ''
# Hack. Probing (`ldconfig -p`) fails with cannot execute binary file.
# Overriding `OPENJP2 =` later works, but makes build output misleading:

View File

@ -0,0 +1,28 @@
--- JFBView-0.5.2-src/Makefile 2016-06-11 23:27:54.969894750 -0700
+++ JFBView-0.5.2-src/Makefile 2016-06-11 23:24:45.181142832 -0700
@@ -134,13 +134,22 @@
.PHONY: detect_libopenjp2
detect_libopenjp2:
- $(eval OPENJP2 = $(shell ldconfig -p | grep -q libopenjp2 && echo 'openjp2' || echo 'openjpeg'))
+ $(eval OPENJP2 = $(shell echo libopenjp2 | grep -q libopenjp2 && echo 'openjp2' || echo 'openjpeg'))
@echo "OPENJP2 = $(OPENJP2)" >> $(CONFIG_MK)
# mupdf_version only depends on -lmupdf.
mupdf_version: mupdf_version.cpp
- $(CXX) $(CXXFLAGS) -o $@ $^ $(LDLIBS) -lmupdf
-
+ $(CXX) $(CXXFLAGS) -o $@ $^ $(LDLIBS) -lmupdf \
+ -lpthread \
+ -lform \
+ -lncurses \
+ -lfreetype \
+ -lharfbuzz \
+ -lz \
+ -ljbig2dec \
+ -ljpeg \
+ -lmujs \
+ -lopenjp2
endif