Merge pull request #2679 from kirelagin/zathura-mupdf

Zathura mupdf
This commit is contained in:
Michael Raskin 2014-05-27 01:54:49 -07:00
commit 40471227a9
7 changed files with 106 additions and 9 deletions

View File

@ -19,12 +19,42 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
my_soname = "libmupdf.so.1.3";
my_soname_js_none = "libmupdf-js-none.so.1.3";
preBuild = ''
export makeFlags="prefix=$out build=release"
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
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
Version: 1.3
Libs: -L$out/lib -lmupdf
Cflags: -I$out/include
EOF
mkdir -p $out/share/applications
cat > $out/share/applications/mupdf.desktop <<EOF
[Desktop Entry]

View File

@ -1,4 +1,4 @@
{ callPackage, pkgs, fetchurl }:
{ callPackage, pkgs, fetchurl, useMupdf }:
rec {
inherit (pkgs) stdenv;
@ -12,6 +12,10 @@ rec {
zathura_pdf_poppler = callPackage ./pdf-poppler { };
zathura_pdf_mupdf = callPackage ./pdf-mupdf {
gtk = pkgs.gtk3;
};
zathura_djvu = callPackage ./djvu {
gtk = pkgs.gtk3;
};
@ -27,9 +31,9 @@ rec {
name = "zathura-${zathura_core.version}";
plugins_path = stdenv.lib.makeSearchPath "lib" [
zathura_pdf_poppler
zathura_djvu
zathura_ps
(if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
];
builder = ./builder.sh;

View File

@ -0,0 +1,17 @@
--- zathura-pdf-mupdf-0.2.6/config.mk
+++ zathura-pdf-mupdf-0.2.6/config.mk
@@ -32,10 +32,11 @@
OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
-MUPDF_LIB ?= -lmupdf -lmupdf-js-none
+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

@ -0,0 +1,29 @@
{ stdenv, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl, openjpeg, libjpeg, jbig2dec }:
stdenv.mkDerivation rec {
version = "0.2.6";
name = "zathura-pdf-mupdf-${version}";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
sha256 = "5df94b6f906008b5f3bca770a552da6d2917d6b8d3e4b3049cb7001302041b20";
};
buildInputs = [ pkgconfig zathura_core gtk girara openssl mupdf openjpeg libjpeg jbig2dec ];
makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
preConfigure = "patch -p1 < ${./config.patch}";
meta = {
homepage = http://pwmt.org/projects/zathura/;
description = "A zathura PDF plugin (mupdf)";
longDescription = ''
The zathura-pdf-mupdf plugin adds PDF support to zathura by
using the mupdf rendering library.
'';
license = stdenv.lib.licenses.zlib;
platforms = stdenv.lib.platforms.linux;
# maintainers = [ ];
};
}

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler, gettext }:
{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler }:
stdenv.mkDerivation rec {
version = "0.2.5";
@ -9,16 +9,16 @@ stdenv.mkDerivation rec {
sha256 = "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0";
};
buildInputs = [ pkgconfig poppler gettext zathura_core girara ];
buildInputs = [ pkgconfig poppler zathura_core girara ];
makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
meta = {
homepage = http://pwmt.org/projects/zathura/;
description = "A zathura PDF plugin";
description = "A zathura PDF plugin (poppler)";
longDescription = ''
The zathura-pdf-poppler plugin adds PDF support to zathura by
using the poppler rendering engine.
using the poppler rendering library.
'';
license = stdenv.lib.licenses.zlib;
platforms = stdenv.lib.platforms.linux;

View File

@ -15,7 +15,21 @@ stdenv.mkDerivation rec {
nativebuildInputs = [ pkgconfig ];
propagatedBuildInputs = [ libpng libtiff lcms ]; # in closure anyway
postInstall = glib.flattenInclude;
postInstall = glib.flattenInclude + ''
mkdir -p "$out/lib/pkgconfig"
cat >"$out/lib/pkgconfig/libopenjp2.pc" <<EOF
prefix=$out
libdir=$out/lib
includedir=$out/include
Name: openjp2
Description: JPEG2000 library (Part 1 and 2)
URL: http://www.openjpeg.org/
Version: @OPENJPEG_VERSION@
Libs: -L$out/lib -lopenjp2
Cflags: -I$out/include
EOF
'';
meta = {
homepage = http://www.openjpeg.org/;

View File

@ -9810,7 +9810,10 @@ let
zathuraCollection = recurseIntoAttrs
(let callPackage = newScope pkgs.zathuraCollection; in
import ../applications/misc/zathura { inherit callPackage pkgs fetchurl; });
import ../applications/misc/zathura {
inherit callPackage pkgs fetchurl;
useMupdf = config.zathura.useMupdf or false;
});
zathura = zathuraCollection.zathuraWrapper;