1 |
commit: faf6b578bd55a8010c3957e03901cc1dab35a328 |
2 |
Author: Virgil Dupras <vdupras <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 27 19:50:49 2018 +0000 |
4 |
Commit: Virgil Dupras <vdupras <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 27 19:53:30 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=faf6b578 |
7 |
|
8 |
app-text/mupdf: fix compilation with libressl |
9 |
|
10 |
Patch from Jouni Kosonen |
11 |
|
12 |
Closes: https://bugs.gentoo.org/662352 |
13 |
Package-Manager: Portage-2.3.48, Repoman-2.3.10 |
14 |
|
15 |
app-text/mupdf/files/mupdf-1.13-libressl.patch | 23 ++++ |
16 |
app-text/mupdf/mupdf-1.13.0-r1.ebuild | 168 +++++++++++++++++++++++++ |
17 |
2 files changed, 191 insertions(+) |
18 |
|
19 |
diff --git a/app-text/mupdf/files/mupdf-1.13-libressl.patch b/app-text/mupdf/files/mupdf-1.13-libressl.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..396a0e5b5db |
22 |
--- /dev/null |
23 |
+++ b/app-text/mupdf/files/mupdf-1.13-libressl.patch |
24 |
@@ -0,0 +1,23 @@ |
25 |
+diff --git a/Makerules b/Makerules |
26 |
+index f9b25d6..6c91c6c 100644 |
27 |
+--- a/Makerules |
28 |
++++ b/Makerules |
29 |
+@@ -106,11 +106,17 @@ SYS_GLUT_LIBS := -lglut -lGL |
30 |
+ |
31 |
+ WANT_OPENSSL ?= yes |
32 |
+ ifeq "$(WANT_OPENSSL)" "yes" |
33 |
+-ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)" "yes" |
34 |
++ifeq "$(shell pkg-config --exists 'libcrypto >= 2.0.0' && echo libre)" "libre" |
35 |
++ifeq "$(shell pkg-config --exists 'libcrypto >= 2.7.0' && echo yes)" "yes" |
36 |
+ HAVE_LIBCRYPTO := yes |
37 |
+ SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto) |
38 |
+ SYS_LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto) |
39 |
+ endif |
40 |
++else ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)" "yes" |
41 |
++HAVE_LIBCRYPTO := yes |
42 |
++SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto) |
43 |
++SYS_LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto) |
44 |
++endif |
45 |
+ endif |
46 |
+ |
47 |
+ WANT_CURL ?= yes |
48 |
|
49 |
diff --git a/app-text/mupdf/mupdf-1.13.0-r1.ebuild b/app-text/mupdf/mupdf-1.13.0-r1.ebuild |
50 |
new file mode 100644 |
51 |
index 00000000000..3f522e8dc86 |
52 |
--- /dev/null |
53 |
+++ b/app-text/mupdf/mupdf-1.13.0-r1.ebuild |
54 |
@@ -0,0 +1,168 @@ |
55 |
+# Copyright 1999-2018 Gentoo Foundation |
56 |
+# Distributed under the terms of the GNU General Public License v2 |
57 |
+ |
58 |
+EAPI=6 |
59 |
+ |
60 |
+inherit flag-o-matic toolchain-funcs xdg |
61 |
+ |
62 |
+DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C" |
63 |
+HOMEPAGE="https://mupdf.com/" |
64 |
+SRC_URI="https://mupdf.com/downloads/${P}-source.tar.gz" |
65 |
+ |
66 |
+LICENSE="AGPL-3" |
67 |
+SLOT="0/${PV}" |
68 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos" |
69 |
+IUSE="X +curl javascript lcms libressl opengl +openssl static static-libs vanilla" |
70 |
+ |
71 |
+LIB_DEPEND=" |
72 |
+ !libressl? ( dev-libs/openssl:0=[static-libs?] ) |
73 |
+ libressl? ( dev-libs/libressl:0=[static-libs?] ) |
74 |
+ javascript? ( >=dev-lang/mujs-0_p20160504 ) |
75 |
+ media-libs/freetype:2=[static-libs?] |
76 |
+ media-libs/harfbuzz:=[static-libs?] |
77 |
+ media-libs/jbig2dec:=[static-libs?] |
78 |
+ media-libs/libpng:0=[static-libs?] |
79 |
+ >=media-libs/openjpeg-2.1:2=[static-libs?] |
80 |
+ net-misc/curl[static-libs?] |
81 |
+ virtual/jpeg[static-libs?] |
82 |
+ X? ( x11-libs/libX11[static-libs?] |
83 |
+ x11-libs/libXext[static-libs?] ) |
84 |
+ opengl? ( >=media-libs/freeglut-3.0.0:= )" |
85 |
+RDEPEND="${LIB_DEPEND}" |
86 |
+DEPEND="${RDEPEND} |
87 |
+ virtual/pkgconfig |
88 |
+ static-libs? ( ${LIB_DEPEND} ) |
89 |
+ static? ( ${LIB_DEPEND//?} |
90 |
+ app-arch/bzip2[static-libs] |
91 |
+ x11-libs/libXau[static-libs] |
92 |
+ x11-libs/libXdmcp[static-libs] |
93 |
+ x11-libs/libxcb[static-libs] )" |
94 |
+ |
95 |
+REQUIRED_USE="opengl? ( !static !static-libs )" |
96 |
+ |
97 |
+S=${WORKDIR}/${P}-source |
98 |
+ |
99 |
+PATCHES=( |
100 |
+ "${FILESDIR}"/${PN}-1.12-CFLAGS.patch |
101 |
+ "${FILESDIR}"/${PN}-1.9a-debug-build.patch |
102 |
+ "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch |
103 |
+ "${FILESDIR}"/${PN}-1.13-openssl-curl-x11.patch |
104 |
+ "${FILESDIR}"/${PN}-1.11-drop-libmupdfthird.patch |
105 |
+ # See bug #662352 |
106 |
+ "${FILESDIR}"/${PN}-1.13-libressl.patch |
107 |
+) |
108 |
+ |
109 |
+src_prepare() { |
110 |
+ xdg_src_prepare |
111 |
+ use hppa && append-cflags -ffunction-sections |
112 |
+ |
113 |
+ # specialized lcms2, keep it if wanted inside lubmupdfthird |
114 |
+ if ! use lcms ; then |
115 |
+ rm -rf thirdparty/lcms2 |
116 |
+ fi |
117 |
+ |
118 |
+ rm -rf thirdparty/{README,curl,freeglut,freetype,harfbuzz,jbig2dec,libjpeg,mujs,openjpeg,zlib} || die |
119 |
+ for my_third in thirdparty/* ; do |
120 |
+ ewarn "Bundled thirdparty lib: ${my_third}" |
121 |
+ done |
122 |
+ |
123 |
+ if has_version ">=media-libs/openjpeg-2.1:2" ; then |
124 |
+ # Remove a switch, which prevents using shared libraries for openjpeg2. |
125 |
+ # See http://www.linuxfromscratch.org/blfs/view/cvs/pst/mupdf.html |
126 |
+ sed '/OPJ_STATIC$/d' -i source/fitz/load-jpx.c |
127 |
+ fi |
128 |
+ |
129 |
+ use javascript || \ |
130 |
+ sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \ |
131 |
+ -i include/mupdf/fitz/config.h |
132 |
+ |
133 |
+ sed -e "/^libdir=/s:/lib:/$(get_libdir):" \ |
134 |
+ -e "/^prefix=/s:=.*:=${EROOT}/usr:" \ |
135 |
+ -i platform/debian/${PN}.pc || die |
136 |
+ |
137 |
+ use vanilla || eapply \ |
138 |
+ "${FILESDIR}"/${PN}-1.3-zoom-2.patch |
139 |
+ |
140 |
+ sed -e "1iOS = Linux" \ |
141 |
+ -e "1iCC = $(tc-getCC)" \ |
142 |
+ -e "1iLD = $(tc-getCC)" \ |
143 |
+ -e "1iAR = $(tc-getAR)" \ |
144 |
+ -e "1iverbose = yes" \ |
145 |
+ -e "1ibuild = debug" \ |
146 |
+ -e "1iprefix = ${ED}usr" \ |
147 |
+ -e "1ilibdir = ${ED}usr/$(get_libdir)" \ |
148 |
+ -e "1idocdir = ${ED}usr/share/doc/${PF}" \ |
149 |
+ -i Makerules || die |
150 |
+ |
151 |
+ if use static-libs || use static ; then |
152 |
+ cp -a "${S}" "${S}"-static || die |
153 |
+ #add missing Libs.private for xcb and freetype |
154 |
+ sed -e 's:\(pkg-config --libs\):\1 --static:' \ |
155 |
+ -e '/^SYS_X11_LIBS = /s:\(.*\):\1 -lpthread:' \ |
156 |
+ -e '/^SYS_FREETYPE_LIBS = /s:\(.*\):\1 -lbz2:' \ |
157 |
+ -i "${S}"-static/Makerules || die |
158 |
+ fi |
159 |
+ |
160 |
+ my_soname=libmupdf.so.${PV} |
161 |
+ my_soname_js_none=libmupdf-js-none.so.${PV} |
162 |
+ sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \ |
163 |
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \ |
164 |
+ -e "/^MUPDF_LIB =/s:=.*:= \$(OUT)/${my_soname}:" \ |
165 |
+ -e "\$a\$(MUPDF_JS_NONE_LIB):" \ |
166 |
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \ |
167 |
+ -e "/install/s: COPYING : :" \ |
168 |
+ -i Makefile || die |
169 |
+} |
170 |
+ |
171 |
+src_compile() { |
172 |
+ use lcms && emake XCFLAGS="-fpic" third |
173 |
+ emake XCFLAGS="-fpic" \ |
174 |
+ HAVE_GLUT=$(usex opengl yes no) \ |
175 |
+ HAVE_MUJS=$(usex javascript) \ |
176 |
+ MUJS_LIBS=$(usex javascript -lmujs '') \ |
177 |
+ WANT_CURL=$(usex curl) \ |
178 |
+ WANT_OPENSSL=$(usex openssl) \ |
179 |
+ WANT_X11=$(usex X) |
180 |
+ |
181 |
+ use static-libs && \ |
182 |
+ emake -C "${S}"-static build/debug/lib${PN}{,-js-none}.a |
183 |
+ use static && \ |
184 |
+ emake -C "${S}"-static XLIBS="-static" |
185 |
+} |
186 |
+ |
187 |
+src_install() { |
188 |
+ if use X || use opengl ; then |
189 |
+ domenu platform/debian/${PN}.desktop |
190 |
+ doicon platform/debian/${PN}.xpm |
191 |
+ else |
192 |
+ rm docs/man/${PN}.1 |
193 |
+ fi |
194 |
+ |
195 |
+ emake install \ |
196 |
+ HAVE_GLUT=$(usex opengl yes no) \ |
197 |
+ HAVE_MUJS=$(usex javascript) \ |
198 |
+ MUJS_LIBS=$(usex javascript -lmujs '') \ |
199 |
+ WANT_CURL=$(usex curl) \ |
200 |
+ WANT_OPENSSL=$(usex openssl) \ |
201 |
+ WANT_X11=$(usex X) |
202 |
+ |
203 |
+ dosym ${my_soname} /usr/$(get_libdir)/lib${PN}.so |
204 |
+ |
205 |
+ use static-libs && \ |
206 |
+ dolib.a "${S}"-static/build/debug/lib${PN}{,-js-none}.a |
207 |
+ if use static ; then |
208 |
+ dobin "${S}"-static/build/debug/mu{tool,draw} |
209 |
+ use X && dobin "${S}"-static/build/debug/${PN}-x11 |
210 |
+ fi |
211 |
+ if use opengl ; then |
212 |
+ einfo "mupdf symlink points to mupdf-gl (bug 616654)" |
213 |
+ dosym ${PN}-gl /usr/bin/${PN} |
214 |
+ elif use X ; then |
215 |
+ einfo "mupdf symlink points to mupdf-x11 (bug 616654)" |
216 |
+ dosym ${PN}-x11 /usr/bin/${PN} |
217 |
+ fi |
218 |
+ insinto /usr/$(get_libdir)/pkgconfig |
219 |
+ doins platform/debian/${PN}.pc |
220 |
+ |
221 |
+ dodoc README CHANGES CONTRIBUTORS |
222 |
+} |