Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/mupdf/, app-text/mupdf/files/
Date: Tue, 26 Nov 2019 14:25:49
Message-Id: 1574778281.b451e991a41390d90b59e558ba77ce0efc0e1950.anarchy@gentoo
1 commit: b451e991a41390d90b59e558ba77ce0efc0e1950
2 Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 26 14:24:28 2019 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 26 14:24:41 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b451e991
7
8 Revert "app-text/mupdf: cleanup"
9
10 This reverts commit a89743c14b67fa2507926ad8d0aea43b5b8712b0.
11
12 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
13
14 app-text/mupdf/Manifest | 2 +
15 app-text/mupdf/files/mupdf-1.14-CFLAGS.patch | 13 +++
16 app-text/mupdf/files/mupdf-1.14-Makefile.patch | 46 ++++++++
17 .../mupdf/files/mupdf-1.14-fix-big-endian.patch | 125 ++++++++++++++++++++
18 app-text/mupdf/files/mupdf-1.14-libressl.patch | 45 +++++++
19 .../files/mupdf-1.14-r3-openssl-curl-x11.patch | 35 ++++++
20 app-text/mupdf/files/mupdf-1.3-zoom-2.patch | 10 ++
21 app-text/mupdf/mupdf-1.14.0-r3.ebuild | 129 ++++++++++++++++++++
22 app-text/mupdf/mupdf-1.15.0.ebuild | 130 +++++++++++++++++++++
23 9 files changed, 535 insertions(+)
24
25 diff --git a/app-text/mupdf/Manifest b/app-text/mupdf/Manifest
26 index 964f9c13501..9142b4ccaf0 100644
27 --- a/app-text/mupdf/Manifest
28 +++ b/app-text/mupdf/Manifest
29 @@ -1 +1,3 @@
30 +DIST mupdf-1.14.0-source.tar.xz 41602372 BLAKE2B bb680038344af16c7231a18a009c0d04c5f50b3fcbaf061c9f5907f35d79eea93eeced7c2a43a06a963b93b39c74d0246c5fdad35655953d1aa5efb79737265a SHA512 bd41125dac1a81b7dbbfbb5f5e06e70bb601854731e0945983688da5d8d7c0bca9771fff2e4b6d9c36dbead6146f0a866ed7427d58e13d02ed6dfd94dcfe54bf
31 +DIST mupdf-1.15.0-source.tar.xz 39828864 BLAKE2B 15d0e4244062a91c7055b98fa61f2b02e0e3effbcf5374fe589f5a0d2ba2a2d4a59318ae3c0f28d866c6b07554e4b1e65ee9264c26a5f4524ef34e998d6c3320 SHA512 ef19362e8b6c2843e214fd2fcdcc9ba91017884383f7e1cfe08ef1f528a233820475ddfdd8aef481e6e37ae69e8b64324eb4b30699baa8055e99e47c2fab31dd
32 DIST mupdf-1.16.1-source.tar.xz 45800404 BLAKE2B bc4158a457056c55db52a518efc13c289cca537c29a6b563046297dc225f3ce0add781adb8520c4d0829d653ed0539042597e341cb21c4fb4c462ed422bf735b SHA512 fa657e6b9251aff91c25e91b335ea829b797dd91a759505bfd7259f8236613f590a044bc741e9b0587da55817a1ab8c1499c067d65d683d099259d06d91a8f50
33
34 diff --git a/app-text/mupdf/files/mupdf-1.14-CFLAGS.patch b/app-text/mupdf/files/mupdf-1.14-CFLAGS.patch
35 new file mode 100644
36 index 00000000000..90972e8c53e
37 --- /dev/null
38 +++ b/app-text/mupdf/files/mupdf-1.14-CFLAGS.patch
39 @@ -0,0 +1,13 @@
40 +diff --git a/Makerules b/Makerules
41 +index fc9bf998..82f10b28 100644
42 +--- a/Makerules
43 ++++ b/Makerules
44 +@@ -21,8 +21,6 @@ SANITIZE_FLAGS += -fsanitize=address
45 + SANITIZE_FLAGS += -fsanitize=leak
46 +
47 + ifeq ($(build),debug)
48 +- CFLAGS += -pipe -g
49 +- LDFLAGS += -g $(LDREMOVEUNREACH)
50 + else ifeq ($(build),release)
51 + CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
52 + LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
53
54 diff --git a/app-text/mupdf/files/mupdf-1.14-Makefile.patch b/app-text/mupdf/files/mupdf-1.14-Makefile.patch
55 new file mode 100644
56 index 00000000000..a8c4ef770dc
57 --- /dev/null
58 +++ b/app-text/mupdf/files/mupdf-1.14-Makefile.patch
59 @@ -0,0 +1,46 @@
60 +1. debug build (not sure why...)
61 +2. build shared library
62 +3. add optional static lib target
63 +4. Don't install COPYING
64 +diff --git a/Makefile b/Makefile
65 +index 37fc48e6..4303e9fa 100644
66 +--- a/Makefile
67 ++++ b/Makefile
68 +@@ -3,7 +3,7 @@
69 + -include user.make
70 +
71 + ifndef build
72 +- build := release
73 ++ build := debug
74 + endif
75 +
76 + ifndef OUT
77 +@@ -190,13 +190,15 @@ generate: source/pdf/js/util.js.h
78 +
79 + # --- Library ---
80 +
81 +-MUPDF_LIB = $(OUT)/libmupdf.a
82 +-THIRD_LIB = $(OUT)/libmupdf-third.a
83 ++MUPDF_LIB = libmupdf.so.$(GENTOO_PV)
84 ++MUPDF_STATIC = $(OUT)/libmupdf.a
85 ++THIRD_LIB =
86 + THREAD_LIB = $(OUT)/libmupdf-threads.a
87 + PKCS7_LIB = $(OUT)/libmupdf-pkcs7.a
88 +
89 +-$(MUPDF_LIB) : $(MUPDF_OBJ)
90 +-$(THIRD_LIB) : $(THIRD_OBJ)
91 ++$(MUPDF_LIB): $(MUPDF_OBJ) $(THIRD_OBJ)
92 ++ $(QUIET_LINK) $(CC) $(LDFLAGS) --shared -Wl,-soname -Wl,$(MUPDF_LIB) -Wl,--no-undefined -o $@ $^ $(THIRD_LIBS) $(LIBS)
93 ++$(MUPDF_STATIC): $(MUPDF_OBJ) $(THIRD_OBJ)
94 + $(THREAD_LIB) : $(THREAD_OBJ)
95 + $(PKCS7_LIB) : $(PKCS7_OBJ)
96 +
97 +@@ -355,7 +357,7 @@ install: libs apps
98 +
99 + install -d $(DESTDIR)$(docdir)
100 + install -d $(DESTDIR)$(docdir)/examples
101 +- install README COPYING CHANGES $(DESTDIR)$(docdir)
102 ++ install README CHANGES $(DESTDIR)$(docdir)
103 + install docs/*.html docs/*.css docs/*.png $(DESTDIR)$(docdir)
104 + install docs/examples/* $(DESTDIR)$(docdir)/examples
105 +
106
107 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
108 new file mode 100644
109 index 00000000000..dc472153ca6
110 --- /dev/null
111 +++ b/app-text/mupdf/files/mupdf-1.14-fix-big-endian.patch
112 @@ -0,0 +1,125 @@
113 +vdupras note: exact same patch as in
114 +https://bugs.ghostscript.com/show_bug.cgi?id=699395 except for tweaked
115 +diff paths.
116 +From 5fb79e6ccb805b3d94c8bb8eb0990d9944ae7602 Mon Sep 17 00:00:00 2001
117 +Message-Id: <5fb79e6ccb805b3d94c8bb8eb0990d9944ae7602.1528041417.git.mjg@×××××××××××××.org>
118 +From: Michael J Gruber <mjg@×××××××××××××.org>
119 +Date: Sun, 3 Jun 2018 17:55:46 +0200
120 +Subject: [PATCH] fix build on big endian
121 +
122 +0dc1153 ("Spread of context into all procedures and removal from
123 +structures", 2017-04-26) missed a few spots that are relevant on big
124 +endian only.
125 +
126 +Add the missing ContextIDs in the call chain so that the build succeeds
127 +again.
128 +
129 +Signed-off-by: Michael J Gruber <mjg@×××××××××××××.org>
130 +---
131 + src/cmsmd5.c | 22 +++++++++++-----------
132 + 1 file changed, 11 insertions(+), 11 deletions(-)
133 +
134 +diff --git a/src/cmsmd5.c b/src/cmsmd5.c
135 +index 4b8f7f9..dd0925a 100644
136 +--- a/thirdparty/lcms2/src/cmsmd5.c
137 ++++ b/thirdparty/lcms2/src/cmsmd5.c
138 +@@ -29,7 +29,7 @@
139 + #ifdef CMS_USE_BIG_ENDIAN
140 +
141 + static
142 +-void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
143 ++void byteReverse(cmsContext ContextID, cmsUInt8Number * buf, cmsUInt32Number longs)
144 + {
145 + do {
146 +
147 +@@ -42,7 +42,7 @@ void byteReverse(cmsUInt8Number * buf, cmsUInt32Number longs)
148 + }
149 +
150 + #else
151 +-#define byteReverse(buf, len)
152 ++#define byteReverse(ContextID, buf, len)
153 + #endif
154 +
155 +
156 +@@ -172,7 +172,7 @@ cmsHANDLE MD5alloc(cmsContext ContextID)
157 +
158 +
159 + static
160 +-void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
161 ++void MD5add(cmsContext ContextID, cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
162 + {
163 + _cmsMD5* ctx = (_cmsMD5*) Handle;
164 + cmsUInt32Number t;
165 +@@ -196,7 +196,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
166 + }
167 +
168 + memmove(p, buf, t);
169 +- byteReverse(ctx->in, 16);
170 ++ byteReverse(ContextID, ctx->in, 16);
171 +
172 + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
173 + buf += t;
174 +@@ -205,7 +205,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
175 +
176 + while (len >= 64) {
177 + memmove(ctx->in, buf, 64);
178 +- byteReverse(ctx->in, 16);
179 ++ byteReverse(ContextID, ctx->in, 16);
180 + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
181 + buf += 64;
182 + len -= 64;
183 +@@ -216,7 +216,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
184 +
185 + // Destroy the object and return the checksum
186 + static
187 +-void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle)
188 ++void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle)
189 + {
190 + _cmsMD5* ctx = (_cmsMD5*) Handle;
191 + cmsUInt32Number count;
192 +@@ -232,21 +232,21 @@ void MD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle)
193 + if (count < 8) {
194 +
195 + memset(p, 0, count);
196 +- byteReverse(ctx->in, 16);
197 ++ byteReverse(ContextID, ctx->in, 16);
198 + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
199 +
200 + memset(ctx->in, 0, 56);
201 + } else {
202 + memset(p, 0, count - 8);
203 + }
204 +- byteReverse(ctx->in, 14);
205 ++ byteReverse(ContextID, ctx->in, 14);
206 +
207 + ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0];
208 + ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1];
209 +
210 + MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
211 +
212 +- byteReverse((cmsUInt8Number *) ctx->buf, 4);
213 ++ byteReverse(ContextID, (cmsUInt8Number *) ctx->buf, 4);
214 + memmove(ProfileID ->ID8, ctx->buf, 16);
215 +
216 + _cmsFree(ctx ->ContextID, ctx);
217 +@@ -291,7 +291,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile)
218 + if (MD5 == NULL) goto Error;
219 +
220 + // Add all bytes
221 +- MD5add(MD5, Mem, BytesNeeded);
222 ++ MD5add(ContextID,MD5, Mem, BytesNeeded);
223 +
224 + // Temp storage is no longer needed
225 + _cmsFree(ContextID, Mem);
226 +@@ -300,7 +300,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile)
227 + memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
228 +
229 + // And store the ID
230 +- MD5finish(&Icc ->ProfileID, MD5);
231 ++ MD5finish(ContextID, &Icc ->ProfileID, MD5);
232 + return TRUE;
233 +
234 + Error:
235 +--
236 +2.18.0.rc0.294.g786209a621
237 +
238
239 diff --git a/app-text/mupdf/files/mupdf-1.14-libressl.patch b/app-text/mupdf/files/mupdf-1.14-libressl.patch
240 new file mode 100644
241 index 00000000000..fcc0a7205c1
242 --- /dev/null
243 +++ b/app-text/mupdf/files/mupdf-1.14-libressl.patch
244 @@ -0,0 +1,45 @@
245 +From 8561b744ac95ab6145a1163fa1d7c490a3329465 Mon Sep 17 00:00:00 2001
246 +From: William <wonko@×××××××××.re>
247 +Date: Mon, 12 Nov 2018 16:50:07 +0100
248 +Subject: [PATCH] hardcode missing ssl functions
249 +
250 +---
251 + source/helpers/pkcs7/pkcs7-openssl.c | 22 ++++++++++++++++++++++
252 + 1 file changed, 22 insertions(+)
253 +
254 +diff --git a/source/helpers/pkcs7/pkcs7-openssl.c b/source/helpers/pkcs7/pkcs7-openssl.c
255 +index 58dbf65..2b1f9e9 100644
256 +--- a/source/helpers/pkcs7/pkcs7-openssl.c
257 ++++ b/source/helpers/pkcs7/pkcs7-openssl.c
258 +@@ -511,6 +511,28 @@ static void signer_drop_designated_name(pdf_pkcs7_signer *signer, pdf_pkcs7_desi
259 + fz_free(osigner->ctx, dn);
260 + }
261 +
262 ++int
263 ++PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag)
264 ++{
265 ++ return OBJ_obj2nid(bag->type);
266 ++}
267 ++
268 ++const STACK_OF(PKCS12_SAFEBAG) *
269 ++PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag)
270 ++{
271 ++ if (OBJ_obj2nid(bag->type) != NID_safeContentsBag)
272 ++ return NULL;
273 ++ return bag->value.safes;
274 ++}
275 ++
276 ++const PKCS8_PRIV_KEY_INFO *
277 ++PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag)
278 ++{
279 ++ if (PKCS12_SAFEBAG_get_nid(bag) != NID_keyBag)
280 ++ return NULL;
281 ++ return bag->value.keybag;
282 ++}
283 ++
284 + static void add_from_bags(X509 **pX509, EVP_PKEY **pPkey, const STACK_OF(PKCS12_SAFEBAG) *bags, const char *pw);
285 +
286 + static void add_from_bag(X509 **pX509, EVP_PKEY **pPkey, PKCS12_SAFEBAG *bag, const char *pw)
287 +--
288 +2.19.1
289 +
290
291 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
292 new file mode 100644
293 index 00000000000..79efe32c0e4
294 --- /dev/null
295 +++ b/app-text/mupdf/files/mupdf-1.14-r3-openssl-curl-x11.patch
296 @@ -0,0 +1,35 @@
297 +diff --git a/Makerules b/Makerules
298 +index fc9bf998..f1fd93cb 100644
299 +--- a/Makerules
300 ++++ b/Makerules
301 +@@ -113,10 +113,11 @@ else ifeq ($(OS),Linux)
302 + SYS_ZLIB_LIBS := $(shell pkg-config --libs zlib)
303 + endif
304 +
305 +- HAVE_CURL := $(shell pkg-config --exists libcurl && echo yes)
306 ++ HAVE_CURL ?= not-unless-portage-tells-me
307 + ifeq ($(HAVE_CURL),yes)
308 + SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
309 +- SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
310 ++ # We have to forcibly add -lpthread to avoid linking errors.
311 ++ SYS_CURL_LIBS := $(shell pkg-config --libs libcurl) -lpthread
312 + endif
313 +
314 + HAVE_GLUT := yes
315 +@@ -125,13 +126,14 @@ else ifeq ($(OS),Linux)
316 + SYS_GLUT_LIBS := -lglut -lGL
317 + endif
318 +
319 +- HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
320 ++ HAVE_X11 ?= not-unless-portage-tells-me
321 + ifeq ($(HAVE_X11),yes)
322 + X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
323 + X11_LIBS := $(shell pkg-config --libs x11 xext)
324 + endif
325 +
326 +- HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
327 ++
328 ++ HAVE_LIBCRYPTO ?= not-unless-portage-tells-me
329 + ifeq ($(HAVE_LIBCRYPTO),yes)
330 + LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
331 + LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
332
333 diff --git a/app-text/mupdf/files/mupdf-1.3-zoom-2.patch b/app-text/mupdf/files/mupdf-1.3-zoom-2.patch
334 new file mode 100644
335 index 00000000000..35391245023
336 --- /dev/null
337 +++ b/app-text/mupdf/files/mupdf-1.3-zoom-2.patch
338 @@ -0,0 +1,10 @@
339 +--- mupdf-1.3/platform/x11/pdfapp.c
340 ++++ mupdf-1.3/platform/x11/pdfapp.c
341 +@@ -866,6 +867,7 @@
342 + break;
343 +
344 + case ' ':
345 ++ case 'F':
346 + panto = DONT_PAN;
347 + if (app->numberlen > 0)
348 + app->pageno += atoi(app->number);
349
350 diff --git a/app-text/mupdf/mupdf-1.14.0-r3.ebuild b/app-text/mupdf/mupdf-1.14.0-r3.ebuild
351 new file mode 100644
352 index 00000000000..fca81cfa02f
353 --- /dev/null
354 +++ b/app-text/mupdf/mupdf-1.14.0-r3.ebuild
355 @@ -0,0 +1,129 @@
356 +# Copyright 1999-2019 Gentoo Authors
357 +# Distributed under the terms of the GNU General Public License v2
358 +
359 +EAPI=6
360 +
361 +inherit flag-o-matic toolchain-funcs xdg
362 +
363 +DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
364 +HOMEPAGE="https://mupdf.com/"
365 +SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz"
366 +
367 +LICENSE="AGPL-3"
368 +SLOT="0/${PV}"
369 +KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ppc ppc64 s390 x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
370 +IUSE="X curl +javascript libressl opengl ssl static-libs +vanilla"
371 +
372 +RDEPEND="
373 + >=dev-lang/mujs-1.0.4
374 + media-libs/freetype:2=[static-libs?]
375 + media-libs/harfbuzz:=[static-libs?,truetype]
376 + media-libs/jbig2dec:=[static-libs?]
377 + media-libs/libpng:0=[static-libs?]
378 + >=media-libs/openjpeg-2.1:2=[static-libs?]
379 + virtual/jpeg[static-libs?]
380 + curl? ( net-misc/curl[static-libs?] )
381 + opengl? ( >=media-libs/freeglut-3.0.0:= )
382 + ssl? (
383 + libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] )
384 + !libressl? ( >=dev-libs/openssl-1.1:0=[static-libs?] )
385 + )
386 + X? (
387 + x11-libs/libX11[static-libs?]
388 + x11-libs/libXext[static-libs?]
389 + )"
390 +DEPEND="${RDEPEND}
391 + virtual/pkgconfig"
392 +
393 +REQUIRED_USE="
394 + opengl? ( !static-libs )
395 + curl? ( X )"
396 +
397 +S=${WORKDIR}/${P}-source
398 +
399 +PATCHES=(
400 + "${FILESDIR}"/${PN}-1.14-CFLAGS.patch
401 + "${FILESDIR}"/${PN}-1.14-Makefile.patch
402 + "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
403 + # See bugs #662352
404 + "${FILESDIR}"/${PN}-1.14-r3-openssl-curl-x11.patch
405 + # bug #672998
406 + "${FILESDIR}"/${PN}-1.14-fix-big-endian.patch
407 +)
408 +
409 +src_prepare() {
410 + xdg_src_prepare
411 + use hppa && append-cflags -ffunction-sections
412 +
413 + use javascript || \
414 + sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
415 + -i include/mupdf/fitz/config.h
416 +
417 + use vanilla || eapply \
418 + "${FILESDIR}"/${PN}-1.3-zoom-2.patch
419 +
420 + # See bug #670832
421 + use ssl && use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch
422 +
423 + sed -e "1iOS = Linux" \
424 + -e "1iCC = $(tc-getCC)" \
425 + -e "1iLD = $(tc-getLD)" \
426 + -e "1iAR = $(tc-getAR)" \
427 + -e "1iverbose = yes" \
428 + -e "1ibuild = debug" \
429 + -e "1iprefix = ${ED}usr" \
430 + -e "1ilibdir = ${ED}usr/$(get_libdir)" \
431 + -e "1idocdir = ${ED}usr/share/doc/${PF}" \
432 + -i Makerules || die
433 +}
434 +
435 +_emake() {
436 + # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
437 + emake \
438 + GENTOO_PV=${PV} \
439 + HAVE_GLUT=$(usex opengl) \
440 + HAVE_CURL=$(usex curl) \
441 + HAVE_LIBCRYPTO=$(usex ssl) \
442 + HAVE_X11=$(usex X) \
443 + USE_SYSTEM_LIBS=yes \
444 + USE_SYSTEM_MUJS=yes \
445 + HAVE_OBJCOPY=no \
446 + "$@"
447 +}
448 +
449 +src_compile() {
450 + _emake XCFLAGS="-fpic"
451 +
452 + use curl && _emake extra-apps
453 +
454 + use static-libs && \
455 + _emake build/debug/lib${PN}.a
456 +}
457 +
458 +src_install() {
459 + if use X || use opengl ; then
460 + domenu platform/debian/${PN}.desktop
461 + doicon platform/debian/${PN}.xpm
462 + else
463 + rm docs/man/${PN}.1
464 + fi
465 +
466 + _emake install
467 +
468 + dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so
469 +
470 + use static-libs && \
471 + dolib.a build/debug/lib${PN}.a
472 + if use opengl ; then
473 + einfo "mupdf symlink points to mupdf-gl (bug 616654)"
474 + dosym ${PN}-gl /usr/bin/${PN}
475 + elif use X ; then
476 + einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
477 + dosym ${PN}-x11 /usr/bin/${PN}
478 + fi
479 + use curl && dobin build/debug/${PN}-x11-curl
480 + insinto /usr/$(get_libdir)/pkgconfig
481 + doins platform/debian/${PN}.pc
482 +
483 + dodoc README CHANGES CONTRIBUTORS
484 +}
485
486 diff --git a/app-text/mupdf/mupdf-1.15.0.ebuild b/app-text/mupdf/mupdf-1.15.0.ebuild
487 new file mode 100644
488 index 00000000000..7d1f75d3ee1
489 --- /dev/null
490 +++ b/app-text/mupdf/mupdf-1.15.0.ebuild
491 @@ -0,0 +1,130 @@
492 +# Copyright 1999-2019 Gentoo Authors
493 +# Distributed under the terms of the GNU General Public License v2
494 +
495 +EAPI=7
496 +
497 +inherit flag-o-matic toolchain-funcs xdg desktop
498 +
499 +DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
500 +HOMEPAGE="https://mupdf.com/"
501 +SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz"
502 +
503 +LICENSE="AGPL-3"
504 +SLOT="0/${PV}"
505 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
506 +IUSE="X +javascript libressl opengl ssl static-libs vanilla"
507 +
508 +# Although we use the bundled, patched version of freeglut in mupdf (because of
509 +# bug #653298), the best way to ensure that its dependencies are present is to
510 +# install system's freeglut.
511 +RDEPEND="
512 + media-libs/freetype:2=[static-libs?]
513 + media-libs/harfbuzz:=[static-libs?,truetype]
514 + media-libs/jbig2dec:=[static-libs?]
515 + media-libs/libpng:0=[static-libs?]
516 + >=media-libs/openjpeg-2.1:2=[static-libs?]
517 + virtual/jpeg[static-libs?]
518 + opengl? ( >=media-libs/freeglut-3.0.0:= )
519 + ssl? (
520 + libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] )
521 + !libressl? ( >=dev-libs/openssl-1.1:0=[static-libs?] )
522 + )
523 + X? (
524 + x11-libs/libX11[static-libs?]
525 + x11-libs/libXext[static-libs?]
526 + )"
527 +DEPEND="${RDEPEND}
528 + virtual/pkgconfig"
529 +
530 +REQUIRED_USE="opengl? ( !static-libs )"
531 +
532 +S=${WORKDIR}/${P}-source
533 +
534 +PATCHES=(
535 + "${FILESDIR}"/${PN}-1.15-CFLAGS.patch
536 + "${FILESDIR}"/${PN}-1.15-Makefile.patch
537 + "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
538 + # See bugs #662352
539 + "${FILESDIR}"/${PN}-1.15-openssl-x11.patch
540 +)
541 +
542 +src_prepare() {
543 + xdg_src_prepare
544 + use hppa && append-cflags -ffunction-sections
545 +
546 + use javascript || \
547 + sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
548 + -i include/mupdf/fitz/config.h
549 +
550 + use vanilla || eapply \
551 + "${FILESDIR}"/${PN}-1.3-zoom-2.patch
552 +
553 + # See bug #670832
554 + use ssl && use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch
555 +
556 + sed -e "1iOS = Linux" \
557 + -e "1iCC = $(tc-getCC)" \
558 + -e "1iLD = $(tc-getLD)" \
559 + -e "1iAR = $(tc-getAR)" \
560 + -e "1iverbose = yes" \
561 + -e "1ibuild = debug" \
562 + -e "1iprefix = ${ED}/usr" \
563 + -e "1ilibdir = ${ED}/usr/$(get_libdir)" \
564 + -e "1idocdir = ${ED}/usr/share/doc/${PF}" \
565 + -i Makerules || die
566 +}
567 +
568 +_emake() {
569 + # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
570 +
571 + # We don't use system's freeglut because upstream has a special modified
572 + # version of it that gives mupdf clipboard support. See bug #653298
573 +
574 + # As of v1.15.0, mupdf started using symbols in mujs that were not part
575 + # of any release. We thus go back to using the bundled version of it.
576 + # Bug #685244
577 + emake \
578 + GENTOO_PV=${PV} \
579 + HAVE_GLUT=$(usex opengl) \
580 + HAVE_LIBCRYPTO=$(usex ssl) \
581 + HAVE_X11=$(usex X) \
582 + USE_SYSTEM_LIBS=yes \
583 + USE_SYSTEM_MUJS=no \
584 + USE_SYSTEM_GLUT=no \
585 + HAVE_OBJCOPY=no \
586 + "$@"
587 +}
588 +
589 +src_compile() {
590 + _emake XCFLAGS="-fpic"
591 +
592 + use static-libs && \
593 + _emake build/debug/lib${PN}.a
594 +}
595 +
596 +src_install() {
597 + if use X || use opengl ; then
598 + domenu platform/debian/${PN}.desktop
599 + doicon platform/debian/${PN}.xpm
600 + else
601 + rm docs/man/${PN}.1
602 + fi
603 +
604 + _emake install
605 +
606 + dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so
607 +
608 + use static-libs && \
609 + dolib.a build/debug/lib${PN}.a
610 + if use opengl ; then
611 + einfo "mupdf symlink points to mupdf-gl (bug 616654)"
612 + dosym ${PN}-gl /usr/bin/${PN}
613 + elif use X ; then
614 + einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
615 + dosym ${PN}-x11 /usr/bin/${PN}
616 + fi
617 + insinto /usr/$(get_libdir)/pkgconfig
618 + doins platform/debian/${PN}.pc
619 +
620 + dodoc README CHANGES CONTRIBUTORS
621 +}