Use https by default
[gentoo.git] / app-text / texlive-core / texlive-core-2013-r3.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 #TL_UPSTREAM_PATCHLEVEL="1"
8 PATCHLEVEL="49"
9 TL_SOURCE_VERSION=20130530
10
11 inherit eutils flag-o-matic toolchain-funcs libtool texlive-common
12
13 MY_PV=${PN%-core}-${TL_SOURCE_VERSION}-source
14
15 DESCRIPTION="A complete TeX distribution"
16 HOMEPAGE="http://tug.org/texlive/"
17 SLOT="0"
18 LICENSE="GPL-2 LPPL-1.3c TeX"
19
20 SRC_URI="mirror://gentoo/${MY_PV}.tar.xz"
21
22 # Fetch patches
23 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-patches-${PATCHLEVEL}.tar.xz"
24 #       mirror://gentoo/texlive-core-upstream-patches-${TL_UPSTREAM_PATCHLEVEL}.tar.xz"
25
26 TL_CORE_BINEXTRA_MODULES="
27         a2ping adhocfilelist asymptote bundledoc ctanify ctanupload ctie cweb
28         de-macro dtl dtxgen dvi2tty dviasm dvicopy dvidvi dviljk dvipos findhyph
29         fragmaster hyphenex installfont lacheck latex2man latexfileversion
30         latexpand ltxfileinfo listings-ext match_parens mkjobtexmf patgen pdfcrop
31         pdftools pfarrei pkfix pkfix-helper purifyeps seetexk sty2dtx synctex
32         texcount texdef texdiff texdirflatten texdoc texliveonfly texloganalyser
33         texware tie tpic2pdftex typeoutfileinfo web     collection-binextra
34         "
35 TL_CORE_BINEXTRA_DOC_MODULES="
36         a2ping.doc adhocfilelist.doc asymptote.doc bundledoc.doc ctanify.doc
37         ctanupload.doc ctie.doc cweb.doc de-macro.doc dtxgen.doc dvi2tty.doc
38         dvicopy.doc     dviljk.doc dvipos.doc findhyph.doc fragmaster.doc
39         installfont.doc latex2man.doc latexfileversion.doc latexpand.doc
40         ltxfileinfo.doc listings-ext.doc match_parens.doc mkjobtexmf.doc patgen.doc
41         pdfcrop.doc pdftools.doc pfarrei.doc pkfix.doc pkfix-helper.doc
42         purifyeps.doc sty2dtx.doc synctex.doc texcount.doc texdef.doc texdiff.doc
43         texdirflatten.doc texdoc.doc texliveonfly.doc texloganalyser.doc texware.doc
44         tie.doc tpic2pdftex.doc typeoutfileinfo web.doc
45         "
46 TL_CORE_BINEXTRA_SRC_MODULES="
47         adhocfilelist.source hyphenex.source listings-ext.source mkjobtexmf.source
48         pfarrei.source texdef.source
49         "
50
51 TL_CORE_EXTRA_MODULES="tetex hyphen-base texconfig gsftopk texlive.infra ${TL_CORE_BINEXTRA_MODULES}"
52 TL_CORE_EXTRA_DOC_MODULES="tetex.doc texconfig.doc gsftopk.doc texlive.infra.doc ${TL_CORE_BINEXTRA_DOC_MODULES}"
53 TL_CORE_EXTRA_SRC_MODULES="${TL_CORE_BINEXTRA_SRC_MODULES}"
54
55 for i in ${TL_CORE_EXTRA_MODULES}; do
56         SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.xz"
57 done
58
59 SRC_URI="${SRC_URI} doc? ( "
60 for i in ${TL_CORE_EXTRA_DOC_MODULES}; do
61         SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.xz"
62 done
63 SRC_URI="${SRC_URI} )"
64 SRC_URI="${SRC_URI} source? ( "
65 for i in ${TL_CORE_EXTRA_SRC_MODULES}; do
66         SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.xz"
67 done
68 SRC_URI="${SRC_URI} )"
69
70 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
71 IUSE="cjk X doc source tk xetex"
72
73 TEXMF_PATH=/usr/share/texmf-dist
74
75 MODULAR_X_DEPEND="X? (
76                                 x11-libs/libXmu
77                                 x11-libs/libXp
78                                 x11-libs/libXpm
79                                 x11-libs/libICE
80                                 x11-libs/libSM
81                                 x11-libs/libXaw
82                                 x11-libs/libXfont
83         )"
84
85 COMMON_DEPEND="${MODULAR_X_DEPEND}
86         !app-text/ptex
87         !app-text/tetex
88         !<app-text/texlive-2007
89         !app-text/xetex
90         !<dev-texlive/texlive-basic-2013
91         !<dev-texlive/texlive-metapost-2011
92         !app-text/dvibook
93         sys-libs/zlib
94         >=media-libs/libpng-1.2.43-r2:0=
95         >=app-text/poppler-0.12.3-r3:=
96         >=x11-libs/cairo-1.12
97         >=x11-libs/pixman-0.18
98         xetex? (
99                 >=media-libs/harfbuzz-0.9.20[icu,graphite]
100                 >=dev-libs/icu-50:=
101                 app-text/teckit
102                 media-libs/fontconfig
103                 media-gfx/graphite2
104                 media-libs/freetype:2
105         )
106         >=dev-libs/kpathsea-6.1.1_p20130530
107         cjk? ( >=dev-libs/ptexenc-1.3.1_p20130530 )"
108
109 DEPEND="${COMMON_DEPEND}
110         virtual/pkgconfig
111         sys-apps/ed
112         sys-devel/flex
113         app-arch/xz-utils"
114
115 RDEPEND="${COMMON_DEPEND}
116         >=app-text/ps2pkm-1.5_p20130530
117         >=app-text/dvipsk-5.993_p20130530
118         >=dev-tex/bibtexu-3.71_p20130530
119         virtual/perl-Getopt-Long
120         xetex? ( >=app-text/xdvipdfmx-0.7.9_p20130530 )
121         tk? ( dev-perl/perl-tk )"
122
123 # texdoc needs luatex.
124 PDEPEND=">=dev-tex/luatex-0.76"
125
126 S="${WORKDIR}/${P}_build"
127 B="${WORKDIR}/${MY_PV}"
128
129 src_unpack() {
130         unpack ${A}
131         mkdir -p "${S}" || die "failed to create build dir"
132 }
133
134 RELOC_TARGET=texmf-dist
135
136 src_prepare() {
137         cd "${WORKDIR}"
138         # From texlive-module.eclass.
139         grep -H RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist"
140         { for i in $(<"${T}/reloclist"); do  dirname $i; done; } | uniq > "${T}/dirlist"
141         for i in $(<"${T}/dirlist"); do
142                 [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}"
143         done
144         for i in $(<"${T}/reloclist"); do
145                 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
146         done
147
148         mv "${WORKDIR}"/texmf* "${B}" || die "failed to move texmf files"
149
150         cd "${B}"
151         #EPATCH_MULTI_MSG="Applying patches from upstream bugfix branch..." EPATCH_SUFFIX="patch" epatch "${WORKDIR}/gentoo_branch2011_patches"
152         EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
153
154         elibtoolize
155 }
156
157 src_configure() {
158         # It fails on alpha without this
159         use alpha && append-ldflags "-Wl,--no-relax"
160
161         # Too many regexps use A-Z a-z constructs, what causes problems with locales
162         # that don't have the same alphabetical order than ascii. Bug #242430
163         # So we set LC_ALL to C in order to avoid problems.
164         export LC_ALL=C
165         tc-export CC CXX AR RANLIB
166         ECONF_SOURCE="${B}" \
167                 econf -C \
168                 --bindir="${EPREFIX}"/usr/bin \
169                 --datadir="${S}" \
170                 --with-system-freetype2 \
171                 --with-system-zlib \
172                 --with-system-libpng \
173                 --with-system-xpdf \
174                 --with-system-poppler \
175                 --with-system-teckit \
176                 --with-teckit-includes="${EPREFIX}"/usr/include/teckit \
177                 --with-system-kpathsea \
178                 --with-kpathsea-includes="${EPREFIX}"/usr/include \
179                 --with-system-icu \
180                 --with-system-ptexenc \
181                 --with-system-harfbuzz \
182                 --with-system-icu \
183                 --with-system-graphite2 \
184                 --with-system-cairo \
185                 --with-system-pixman \
186                 --without-texinfo \
187                 --disable-dialog \
188                 --disable-multiplatform \
189                 --enable-epsfwin \
190                 --enable-mftalkwin \
191                 --enable-regiswin \
192                 --enable-tektronixwin \
193                 --enable-unitermwin \
194                 --with-ps=gs \
195                 --disable-psutils \
196                 --disable-t1utils \
197                 --enable-ipc \
198                 --disable-biber \
199                 --disable-bibtex-x \
200                 --disable-dvipng \
201                 --disable-dvipsk \
202                 --disable-dvipdfmx \
203                 --disable-chktex \
204                 --disable-lcdf-typetools \
205                 --disable-pdfopen \
206                 --disable-ps2eps \
207                 --disable-ps2pkm \
208                 --disable-detex \
209                 --disable-ttf2pk \
210                 --disable-tex4htk \
211                 --disable-cjkutils \
212                 --disable-xdvik \
213                 --disable-xindy \
214                 --disable-luatex \
215                 --disable-dvi2tty \
216                 --disable-dvisvgm \
217                 --disable-vlna \
218                 --disable-xdvipdfmx \
219                 --enable-shared \
220                 --disable-native-texlive-build \
221                 --disable-largefile \
222                 $(use_enable xetex) \
223                 $(use_enable cjk ptex) \
224                 $(use_enable cjk eptex) \
225                 $(use_enable cjk uptex) \
226                 $(use_enable cjk euptex) \
227                 $(use_enable cjk mendexk) \
228                 $(use_enable cjk makejvf) \
229                 $(use_enable tk texdoctk) \
230                 $(use_with X x)
231 }
232
233 src_compile() {
234         tc-export CC CXX AR RANLIB
235         emake SHELL="${EPREFIX}"/bin/sh texmf="${EPREFIX}"${TEXMF_PATH:-/usr/share/texmf-dist} || die "emake failed"
236
237         cd "${B}"
238         # Mimic updmap --syncwithtrees to enable only fonts installed
239         # Code copied from updmap script
240         for i in `egrep '^(Mixed|Kanji)?Map' "texmf-dist/web2c/updmap.cfg" | sed 's@.* @@'`; do
241                 texlive-common_is_file_present_in_texmf "$i" || echo "$i"
242         done > "${T}/updmap_update"
243         {
244                 sed 's@/@\\/@g; s@^@/^MixedMap[     ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
245                 sed 's@/@\\/@g; s@^@/^Map[  ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
246                 sed 's@/@\\/@g; s@^@/^KanjiMap[     ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
247         } > "${T}/updmap_update2"
248         sed -f "${T}/updmap_update2" "texmf-dist/web2c/updmap.cfg" >    "${T}/updmap_update3"\
249                 && cat "${T}/updmap_update3" > "texmf-dist/web2c/updmap.cfg"
250 }
251
252 src_install() {
253         dodir ${TEXMF_PATH:-/usr/share/texmf-dist}/web2c
254         emake DESTDIR="${D}" texmf="${ED}${TEXMF_PATH:-/usr/share/texmf-dist}" run_texlinks="true" run_mktexlsr="true" install || die "install failed"
255
256         cd "${B}"
257         dodir /usr/share # just in case
258         cp -pR texmf-dist "${ED}/usr/share/" || die "failed to install texmf trees"
259         cp -pR "${WORKDIR}"/tlpkg "${ED}/usr/share/" || die "failed to install tlpkg files"
260
261         # When X is disabled mf-nowin doesn't exist but some scripts expect it to
262         # exist. Instead, it is called mf, so we symlink it to please everything.
263         use X || dosym mf /usr/bin/mf-nowin
264
265         docinto texk
266         cd "${B}/texk"
267         dodoc ChangeLog README || die "failed to install texk docs"
268
269         docinto dviljk
270         cd "${B}/texk/dviljk"
271         dodoc ChangeLog README NEWS || die "failed to install dviljk docs"
272
273         docinto makeindexk
274         cd "${B}/texk/makeindexk"
275         dodoc ChangeLog NOTES README || die "failed to install makeindexk docs"
276
277         docinto web2c
278         cd "${B}/texk/web2c"
279         dodoc ChangeLog NEWS PROJECTS README || die "failed to install web2c docs"
280
281         use doc || rm -rf "${ED}/usr/share/texmf-dist/doc"
282
283         dodir /etc/env.d
284         echo 'CONFIG_PROTECT_MASK="/etc/texmf/web2c /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d"' > "${ED}/etc/env.d/98texlive"
285         # populate /etc/texmf
286         keepdir /etc/texmf/web2c
287
288         # take care of updmap.cfg and language.d files
289         keepdir /etc/texmf/{updmap.d,language.dat.d,language.def.d,language.dat.lua.d}
290
291         mv "${ED}${TEXMF_PATH}/web2c/updmap.cfg" "${ED}/etc/texmf/updmap.d/00updmap.cfg" || die "moving updmap.cfg failed"
292
293         # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d files
294         # by texmf-update
295         rm -f "${ED}${TEXMF_PATH}/web2c/fmtutil.cnf"
296         # Remove bundled and invalid updmap.cfg
297         rm -f "${ED}/usr/share/texmf-dist/web2c/updmap.cfg"
298
299         texlive-common_handle_config_files
300
301         keepdir /usr/share/texmf-site
302
303         # the virtex symlink is not installed
304         # The links has to be relative, since the targets
305         # is not present at this stage and MacOS doesn't
306         # like non-existing targets
307         dosym tex /usr/bin/virtex
308         dosym pdftex /usr/bin/pdfvirtex
309
310         # Rename mpost to leave room for mplib
311         mv "${ED}/usr/bin/mpost" "${ED}/usr/bin/mpost-${P}"
312         dosym "mpost-${P}" /usr/bin/mpost
313
314         # Ditto for pdftex
315         mv "${ED}/usr/bin/pdftex" "${ED}/usr/bin/pdftex-${P}"
316         dosym "pdftex-${P}" /usr/bin/pdftex
317 }
318
319 pkg_preinst() {
320         # Remove stray files to keep the upgrade path sane
321         if has_version =app-text/texlive-core-2007* ; then
322                 for i in pdftex/pdflatex aleph/aleph aleph/lamed omega/lambda omega/omega xetex/xetex xetex/xelatex tex/tex pdftex/etex pdftex/pdftex pdftex/pdfetex ; do
323                         for j in log fmt ; do
324                                 local file="${EROOT}/var/lib/texmf/web2c/${i}.${j}"
325                                 if [ -f "${file}" ] ; then
326                                         elog "Removing stray ${file} from TeXLive 2007 install."
327                                         rm -f "${file}"
328                                 fi
329                         done
330                 done
331                 for j in base log ; do
332                         local file="${EROOT}/var/lib/texmf/web2c/metafont/mf.${j}"
333                         if [ -f "${file}" ] ; then
334                                 elog "Removing stray ${file} from TeXLive 2007 install."
335                                 rm -f "${file}"
336                         fi
337                 done
338         fi
339 }
340
341 pkg_postinst() {
342         etexmf-update
343
344         elog
345         elog "If you have configuration files in ${EPREFIX}/etc/texmf to merge,"
346         elog "please update them and run ${EPREFIX}/usr/sbin/texmf-update."
347         elog
348         ewarn "If you are migrating from an older TeX distribution"
349         ewarn "Please make sure you have read:"
350         ewarn "https://www.gentoo.org/proj/en/tex/texlive-migration-guide.xml"
351         ewarn "in order to avoid possible problems"
352         elog
353         elog "TeXLive has been split in various ebuilds. If you are missing a"
354         elog "package to process your TeX documents, you can install"
355         elog "dev-tex/texmfind to easily search for them."
356         elog
357 }