]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - app-text/ghostscript-gpl/ghostscript-gpl-9.21-r1.ebuild
app-text/ghostscript-gpl: re-add Imagewriter driver
[CDN/portage-cdn.git] / app-text / ghostscript-gpl / ghostscript-gpl-9.21-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit autotools multilib versionator flag-o-matic toolchain-funcs
7
8 DESCRIPTION="Ghostscript is an interpreter for the PostScript language and for PDF"
9 HOMEPAGE="http://ghostscript.com/"
10
11 MY_P=${P/-gpl}
12 PVM=$(get_version_component_range 1-2)
13 PVM_S=$(replace_all_version_separators "" ${PVM})
14
15 MY_PATCHSET=1
16
17 SRC_URI="
18         https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${PVM_S}/${MY_P}.tar.xz
19         https://dev.gentoo.org/~dilfridge/distfiles/${P}-patchset-${MY_PATCHSET}.tar.xz
20 "
21
22 LICENSE="AGPL-3 CPL-1.0"
23 SLOT="0"
24 KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
25 IUSE="cups dbus gtk l10n_de static-libs tiff unicode X"
26
27 COMMON_DEPEND="
28         app-text/libpaper
29         media-libs/fontconfig
30         >=media-libs/freetype-2.4.9:2=
31         media-libs/jbig2dec
32         >=media-libs/lcms-2.6:2
33         >=media-libs/libpng-1.6.2:0=
34         >=media-libs/openjpeg-2.1.0:2=
35         >=sys-libs/zlib-1.2.7:=
36         virtual/jpeg:0
37         cups? ( >=net-print/cups-1.3.8 )
38         dbus? ( sys-apps/dbus )
39         gtk? ( || ( x11-libs/gtk+:3 x11-libs/gtk+:2 ) )
40         unicode? ( net-dns/libidn )
41         tiff? ( >=media-libs/tiff-4.0.1:0= )
42         X? ( x11-libs/libXt x11-libs/libXext )
43 "
44
45 DEPEND="${COMMON_DEPEND}
46         virtual/pkgconfig
47 "
48
49 RDEPEND="${COMMON_DEPEND}
50         >=app-text/poppler-data-0.4.5-r1
51         >=media-fonts/urw-fonts-2.4.9
52         l10n_ja? ( media-fonts/kochi-substitute )
53         l10n_ko? ( media-fonts/baekmuk-fonts )
54         l10n_zh-CN? ( media-fonts/arphicfonts )
55         l10n_zh-TW? ( media-fonts/arphicfonts )
56         !!media-fonts/gnu-gs-fonts-std
57         !!media-fonts/gnu-gs-fonts-other
58         !<net-print/cups-filters-1.0.36-r2
59 "
60
61 S="${WORKDIR}/${MY_P}"
62
63 LANGS="ja ko zh-CN zh-TW"
64 for X in ${LANGS} ; do
65         IUSE="${IUSE} l10n_${X}"
66 done
67
68 src_prepare() {
69         default
70
71         # remove internal copies of various libraries
72         rm -rf "${S}"/cups/libs || die
73         rm -rf "${S}"/expat || die
74         rm -rf "${S}"/freetype || die
75         rm -rf "${S}"/jbig2dec || die
76         rm -rf "${S}"/jpeg{,xr} || die
77         rm -rf "${S}"/lcms{,2} || die
78         rm -rf "${S}"/libpng || die
79         rm -rf "${S}"/tiff || die
80         rm -rf "${S}"/zlib || die
81         rm -rf "${S}"/openjpeg || die
82         # remove internal CMaps (CMaps from poppler-data are used instead)
83         rm -rf "${S}"/Resource/CMap || die
84
85         # apply various patches, many borrowed from Fedora
86         # http://pkgs.fedoraproject.org/cgit/ghostscript.git
87         eapply "${WORKDIR}/patches/"*.patch
88         eapply "${FILESDIR}/imagewriter-gs.patch"
89
90         if ! use gtk ; then
91                 sed -i -e "s:\$(GSSOX)::" \
92                         -e "s:.*\$(GSSOX_XENAME)$::" \
93                         "${S}"/base/unix-dll.mak || die "sed failed"
94         fi
95
96         # Force the include dirs to a neutral location.
97         sed -i \
98                 -e "/^ZLIBDIR=/s:=.*:=${T}:" \
99                 configure.ac || die
100         # Some files depend on zlib.h directly.  Redirect them. #573248
101         # Also make sure to not define OPJ_STATIC to avoid linker errors due to
102         # hidden symbols (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203327#c1)
103         sed -i \
104                 -e '/^zlib_h/s:=.*:=:' \
105                 -e 's|-DOPJ_STATIC ||' \
106                 base/lib.mak || die
107
108         # search path fix
109         # put LDFLAGS after BINDIR, bug #383447
110         sed -i -e "s:\$\(gsdatadir\)/lib:@datarootdir@/ghostscript/${PVM}/$(get_libdir):" \
111                 -e "s:exdir=.*:exdir=@datarootdir@/doc/${PF}/examples:" \
112                 -e "s:docdir=.*:docdir=@datarootdir@/doc/${PF}/html:" \
113                 -e "s:GS_DOCDIR=.*:GS_DOCDIR=@datarootdir@/doc/${PF}/html:" \
114                 -e 's:-L$(BINDIR):& $(LDFLAGS):g' \
115                 "${S}"/Makefile.in "${S}"/base/*.mak || die "sed failed"
116
117         cd "${S}" || die
118         # remove incorrect symlink, bug 590384
119         rm -f ijs/ltmain.sh || die
120         eautoreconf
121
122         cd "${S}/ijs" || die
123         eautoreconf
124 }
125
126 src_configure() {
127         local FONTPATH
128         for path in \
129                 "${EPREFIX}"/usr/share/fonts/urw-fonts \
130                 "${EPREFIX}"/usr/share/fonts/Type1 \
131                 "${EPREFIX}"/usr/share/fonts \
132                 "${EPREFIX}"/usr/share/poppler/cMap/Adobe-CNS1 \
133                 "${EPREFIX}"/usr/share/poppler/cMap/Adobe-GB1 \
134                 "${EPREFIX}"/usr/share/poppler/cMap/Adobe-Japan1 \
135                 "${EPREFIX}"/usr/share/poppler/cMap/Adobe-Japan2 \
136                 "${EPREFIX}"/usr/share/poppler/cMap/Adobe-Korea1
137         do
138                 FONTPATH="$FONTPATH${FONTPATH:+:}${EPREFIX}$path"
139         done
140
141         PKGCONFIG=$(type -P $(tc-getPKG_CONFIG)) \
142         econf \
143                 --enable-dynamic \
144                 --enable-freetype \
145                 --enable-fontconfig \
146                 --enable-openjpeg \
147                 --disable-compile-inits \
148                 --with-drivers=ALL \
149                 --with-fontpath="$FONTPATH" \
150                 --with-ijs \
151                 --with-jbig2dec \
152                 --with-libpaper \
153                 --without-luratech \
154                 $(use_enable cups) \
155                 $(use_enable dbus) \
156                 $(use_enable gtk) \
157                 $(use_with cups pdftoraster) \
158                 $(use_with unicode libidn) \
159                 $(use_with tiff system-libtiff) \
160                 $(use_with X x)
161
162         cd "${S}/ijs" || die
163         econf \
164                 --enable-shared \
165                 $(use_enable static-libs static)
166 }
167
168 src_compile() {
169         emake so all
170
171         cd "${S}/ijs" || die
172         emake
173 }
174
175 src_install() {
176         emake DESTDIR="${D}" install-so install
177
178         # move gsc to gs, bug #343447
179         # gsc collides with gambit, bug #253064
180         mv -f "${ED}"/usr/bin/{gsc,gs} || die
181
182         cd "${S}/ijs" || die
183         emake DESTDIR="${D}" install
184
185         # rename the original cidfmap to cidfmap.GS
186         mv "${ED}/usr/share/ghostscript/${PVM}/Resource/Init/cidfmap"{,.GS} || die
187
188         # install our own cidfmap to handle CJK fonts
189         insinto /usr/share/ghostscript/${PVM}/Resource/Init
190         doins \
191                 "${WORKDIR}/fontmaps/CIDFnmap" \
192                 "${WORKDIR}/fontmaps/cidfmap"
193         for X in ${LANGS} ; do
194                 if use l10n_${X} ; then
195                         doins "${WORKDIR}/fontmaps/cidfmap.${X/-/_}"
196                 fi
197         done
198
199         # install the CMaps from poppler-data properly, bug #409361
200         dosym ../../../poppler/cMaps "/usr/share/ghostscript/${PVM}/Resource/CMap"
201
202         use static-libs || find "${ED}" -name '*.la' -delete
203
204         if ! use l10n_de; then
205                 rm -r "${ED}"/usr/share/man/de || die
206         fi
207 }