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