Gentoo Archives: gentoo-commits

From: Michael Weber <xmw@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/mupdf/
Date: Thu, 22 Jun 2017 23:18:56
Message-Id: 1498173523.49e8f195b53830a62dad0c3632798b0357a4c376.xmw@gentoo
1 commit: 49e8f195b53830a62dad0c3632798b0357a4c376
2 Author: Michael Weber <xmw <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 22 23:18:18 2017 +0000
4 Commit: Michael Weber <xmw <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 22 23:18:43 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49e8f195
7
8 app-text/mupdf: allow USE=-X,opengl and cleanup .desktop and symlink mess.
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.2
11
12 app-text/mupdf/mupdf-1.11-r2.ebuild | 151 ++++++++++++++++++++++++++++++++++++
13 1 file changed, 151 insertions(+)
14
15 diff --git a/app-text/mupdf/mupdf-1.11-r2.ebuild b/app-text/mupdf/mupdf-1.11-r2.ebuild
16 new file mode 100644
17 index 00000000000..e7a4fef0f02
18 --- /dev/null
19 +++ b/app-text/mupdf/mupdf-1.11-r2.ebuild
20 @@ -0,0 +1,151 @@
21 +# Copyright 1999-2017 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=6
25 +
26 +inherit flag-o-matic toolchain-funcs
27 +
28 +DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
29 +HOMEPAGE="http://mupdf.com/"
30 +SRC_URI="http://mupdf.com/downloads/${P}-source.tar.gz"
31 +
32 +LICENSE="AGPL-3"
33 +SLOT="0/${PV}"
34 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
35 +IUSE="X +curl javascript libressl opengl +openssl static static-libs vanilla"
36 +
37 +LIB_DEPEND="
38 + !libressl? ( dev-libs/openssl:0[static-libs?] )
39 + libressl? ( dev-libs/libressl[static-libs?] )
40 + javascript? ( >=dev-lang/mujs-0_p20160504 )
41 + media-libs/freetype:2[static-libs?]
42 + media-libs/harfbuzz[static-libs?]
43 + media-libs/jbig2dec[static-libs?]
44 + media-libs/libpng:0[static-libs?]
45 + >=media-libs/openjpeg-2.1:2[static-libs?]
46 + net-misc/curl[static-libs?]
47 + virtual/jpeg[static-libs?]
48 + X? ( x11-libs/libX11[static-libs?]
49 + x11-libs/libXext[static-libs?] )
50 + opengl? ( >=media-libs/glfw-3.2 )"
51 +RDEPEND="${LIB_DEPEND}"
52 +DEPEND="${RDEPEND}
53 + virtual/pkgconfig
54 + static-libs? ( ${LIB_DEPEND} )
55 + static? ( ${LIB_DEPEND//?}
56 + app-arch/bzip2[static-libs]
57 + x11-libs/libXau[static-libs]
58 + x11-libs/libXdmcp[static-libs]
59 + x11-libs/libxcb[static-libs] )"
60 +
61 +REQUIRED_USE="opengl? ( !static !static-libs )"
62 +
63 +S=${WORKDIR}/${P}-source
64 +
65 +PATCHES=(
66 + "${FILESDIR}"/${PN}-1.11-CFLAGS.patch
67 + "${FILESDIR}"/${PN}-1.9a-debug-build.patch
68 + "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
69 + "${FILESDIR}"/${PN}-1.11-openssl-curl-x11.patch
70 + "${FILESDIR}"/${PN}-1.11-system-glfw.patch
71 + "${FILESDIR}"/${PN}-1.11-CVE-2017-6060.patch
72 +)
73 +
74 +src_prepare() {
75 + default
76 + use hppa && append-cflags -ffunction-sections
77 +
78 + rm -rf thirdparty || die
79 +
80 + if has_version ">=media-libs/openjpeg-2.1:2" ; then
81 + # Remove a switch, which prevents using shared libraries for openjpeg2.
82 + # See http://www.linuxfromscratch.org/blfs/view/cvs/pst/mupdf.html
83 + sed '/OPJ_STATIC$/d' -i source/fitz/load-jpx.c
84 + fi
85 +
86 + use javascript || \
87 + sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
88 + -i include/mupdf/fitz/config.h
89 +
90 + sed -e "/^libdir=/s:/lib:/$(get_libdir):" \
91 + -e "/^prefix=/s:=.*:=${EROOT}/usr:" \
92 + -i platform/debian/${PN}.pc || die
93 +
94 + use vanilla || eapply \
95 + "${FILESDIR}"/${PN}-1.3-zoom-2.patch
96 +
97 + sed -e "1iOS = Linux" \
98 + -e "1iCC = $(tc-getCC)" \
99 + -e "1iLD = $(tc-getCC)" \
100 + -e "1iAR = $(tc-getAR)" \
101 + -e "1iverbose = yes" \
102 + -e "1ibuild = debug" \
103 + -e "1iprefix = ${ED}usr" \
104 + -e "1ilibdir = ${ED}usr/$(get_libdir)" \
105 + -e "1idocdir = ${ED}usr/share/doc/${PF}" \
106 + -e "1iWANT_X11 = $(usex X)" \
107 + -e "1iWANT_OPENSSL = $(usex openssl)" \
108 + -e "1iWANT_CURL = $(usex curl)" \
109 + -e "1iHAVE_MUJS = $(usex javascript)" \
110 + -e "1iMUJS_LIBS = $(usex javascript -lmujs '')" \
111 + -e "1iMUJS_CFLAGS =" \
112 + -e "1iHAVE_GLFW = $(usex opengl yes no)" \
113 + -i Makerules || die
114 +
115 + if use static-libs || use static ; then
116 + cp -a "${S}" "${S}"-static || die
117 + #add missing Libs.private for xcb and freetype
118 + sed -e 's:\(pkg-config --libs\):\1 --static:' \
119 + -e '/^SYS_X11_LIBS = /s:\(.*\):\1 -lpthread:' \
120 + -e '/^SYS_FREETYPE_LIBS = /s:\(.*\):\1 -lbz2:' \
121 + -i "${S}"-static/Makerules || die
122 + fi
123 +
124 + my_soname=libmupdf.so.${PV}
125 + my_soname_js_none=libmupdf-js-none.so.${PV}
126 + sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \
127 + -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \
128 + -e "/^MUPDF_LIB =/s:=.*:= \$(OUT)/${my_soname}:" \
129 + -e "\$a\$(MUPDF_JS_NONE_LIB):" \
130 + -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \
131 + -e "/install/s: COPYING : :" \
132 + -i Makefile || die
133 +}
134 +
135 +src_compile() {
136 + emake XCFLAGS="-fpic"
137 + use static-libs && \
138 + emake -C "${S}"-static build/debug/lib${PN}{,-js-none}.a
139 + use static && \
140 + emake -C "${S}"-static XLIBS="-static"
141 +}
142 +
143 +src_install() {
144 + if use X || use opengl ; then
145 + domenu platform/debian/${PN}.desktop
146 + doicon platform/debian/${PN}.xpm
147 + else
148 + rm docs/man/${PN}.1
149 + fi
150 +
151 + emake install
152 + dosym ${my_soname} /usr/$(get_libdir)/lib${PN}.so
153 +
154 + use static-libs && \
155 + dolib.a "${S}"-static/build/debug/lib${PN}{,-js-none}.a
156 + if use static ; then
157 + dobin "${S}"-static/build/debug/mu{tool,draw}
158 + use X && dobin "${S}"-static/build/debug/${PN}-x11
159 + fi
160 + if use opengl ; then
161 + einfo "mupdf symlink points to mupdf-gl (bug 616654)"
162 + dosym ${PN}-gl /usr/bin/${PN}
163 + elif use X ; then
164 + einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
165 + dosym ${PN}-x11 /usr/bin/${PN}
166 + fi
167 + insinto /usr/$(get_libdir)/pkgconfig
168 + doins platform/debian/${PN}.pc
169 +
170 + dodoc README docs/*.{txt,c}
171 +}