1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic toolchain-funcs xdg desktop
8 DESCRIPTION="a lightweight PDF viewer and toolkit written in portable C"
9 HOMEPAGE="https://mupdf.com/"
10 SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz"
14 KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ppc ppc64 s390 x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
15 IUSE="X +javascript libressl opengl ssl static-libs"
17 # Although we use the bundled, patched version of freeglut in mupdf (because of
18 # bug #653298), the best way to ensure that its dependencies are present is to
19 # install system's freeglut.
21 media-libs/freetype:2=[static-libs?]
22 media-libs/harfbuzz:=[static-libs?,truetype]
23 media-libs/jbig2dec:=[static-libs?]
24 media-libs/libpng:0=[static-libs?]
25 >=media-libs/openjpeg-2.1:2=[static-libs?]
26 virtual/jpeg[static-libs?]
27 opengl? ( >=media-libs/freeglut-3.0.0:= )
29 libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] )
30 !libressl? ( >=dev-libs/openssl-1.1:0=[static-libs?] )
33 x11-libs/libX11[static-libs?]
34 x11-libs/libXext[static-libs?]
39 REQUIRED_USE="opengl? ( !static-libs )"
41 S=${WORKDIR}/${P}-source
44 "${FILESDIR}"/${PN}-1.15-CFLAGS.patch
45 "${FILESDIR}"/${PN}-1.15-Makefile.patch
46 "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
48 "${FILESDIR}"/${PN}-1.15-openssl-x11.patch
49 "${FILESDIR}"/${PN}-1.16.1-freeglut-fg_gl2-gcc-10.patch
54 use hppa && append-cflags -ffunction-sections
57 sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \
58 -i include/mupdf/fitz/config.h
61 use ssl && use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch
63 sed -e "1iOS = Linux" \
64 -e "1iCC = $(tc-getCC)" \
65 -e "1iLD = $(tc-getLD)" \
66 -e "1iAR = $(tc-getAR)" \
67 -e "1iverbose = yes" \
68 -e "1ibuild = debug" \
69 -e "1iprefix = ${ED}/usr" \
70 -e "1ilibdir = ${ED}/usr/$(get_libdir)" \
71 -e "1idocdir = ${ED}/usr/share/doc/${PF}" \
76 # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
78 # We don't use system's freeglut because upstream has a special modified
79 # version of it that gives mupdf clipboard support. See bug #653298
81 # As of v1.15.0, mupdf started using symbols in mujs that were not part
82 # of any release. We thus go back to using the bundled version of it.
86 HAVE_GLUT=$(usex opengl) \
87 HAVE_LIBCRYPTO=$(usex ssl) \
97 _emake XCFLAGS="-fpic"
100 _emake build/debug/lib${PN}.a
104 if use X || use opengl ; then
105 domenu platform/debian/${PN}.desktop
106 doicon platform/debian/${PN}.xpm
113 dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so
116 dolib.a build/debug/lib${PN}.a
118 einfo "mupdf symlink points to mupdf-gl (bug 616654)"
119 dosym ${PN}-gl /usr/bin/${PN}
121 einfo "mupdf symlink points to mupdf-x11 (bug 616654)"
122 dosym ${PN}-x11 /usr/bin/${PN}
124 insinto /usr/$(get_libdir)/pkgconfig
125 doins platform/debian/${PN}.pc
127 dodoc README CHANGES CONTRIBUTORS