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