summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-text/mupdf/Manifest2
-rw-r--r--app-text/mupdf/files/mupdf-1.14-CFLAGS.patch13
-rw-r--r--app-text/mupdf/files/mupdf-1.14-Makefile.patch46
-rw-r--r--app-text/mupdf/files/mupdf-1.14-fix-big-endian.patch125
-rw-r--r--app-text/mupdf/files/mupdf-1.14-libressl.patch45
-rw-r--r--app-text/mupdf/files/mupdf-1.14-r3-openssl-curl-x11.patch35
-rw-r--r--app-text/mupdf/files/mupdf-1.3-zoom-2.patch10
-rw-r--r--app-text/mupdf/mupdf-1.14.0-r3.ebuild129
-rw-r--r--app-text/mupdf/mupdf-1.15.0.ebuild130
9 files changed, 535 insertions, 0 deletions
diff --git a/app-text/mupdf/Manifest b/app-text/mupdf/Manifest
index 964f9c135010..9142b4ccaf02 100644
--- a/app-text/mupdf/Manifest
+++ b/app-text/mupdf/Manifest
@@ -1 +1,3 @@
+DIST mupdf-1.14.0-source.tar.xz 41602372 BLAKE2B bb680038344af16c7231a18a009c0d04c5f50b3fcbaf061c9f5907f35d79eea93eeced7c2a43a06a963b93b39c74d0246c5fdad35655953d1aa5efb79737265a SHA512 bd41125dac1a81b7dbbfbb5f5e06e70bb601854731e0945983688da5d8d7c0bca9771fff2e4b6d9c36dbead6146f0a866ed7427d58e13d02ed6dfd94dcfe54bf
+DIST mupdf-1.15.0-source.tar.xz 39828864 BLAKE2B 15d0e4244062a91c7055b98fa61f2b02e0e3effbcf5374fe589f5a0d2ba2a2d4a59318ae3c0f28d866c6b07554e4b1e65ee9264c26a5f4524ef34e998d6c3320 SHA512 ef19362e8b6c2843e214fd2fcdcc9ba91017884383f7e1cfe08ef1f528a233820475ddfdd8aef481e6e37ae69e8b64324eb4b30699baa8055e99e47c2fab31dd
DIST mupdf-1.16.1-source.tar.xz 45800404 BLAKE2B bc4158a457056c55db52a518efc13c289cca537c29a6b563046297dc225f3ce0add781adb8520c4d0829d653ed0539042597e341cb21c4fb4c462ed422bf735b SHA512 fa657e6b9251aff91c25e91b335ea829b797dd91a759505bfd7259f8236613f590a044bc741e9b0587da55817a1ab8c1499c067d65d683d099259d06d91a8f50
diff --git a/app-text/mupdf/files/mupdf-1.14-CFLAGS.patch b/app-text/mupdf/files/mupdf-1.14-CFLAGS.patch
new file mode 100644
index 000000000000..90972e8c53ea
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.14-CFLAGS.patch
@@ -0,0 +1,13 @@
+diff --git a/Makerules b/Makerules
+index fc9bf998..82f10b28 100644
+--- a/Makerules
++++ b/Makerules
+@@ -21,8 +21,6 @@ SANITIZE_FLAGS += -fsanitize=address
+ SANITIZE_FLAGS += -fsanitize=leak
+
+ ifeq ($(build),debug)
+- CFLAGS += -pipe -g
+- LDFLAGS += -g $(LDREMOVEUNREACH)
+ else ifeq ($(build),release)
+ CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
+ LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
diff --git a/app-text/mupdf/files/mupdf-1.14-Makefile.patch b/app-text/mupdf/files/mupdf-1.14-Makefile.patch
new file mode 100644
index 000000000000..a8c4ef770dce
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.14-Makefile.patch
@@ -0,0 +1,46 @@
+1. debug build (not sure why...)
+2. build shared library
+3. add optional static lib target
+4. Don't install COPYING
+diff --git a/Makefile b/Makefile
+index 37fc48e6..4303e9fa 100644
+--- a/Makefile
++++ b/Makefile
+@@ -3,7 +3,7 @@
+ -include user.make
+
+ ifndef build
+- build := release
++ build := debug
+ endif
+
+ ifndef OUT
+@@ -190,13 +190,15 @@ generate: source/pdf/js/util.js.h
+
+ # --- Library ---
+
+-MUPDF_LIB = $(OUT)/libmupdf.a
+-THIRD_LIB = $(OUT)/libmupdf-third.a
++MUPDF_LIB = libmupdf.so.$(GENTOO_PV)
++MUPDF_STATIC = $(OUT)/libmupdf.a
++THIRD_LIB =
+ THREAD_LIB = $(OUT)/libmupdf-threads.a
+ PKCS7_LIB = $(OUT)/libmupdf-pkcs7.a
+
+-$(MUPDF_LIB) : $(MUPDF_OBJ)
+-$(THIRD_LIB) : $(THIRD_OBJ)
++$(MUPDF_LIB): $(MUPDF_OBJ) $(THIRD_OBJ)
++ $(QUIET_LINK) $(CC) $(LDFLAGS) --shared -Wl,-soname -Wl,$(MUPDF_LIB) -Wl,--no-undefined -o $@ $^ $(THIRD_LIBS) $(LIBS)
++$(MUPDF_STATIC): $(MUPDF_OBJ) $(THIRD_OBJ)
+ $(THREAD_LIB) : $(THREAD_OBJ)
+ $(PKCS7_LIB) : $(PKCS7_OBJ)
+
+@@ -355,7 +357,7 @@ install: libs apps
+
+ install -d $(DESTDIR)$(docdir)
+ install -d $(DESTDIR)$(docdir)/examples
+- install README COPYING CHANGES $(DESTDIR)$(docdir)
++ install README CHANGES $(DESTDIR)$(docdir)
+ install docs/*.html docs/*.css docs/*.png $(DESTDIR)$(docdir)
+ install docs/examples/* $(DESTDIR)$(docdir)/examples
+
diff --git a/app-text/mupdf/files/mupdf-1.14-fix-big-endian.patch b/app-text/mupdf/files/mupdf-1.14-fix-big-endian.patch
new file mode 100644
index 000000000000..dc472153ca6b
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.14-fix-big-endian.patch
@@ -0,0 +1,125 @@
+vdupras note: exact same patch as in
+https://bugs.ghostscript.com/show_bug.cgi?id=699395 except for tweaked
+diff paths.
+From 5fb79e6ccb805b3d94c8bb8eb0990d9944ae7602 Mon Sep 17 00:00:00 2001
+Message-Id: <5fb79e6ccb805b3d94c8bb8eb0990d9944ae7602.1528041417.git.mjg@fedoraproject.org>
+From: Michael J Gruber <mjg@fedoraproject.org>
+Date: Sun, 3 Jun 2018 17:55:46 +0200
+Subject: [PATCH] fix build on big endian
+
+0dc1153 ("Spread of context into all procedures and removal from
+structures", 2017-04-26) missed a few spots that are relevant on big
+endian only.
+
+Add the missing ContextIDs in the call chain so that the build succeeds
+again.
+
+Signed-off-by: Michael J Gruber <mjg@fedoraproject.org>
+---
+ src/cmsmd5.c | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/src/cmsmd5.c b/src/cmsmd5.c
+index 4b8f7f9..dd0925a 100644
+--- a/thirdparty/lcms2/src/cmsmd5.c
++++ b/thirdparty/lcms2/src/cmsmd5.c
+@@ -29,7 +29,7 @@
+ #ifdef CMS_USE_BIG_ENDIAN
+
+ static
+-void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
++void byteReverse(cmsContext ContextID, cmsUInt8Number * buf, cmsUInt32Number longs)
+ {
+ do {
+
+@@ -42,7 +42,7 @@ void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
+ }
+
+ #else
+-#define byteReverse(buf, len)
++#define byteReverse(ContextID, buf, len)
+ #endif
+
+
+@@ -172,7 +172,7 @@ cmsHANDLE MD5alloc(cmsContext ContextID)
+
+
+ static
+-void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
++void MD5add(cmsContext ContextID, cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
+ {
+ _cmsMD5* ctx = (_cmsMD5*) Handle;
+ cmsUInt32Number t;
+@@ -196,7 +196,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
+ }
+
+ memmove(p, buf, t);
+- byteReverse(ctx->in, 16);
++ byteReverse(ContextID, ctx->in, 16);
+
+ MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+ buf += t;
+@@ -205,7 +205,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
+
+ while (len >= 64) {
+ memmove(ctx->in, buf, 64);
+- byteReverse(ctx->in, 16);
++ byteReverse(ContextID, ctx->in, 16);
+ MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+ buf += 64;
+ len -= 64;
+@@ -216,7 +216,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
+
+ // Destroy the object and return the checksum
+ static
+-void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle)
++void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle)
+ {
+ _cmsMD5* ctx = (_cmsMD5*) Handle;
+ cmsUInt32Number count;
+@@ -232,21 +232,21 @@ void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle)
+ if (count < 8) {
+
+ memset(p, 0, count);
+- byteReverse(ctx->in, 16);
++ byteReverse(ContextID, ctx->in, 16);
+ MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+
+ memset(ctx->in, 0, 56);
+ } else {
+ memset(p, 0, count - 8);
+ }
+- byteReverse(ctx->in, 14);
++ byteReverse(ContextID, ctx->in, 14);
+
+ ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0];
+ ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1];
+
+ MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+
+- byteReverse((cmsUInt8Number *) ctx->buf, 4);
++ byteReverse(ContextID, (cmsUInt8Number *) ctx->buf, 4);
+ memmove(ProfileID ->ID8, ctx->buf, 16);
+
+ _cmsFree(ctx ->ContextID, ctx);
+@@ -291,7 +291,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile)
+ if (MD5 == NULL) goto Error;
+
+ // Add all bytes
+- MD5add(MD5, Mem, BytesNeeded);
++ MD5add(ContextID,MD5, Mem, BytesNeeded);
+
+ // Temp storage is no longer needed
+ _cmsFree(ContextID, Mem);
+@@ -300,7 +300,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile)
+ memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
+
+ // And store the ID
+- MD5finish(&Icc ->ProfileID, MD5);
++ MD5finish(ContextID, &Icc ->ProfileID, MD5);
+ return TRUE;
+
+ Error:
+--
+2.18.0.rc0.294.g786209a621
+
diff --git a/app-text/mupdf/files/mupdf-1.14-libressl.patch b/app-text/mupdf/files/mupdf-1.14-libressl.patch
new file mode 100644
index 000000000000..fcc0a7205c1c
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.14-libressl.patch
@@ -0,0 +1,45 @@
+From 8561b744ac95ab6145a1163fa1d7c490a3329465 Mon Sep 17 00:00:00 2001
+From: William <wonko@undefined.re>
+Date: Mon, 12 Nov 2018 16:50:07 +0100
+Subject: [PATCH] hardcode missing ssl functions
+
+---
+ source/helpers/pkcs7/pkcs7-openssl.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/source/helpers/pkcs7/pkcs7-openssl.c b/source/helpers/pkcs7/pkcs7-openssl.c
+index 58dbf65..2b1f9e9 100644
+--- a/source/helpers/pkcs7/pkcs7-openssl.c
++++ b/source/helpers/pkcs7/pkcs7-openssl.c
+@@ -511,6 +511,28 @@ static void signer_drop_designated_name(pdf_pkcs7_signer *signer, pdf_pkcs7_desi
+ fz_free(osigner->ctx, dn);
+ }
+
++int
++PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag)
++{
++ return OBJ_obj2nid(bag->type);
++}
++
++const STACK_OF(PKCS12_SAFEBAG) *
++PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag)
++{
++ if (OBJ_obj2nid(bag->type) != NID_safeContentsBag)
++ return NULL;
++ return bag->value.safes;
++}
++
++const PKCS8_PRIV_KEY_INFO *
++PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag)
++{
++ if (PKCS12_SAFEBAG_get_nid(bag) != NID_keyBag)
++ return NULL;
++ return bag->value.keybag;
++}
++
+ static void add_from_bags(X509 **pX509, EVP_PKEY **pPkey, const STACK_OF(PKCS12_SAFEBAG) *bags, const char *pw);
+
+ static void add_from_bag(X509 **pX509, EVP_PKEY **pPkey, PKCS12_SAFEBAG *bag, const char *pw)
+--
+2.19.1
+
diff --git a/app-text/mupdf/files/mupdf-1.14-r3-openssl-curl-x11.patch b/app-text/mupdf/files/mupdf-1.14-r3-openssl-curl-x11.patch
new file mode 100644
index 000000000000..79efe32c0e41
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.14-r3-openssl-curl-x11.patch
@@ -0,0 +1,35 @@
+diff --git a/Makerules b/Makerules
+index fc9bf998..f1fd93cb 100644
+--- a/Makerules
++++ b/Makerules
+@@ -113,10 +113,11 @@ else ifeq ($(OS),Linux)
+ SYS_ZLIB_LIBS := $(shell pkg-config --libs zlib)
+ endif
+
+- HAVE_CURL := $(shell pkg-config --exists libcurl && echo yes)
++ HAVE_CURL ?= not-unless-portage-tells-me
+ ifeq ($(HAVE_CURL),yes)
+ SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
+- SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
++ # We have to forcibly add -lpthread to avoid linking errors.
++ SYS_CURL_LIBS := $(shell pkg-config --libs libcurl) -lpthread
+ endif
+
+ HAVE_GLUT := yes
+@@ -125,13 +126,14 @@ else ifeq ($(OS),Linux)
+ SYS_GLUT_LIBS := -lglut -lGL
+ endif
+
+- HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
++ HAVE_X11 ?= not-unless-portage-tells-me
+ ifeq ($(HAVE_X11),yes)
+ X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
+ X11_LIBS := $(shell pkg-config --libs x11 xext)
+ endif
+
+- HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
++
++ HAVE_LIBCRYPTO ?= not-unless-portage-tells-me
+ ifeq ($(HAVE_LIBCRYPTO),yes)
+ LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
+ LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
diff --git a/app-text/mupdf/files/mupdf-1.3-zoom-2.patch b/app-text/mupdf/files/mupdf-1.3-zoom-2.patch
new file mode 100644
index 000000000000..353912450236
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.3-zoom-2.patch
@@ -0,0 +1,10 @@
+--- mupdf-1.3/platform/x11/pdfapp.c
++++ mupdf-1.3/platform/x11/pdfapp.c
+@@ -866,6 +867,7 @@
+ break;
+
+ case ' ':
++ case 'F':
+ panto = DONT_PAN;
+ if (app->numberlen > 0)
+ app->pageno += atoi(app->number);
diff --git a/app-text/mupdf/mupdf-1.14.0-r3.ebuild b/app-text/mupdf/mupdf-1.14.0-r3.ebuild
new file mode 100644
index 000000000000..fca81cfa02fd
--- /dev/null
+++ b/app-text/mupdf/mupdf-1.14.0-r3.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit flag-o-matic toolchain-funcs xdg
+
+DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
+HOMEPAGE="https://mupdf.com/"
+SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz"
+
+LICENSE="AGPL-3"
+SLOT="0/${PV}"
+KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ppc ppc64 s390 x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="X curl +javascript libressl opengl ssl static-libs +vanilla"
+
+RDEPEND="
+ >=dev-lang/mujs-1.0.4
+ media-libs/freetype:2=[static-libs?]
+ media-libs/harfbuzz:=[static-libs?,truetype]
+ media-libs/jbig2dec:=[static-libs?]
+ media-libs/libpng:0=[static-libs?]
+ >=media-libs/openjpeg-2.1:2=[static-libs?]
+ virtual/jpeg[static-libs?]
+ curl? ( net-misc/curl[static-libs?] )
+ opengl? ( >=media-libs/freeglut-3.0.0:= )
+ ssl? (
+ libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] )
+ !libressl? ( >=dev-libs/openssl-1.1:0=[static-libs?] )
+ )
+ X? (
+ x11-libs/libX11[static-libs?]
+ x11-libs/libXext[static-libs?]
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+REQUIRED_USE="
+ opengl? ( !static-libs )
+ curl? ( X )"
+
+S=${WORKDIR}/${P}-source
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.14-CFLAGS.patch
+ "${FILESDIR}"/${PN}-1.14-Makefile.patch
+ "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
+ # See bugs #662352
+ "${FILESDIR}"/${PN}-1.14-r3-openssl-curl-x11.patch
+ # bug #672998
+ "${FILESDIR}"/${PN}-1.14-fix-big-endian.patch
+)
+
+src_prepare() {
+ xdg_src_prepare
+ use hppa && append-cflags -ffunction-sections
+
+ use javascript || \
+ sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
+ -i include/mupdf/fitz/config.h
+
+ use vanilla || eapply \
+ "${FILESDIR}"/${PN}-1.3-zoom-2.patch
+
+ # See bug #670832
+ use ssl && use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch
+
+ sed -e "1iOS = Linux" \
+ -e "1iCC = $(tc-getCC)" \
+ -e "1iLD = $(tc-getLD)" \
+ -e "1iAR = $(tc-getAR)" \
+ -e "1iverbose = yes" \
+ -e "1ibuild = debug" \
+ -e "1iprefix = ${ED}usr" \
+ -e "1ilibdir = ${ED}usr/$(get_libdir)" \
+ -e "1idocdir = ${ED}usr/share/doc/${PF}" \
+ -i Makerules || die
+}
+
+_emake() {
+ # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
+ emake \
+ GENTOO_PV=${PV} \
+ HAVE_GLUT=$(usex opengl) \
+ HAVE_CURL=$(usex curl) \
+ HAVE_LIBCRYPTO=$(usex ssl) \
+ HAVE_X11=$(usex X) \
+ USE_SYSTEM_LIBS=yes \
+ USE_SYSTEM_MUJS=yes \
+ HAVE_OBJCOPY=no \
+ "$@"
+}
+
+src_compile() {
+ _emake XCFLAGS="-fpic"
+
+ use curl && _emake extra-apps
+
+ use static-libs && \
+ _emake build/debug/lib${PN}.a
+}
+
+src_install() {
+ if use X || use opengl ; then
+ domenu platform/debian/${PN}.desktop
+ doicon platform/debian/${PN}.xpm
+ else
+ rm docs/man/${PN}.1
+ fi
+
+ _emake install
+
+ dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so
+
+ use static-libs && \
+ dolib.a build/debug/lib${PN}.a
+ if use opengl ; then
+ einfo "mupdf symlink points to mupdf-gl (bug 616654)"
+ dosym ${PN}-gl /usr/bin/${PN}
+ elif use X ; then
+ einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
+ dosym ${PN}-x11 /usr/bin/${PN}
+ fi
+ use curl && dobin build/debug/${PN}-x11-curl
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins platform/debian/${PN}.pc
+
+ dodoc README CHANGES CONTRIBUTORS
+}
diff --git a/app-text/mupdf/mupdf-1.15.0.ebuild b/app-text/mupdf/mupdf-1.15.0.ebuild
new file mode 100644
index 000000000000..7d1f75d3ee14
--- /dev/null
+++ b/app-text/mupdf/mupdf-1.15.0.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic toolchain-funcs xdg desktop
+
+DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
+HOMEPAGE="https://mupdf.com/"
+SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz"
+
+LICENSE="AGPL-3"
+SLOT="0/${PV}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="X +javascript libressl opengl ssl static-libs vanilla"
+
+# Although we use the bundled, patched version of freeglut in mupdf (because of
+# bug #653298), the best way to ensure that its dependencies are present is to
+# install system's freeglut.
+RDEPEND="
+ media-libs/freetype:2=[static-libs?]
+ media-libs/harfbuzz:=[static-libs?,truetype]
+ media-libs/jbig2dec:=[static-libs?]
+ media-libs/libpng:0=[static-libs?]
+ >=media-libs/openjpeg-2.1:2=[static-libs?]
+ virtual/jpeg[static-libs?]
+ opengl? ( >=media-libs/freeglut-3.0.0:= )
+ ssl? (
+ libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] )
+ !libressl? ( >=dev-libs/openssl-1.1:0=[static-libs?] )
+ )
+ X? (
+ x11-libs/libX11[static-libs?]
+ x11-libs/libXext[static-libs?]
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+REQUIRED_USE="opengl? ( !static-libs )"
+
+S=${WORKDIR}/${P}-source
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.15-CFLAGS.patch
+ "${FILESDIR}"/${PN}-1.15-Makefile.patch
+ "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
+ # See bugs #662352
+ "${FILESDIR}"/${PN}-1.15-openssl-x11.patch
+)
+
+src_prepare() {
+ xdg_src_prepare
+ use hppa && append-cflags -ffunction-sections
+
+ use javascript || \
+ sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
+ -i include/mupdf/fitz/config.h
+
+ use vanilla || eapply \
+ "${FILESDIR}"/${PN}-1.3-zoom-2.patch
+
+ # See bug #670832
+ use ssl && use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch
+
+ sed -e "1iOS = Linux" \
+ -e "1iCC = $(tc-getCC)" \
+ -e "1iLD = $(tc-getLD)" \
+ -e "1iAR = $(tc-getAR)" \
+ -e "1iverbose = yes" \
+ -e "1ibuild = debug" \
+ -e "1iprefix = ${ED}/usr" \
+ -e "1ilibdir = ${ED}/usr/$(get_libdir)" \
+ -e "1idocdir = ${ED}/usr/share/doc/${PF}" \
+ -i Makerules || die
+}
+
+_emake() {
+ # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
+
+ # We don't use system's freeglut because upstream has a special modified
+ # version of it that gives mupdf clipboard support. See bug #653298
+
+ # As of v1.15.0, mupdf started using symbols in mujs that were not part
+ # of any release. We thus go back to using the bundled version of it.
+ # Bug #685244
+ emake \
+ GENTOO_PV=${PV} \
+ HAVE_GLUT=$(usex opengl) \
+ HAVE_LIBCRYPTO=$(usex ssl) \
+ HAVE_X11=$(usex X) \
+ USE_SYSTEM_LIBS=yes \
+ USE_SYSTEM_MUJS=no \
+ USE_SYSTEM_GLUT=no \
+ HAVE_OBJCOPY=no \
+ "$@"
+}
+
+src_compile() {
+ _emake XCFLAGS="-fpic"
+
+ use static-libs && \
+ _emake build/debug/lib${PN}.a
+}
+
+src_install() {
+ if use X || use opengl ; then
+ domenu platform/debian/${PN}.desktop
+ doicon platform/debian/${PN}.xpm
+ else
+ rm docs/man/${PN}.1
+ fi
+
+ _emake install
+
+ dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so
+
+ use static-libs && \
+ dolib.a build/debug/lib${PN}.a
+ if use opengl ; then
+ einfo "mupdf symlink points to mupdf-gl (bug 616654)"
+ dosym ${PN}-gl /usr/bin/${PN}
+ elif use X ; then
+ einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
+ dosym ${PN}-x11 /usr/bin/${PN}
+ fi
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins platform/debian/${PN}.pc
+
+ dodoc README CHANGES CONTRIBUTORS
+}