Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2019 Gentoo Authors |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
4 |
EAPI=7 |
5 |
|
6 |
inherit flag-o-matic toolchain-funcs xdg desktop |
7 |
|
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" |
11 |
|
12 |
LICENSE="AGPL-3" |
13 |
SLOT="0/${PV}" |
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 vanilla" |
16 |
|
17 |
# mujs version with js_repr() and js_tryrepr() functions required which were added in: |
18 |
# https://github.com/ccxvii/mujs/commit/603977ae5bad97d544725cd6c36f9af30e6aef4e |
19 |
RDEPEND=" |
20 |
>=dev-lang/mujs-1.0.6_pre20190322130020:= |
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 |
ssl? ( |
28 |
libressl? ( >=dev-libs/libressl-2.8:0=[static-libs?] ) |
29 |
!libressl? ( >=dev-libs/openssl-1.1:0=[static-libs?] ) |
30 |
) |
31 |
X? ( |
32 |
x11-libs/libX11[static-libs?] |
33 |
x11-libs/libXext[static-libs?] |
34 |
)" |
35 |
DEPEND="${RDEPEND} |
36 |
virtual/pkgconfig" |
37 |
|
38 |
REQUIRED_USE="opengl? ( !static-libs )" |
39 |
|
40 |
S=${WORKDIR}/${P}-source |
41 |
|
42 |
PATCHES=( |
43 |
"${FILESDIR}"/${PN}-1.15-CFLAGS.patch |
44 |
"${FILESDIR}"/${PN}-1.15-Makefile.patch |
45 |
"${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch |
46 |
# See bugs #662352 |
47 |
"${FILESDIR}"/${PN}-1.15-openssl-x11.patch |
48 |
) |
49 |
|
50 |
src_prepare() { |
51 |
xdg_src_prepare |
52 |
use hppa && append-cflags -ffunction-sections |
53 |
|
54 |
use javascript || \ |
55 |
sed -e '/* #define FZ_ENABLE_JS/ a\#define FZ_ENABLE_JS 0' \ |
56 |
-i include/mupdf/fitz/config.h |
57 |
|
58 |
use vanilla || eapply \ |
59 |
"${FILESDIR}"/${PN}-1.3-zoom-2.patch |
60 |
|
61 |
# See bug #670832 |
62 |
use ssl && use libressl && eapply "${FILESDIR}"/${PN}-1.14-libressl.patch |
63 |
|
64 |
sed -e "1iOS = Linux" \ |
65 |
-e "1iCC = $(tc-getCC)" \ |
66 |
-e "1iLD = $(tc-getLD)" \ |
67 |
-e "1iAR = $(tc-getAR)" \ |
68 |
-e "1iverbose = yes" \ |
69 |
-e "1ibuild = debug" \ |
70 |
-e "1iprefix = ${ED}/usr" \ |
71 |
-e "1ilibdir = ${ED}/usr/$(get_libdir)" \ |
72 |
-e "1idocdir = ${ED}/usr/share/doc/${PF}" \ |
73 |
-i Makerules || die |
74 |
} |
75 |
|
76 |
_emake() { |
77 |
# When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings. |
78 |
|
79 |
# We don't use system's freeglut because upstream has a special modified |
80 |
# version of it that gives mupdf clipboard support. See bug #653298 |
81 |
emake \ |
82 |
GENTOO_PV=${PV} \ |
83 |
HAVE_GLUT=$(usex opengl) \ |
84 |
HAVE_LIBCRYPTO=$(usex ssl) \ |
85 |
HAVE_X11=$(usex X) \ |
86 |
USE_SYSTEM_LIBS=yes \ |
87 |
USE_SYSTEM_MUJS=yes \ |
88 |
USE_SYSTEM_GLUT=no \ |
89 |
HAVE_OBJCOPY=no \ |
90 |
"$@" |
91 |
} |
92 |
|
93 |
src_compile() { |
94 |
_emake XCFLAGS="-fpic" |
95 |
|
96 |
use static-libs && \ |
97 |
_emake build/debug/lib${PN}.a |
98 |
} |
99 |
|
100 |
src_install() { |
101 |
if use X || use opengl ; then |
102 |
domenu platform/debian/${PN}.desktop |
103 |
doicon platform/debian/${PN}.xpm |
104 |
else |
105 |
rm docs/man/${PN}.1 |
106 |
fi |
107 |
|
108 |
_emake install |
109 |
|
110 |
dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so |
111 |
|
112 |
use static-libs && \ |
113 |
dolib.a build/debug/lib${PN}.a |
114 |
if use opengl ; then |
115 |
einfo "mupdf symlink points to mupdf-gl (bug 616654)" |
116 |
dosym ${PN}-gl /usr/bin/${PN} |
117 |
elif use X ; then |
118 |
einfo "mupdf symlink points to mupdf-x11 (bug 616654)" |
119 |
dosym ${PN}-x11 /usr/bin/${PN} |
120 |
fi |
121 |
insinto /usr/$(get_libdir)/pkgconfig |
122 |
doins platform/debian/${PN}.pc |
123 |
|
124 |
dodoc README CHANGES CONTRIBUTORS |
125 |
} |