Gentoo Archives: gentoo-commits

From: Virgil Dupras <vdupras@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, 19 Feb 2019 21:02:38
Message-Id: 1550610062.a5247eb5569e7573eba63db4cf5e6012607e1a6d.vdupras@gentoo
1 commit: a5247eb5569e7573eba63db4cf5e6012607e1a6d
2 Author: Virgil Dupras <vdupras <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 19 20:22:34 2019 +0000
4 Commit: Virgil Dupras <vdupras <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 19 21:01:02 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5247eb5
7
8 app-text/mupdf: fix libressl and openssl
9
10 openssl's requirements is actually 1.1+. prior to this change, mupdf
11 compiled with openssl support unless openssl 1.1+ was installed.
12
13 libressl support requires a patch to work properly.
14
15 Also, other minor fixes. See closed bugs.
16
17 Closes: https://bugs.gentoo.org/671062
18 Closes: https://bugs.gentoo.org/623732
19 Closes: https://bugs.gentoo.org/669698
20 Closes: https://bugs.gentoo.org/670832
21 Signed-off-by: Virgil Dupras <vdupras <AT> gentoo.org>
22 Package-Manager: Portage-2.3.51, Repoman-2.3.11
23
24 app-text/mupdf/files/mupdf-1.14-libressl.patch | 45 +++++++
25 .../files/mupdf-1.14-r3-openssl-curl-x11.patch | 35 ++++++
26 app-text/mupdf/mupdf-1.14.0-r3.ebuild | 132 +++++++++++++++++++++
27 3 files changed, 212 insertions(+)
28
29 diff --git a/app-text/mupdf/files/mupdf-1.14-libressl.patch b/app-text/mupdf/files/mupdf-1.14-libressl.patch
30 new file mode 100644
31 index 00000000000..fcc0a7205c1
32 --- /dev/null
33 +++ b/app-text/mupdf/files/mupdf-1.14-libressl.patch
34 @@ -0,0 +1,45 @@
35 +From 8561b744ac95ab6145a1163fa1d7c490a3329465 Mon Sep 17 00:00:00 2001
36 +From: William <wonko@×××××××××.re>
37 +Date: Mon, 12 Nov 2018 16:50:07 +0100
38 +Subject: [PATCH] hardcode missing ssl functions
39 +
40 +---
41 + source/helpers/pkcs7/pkcs7-openssl.c | 22 ++++++++++++++++++++++
42 + 1 file changed, 22 insertions(+)
43 +
44 +diff --git a/source/helpers/pkcs7/pkcs7-openssl.c b/source/helpers/pkcs7/pkcs7-openssl.c
45 +index 58dbf65..2b1f9e9 100644
46 +--- a/source/helpers/pkcs7/pkcs7-openssl.c
47 ++++ b/source/helpers/pkcs7/pkcs7-openssl.c
48 +@@ -511,6 +511,28 @@ static void signer_drop_designated_name(pdf_pkcs7_signer *signer, pdf_pkcs7_desi
49 + fz_free(osigner->ctx, dn);
50 + }
51 +
52 ++int
53 ++PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag)
54 ++{
55 ++ return OBJ_obj2nid(bag->type);
56 ++}
57 ++
58 ++const STACK_OF(PKCS12_SAFEBAG) *
59 ++PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag)
60 ++{
61 ++ if (OBJ_obj2nid(bag->type) != NID_safeContentsBag)
62 ++ return NULL;
63 ++ return bag->value.safes;
64 ++}
65 ++
66 ++const PKCS8_PRIV_KEY_INFO *
67 ++PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag)
68 ++{
69 ++ if (PKCS12_SAFEBAG_get_nid(bag) != NID_keyBag)
70 ++ return NULL;
71 ++ return bag->value.keybag;
72 ++}
73 ++
74 + static void add_from_bags(X509 **pX509, EVP_PKEY **pPkey, const STACK_OF(PKCS12_SAFEBAG) *bags, const char *pw);
75 +
76 + static void add_from_bag(X509 **pX509, EVP_PKEY **pPkey, PKCS12_SAFEBAG *bag, const char *pw)
77 +--
78 +2.19.1
79 +
80
81 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
82 new file mode 100644
83 index 00000000000..79efe32c0e4
84 --- /dev/null
85 +++ b/app-text/mupdf/files/mupdf-1.14-r3-openssl-curl-x11.patch
86 @@ -0,0 +1,35 @@
87 +diff --git a/Makerules b/Makerules
88 +index fc9bf998..f1fd93cb 100644
89 +--- a/Makerules
90 ++++ b/Makerules
91 +@@ -113,10 +113,11 @@ else ifeq ($(OS),Linux)
92 + SYS_ZLIB_LIBS := $(shell pkg-config --libs zlib)
93 + endif
94 +
95 +- HAVE_CURL := $(shell pkg-config --exists libcurl && echo yes)
96 ++ HAVE_CURL ?= not-unless-portage-tells-me
97 + ifeq ($(HAVE_CURL),yes)
98 + SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
99 +- SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
100 ++ # We have to forcibly add -lpthread to avoid linking errors.
101 ++ SYS_CURL_LIBS := $(shell pkg-config --libs libcurl) -lpthread
102 + endif
103 +
104 + HAVE_GLUT := yes
105 +@@ -125,13 +126,14 @@ else ifeq ($(OS),Linux)
106 + SYS_GLUT_LIBS := -lglut -lGL
107 + endif
108 +
109 +- HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
110 ++ HAVE_X11 ?= not-unless-portage-tells-me
111 + ifeq ($(HAVE_X11),yes)
112 + X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
113 + X11_LIBS := $(shell pkg-config --libs x11 xext)
114 + endif
115 +
116 +- HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
117 ++
118 ++ HAVE_LIBCRYPTO ?= not-unless-portage-tells-me
119 + ifeq ($(HAVE_LIBCRYPTO),yes)
120 + LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
121 + LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
122
123 diff --git a/app-text/mupdf/mupdf-1.14.0-r3.ebuild b/app-text/mupdf/mupdf-1.14.0-r3.ebuild
124 new file mode 100644
125 index 00000000000..1b153620923
126 --- /dev/null
127 +++ b/app-text/mupdf/mupdf-1.14.0-r3.ebuild
128 @@ -0,0 +1,132 @@
129 +# Copyright 1999-2019 Gentoo Authors
130 +# Distributed under the terms of the GNU General Public License v2
131 +
132 +EAPI=6
133 +
134 +inherit flag-o-matic toolchain-funcs xdg
135 +
136 +DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
137 +HOMEPAGE="https://mupdf.com/"
138 +SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz"
139 +
140 +LICENSE="AGPL-3"
141 +SLOT="0/${PV}"
142 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
143 +IUSE="X curl +javascript libressl opengl openssl static-libs +vanilla"
144 +
145 +RDEPEND="
146 + >=dev-lang/mujs-1.0.4
147 + media-libs/freetype:2=[static-libs?]
148 + media-libs/harfbuzz:=[static-libs?,truetype]
149 + media-libs/jbig2dec:=[static-libs?]
150 + media-libs/libpng:0=[static-libs?]
151 + >=media-libs/openjpeg-2.1:2=[static-libs?]
152 + virtual/jpeg[static-libs?]
153 + curl? ( net-misc/curl[static-libs?] )
154 + libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] )
155 + opengl? ( >=media-libs/freeglut-3.0.0:= )
156 + openssl? ( >=dev-libs/openssl-1.1:0=[static-libs?] )
157 + X? (
158 + x11-libs/libX11[static-libs?]
159 + x11-libs/libXext[static-libs?]
160 + )"
161 +DEPEND="${RDEPEND}
162 + virtual/pkgconfig"
163 +
164 +REQUIRED_USE="
165 + libressl? ( !openssl )
166 + opengl? ( !static-libs )
167 + curl? ( X )"
168 +
169 +S=${WORKDIR}/${P}-source
170 +
171 +PATCHES=(
172 + "${FILESDIR}"/${PN}-1.14-CFLAGS.patch
173 + "${FILESDIR}"/${PN}-1.14-Makefile.patch
174 + "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
175 + # See bugs #662352
176 + "${FILESDIR}"/${PN}-1.14-r3-openssl-curl-x11.patch
177 + # bug #672998
178 + "${FILESDIR}"/${PN}-1.14-fix-big-endian.patch
179 +)
180 +
181 +src_prepare() {
182 + xdg_src_prepare
183 + use hppa && append-cflags -ffunction-sections
184 +
185 + use javascript || \
186 + sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
187 + -i include/mupdf/fitz/config.h
188 +
189 + use vanilla || eapply \
190 + "${FILESDIR}"/${PN}-1.3-zoom-2.patch
191 +
192 + # See bug #670832
193 + use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch
194 +
195 + sed -e "1iOS = Linux" \
196 + -e "1iCC = $(tc-getCC)" \
197 + -e "1iLD = $(tc-getLD)" \
198 + -e "1iAR = $(tc-getAR)" \
199 + -e "1iverbose = yes" \
200 + -e "1ibuild = debug" \
201 + -e "1iprefix = ${ED}usr" \
202 + -e "1ilibdir = ${ED}usr/$(get_libdir)" \
203 + -e "1idocdir = ${ED}usr/share/doc/${PF}" \
204 + -i Makerules || die
205 +}
206 +
207 +_emake() {
208 + # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
209 + local have_libcrypto=no
210 + if use openssl || use libressl ; then
211 + have_libcrypto=yes
212 + fi
213 + emake \
214 + GENTOO_PV=${PV} \
215 + HAVE_GLUT=$(usex opengl) \
216 + HAVE_CURL=$(usex curl) \
217 + HAVE_LIBCRYPTO=$have_libcrypto \
218 + HAVE_X11=$(usex X) \
219 + USE_SYSTEM_LIBS=yes \
220 + USE_SYSTEM_MUJS=yes \
221 + HAVE_OBJCOPY=no \
222 + "$@"
223 +}
224 +
225 +src_compile() {
226 + _emake XCFLAGS="-fpic"
227 +
228 + use curl && _emake extra-apps
229 +
230 + use static-libs && \
231 + _emake build/debug/lib${PN}.a
232 +}
233 +
234 +src_install() {
235 + if use X || use opengl ; then
236 + domenu platform/debian/${PN}.desktop
237 + doicon platform/debian/${PN}.xpm
238 + else
239 + rm docs/man/${PN}.1
240 + fi
241 +
242 + _emake install
243 +
244 + dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so
245 +
246 + use static-libs && \
247 + dolib.a build/debug/lib${PN}.a
248 + if use opengl ; then
249 + einfo "mupdf symlink points to mupdf-gl (bug 616654)"
250 + dosym ${PN}-gl /usr/bin/${PN}
251 + elif use X ; then
252 + einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
253 + dosym ${PN}-x11 /usr/bin/${PN}
254 + fi
255 + use curl && dobin build/debug/${PN}-x11-curl
256 + insinto /usr/$(get_libdir)/pkgconfig
257 + doins platform/debian/${PN}.pc
258 +
259 + dodoc README CHANGES CONTRIBUTORS
260 +}