Use https by default
[gentoo.git] / app-text / texlive-core / texlive-core-2014-r4.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="50"
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         app-text/libpaper
106         xetex? (
107                 >=media-libs/harfbuzz-0.9.20[icu,graphite]
108                 >=dev-libs/icu-50:=
109                 app-text/teckit
110                 media-libs/fontconfig
111                 media-gfx/graphite2
112         )
113         media-libs/freetype:2
114         >=dev-libs/kpathsea-6.2.0
115         cjk? ( >=dev-libs/ptexenc-1.3.2_p20140525-r1 )"
116
117 DEPEND="${COMMON_DEPEND}
118         virtual/pkgconfig
119         sys-apps/ed
120         sys-devel/flex
121         app-arch/xz-utils"
122
123 RDEPEND="${COMMON_DEPEND}
124         >=app-text/ps2pkm-1.5_p20130530
125         >=app-text/dvipsk-5.993_p20130530
126         >=dev-tex/bibtexu-3.71_p20130530
127         virtual/perl-Getopt-Long
128         tk? ( dev-perl/perl-tk )"
129
130 S="${WORKDIR}/${P}_build"
131 B="${WORKDIR}/${MY_PV}"
132
133 src_unpack() {
134         unpack ${A}
135         mkdir -p "${S}" || die "failed to create build dir"
136 }
137
138 RELOC_TARGET=texmf-dist
139
140 src_prepare() {
141         cd "${WORKDIR}"
142         # From texlive-module.eclass.
143         grep -H RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist"
144         { for i in $(<"${T}/reloclist"); do  dirname $i; done; } | uniq > "${T}/dirlist"
145         for i in $(<"${T}/dirlist"); do
146                 [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}"
147         done
148         for i in $(<"${T}/reloclist"); do
149                 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
150         done
151
152         mv "${WORKDIR}"/texmf* "${B}" || die "failed to move texmf files"
153
154         cd "${B}"
155         #EPATCH_MULTI_MSG="Applying patches from upstream bugfix branch..." EPATCH_SUFFIX="patch" epatch "${WORKDIR}/gentoo_branch2011_patches"
156         EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
157
158         elibtoolize
159 }
160
161 src_configure() {
162         # It fails on alpha without this
163         use alpha && append-ldflags "-Wl,--no-relax"
164
165         has_version '>=dev-libs/kpathsea-6.2.1' && append-cppflags "$($(tc-getPKG_CONFIG) --cflags kpathsea)"
166
167         # Too many regexps use A-Z a-z constructs, what causes problems with locales
168         # that don't have the same alphabetical order than ascii. Bug #242430
169         # So we set LC_ALL to C in order to avoid problems.
170         export LC_ALL=C
171         tc-export CC CXX AR RANLIB
172         ECONF_SOURCE="${B}" \
173                 econf -C \
174                 --bindir="${EPREFIX}"/usr/bin \
175                 --datadir="${S}" \
176                 --with-system-freetype2 \
177                 --with-system-zlib \
178                 --with-system-libpng \
179                 --with-system-xpdf \
180                 --with-system-poppler \
181                 --with-system-teckit \
182                 --with-teckit-includes="${EPREFIX}"/usr/include/teckit \
183                 --with-system-kpathsea \
184                 --with-kpathsea-includes="${EPREFIX}"/usr/include \
185                 --with-system-icu \
186                 --with-system-ptexenc \
187                 --with-system-harfbuzz \
188                 --with-system-icu \
189                 --with-system-graphite2 \
190                 --with-system-cairo \
191                 --with-system-pixman \
192                 --with-system-zziplib \
193                 --with-system-libpaper \
194                 --without-texinfo \
195                 --disable-dialog \
196                 --disable-multiplatform \
197                 --enable-epsfwin \
198                 --enable-mftalkwin \
199                 --enable-regiswin \
200                 --enable-tektronixwin \
201                 --enable-unitermwin \
202                 --with-ps=gs \
203                 --disable-psutils \
204                 --disable-t1utils \
205                 --enable-ipc \
206                 --disable-biber \
207                 --disable-bibtex-x \
208                 --disable-dvipng \
209                 --disable-dvipsk \
210                 --disable-chktex \
211                 --disable-lcdf-typetools \
212                 --disable-pdfopen \
213                 --disable-ps2eps \
214                 --disable-ps2pkm \
215                 --disable-detex \
216                 --disable-ttf2pk2 \
217                 --disable-tex4htk \
218                 --disable-cjkutils \
219                 --disable-xdvik \
220                 --disable-xindy \
221                 --enable-luatex \
222                 --disable-dvi2tty \
223                 --disable-dvisvgm \
224                 --disable-vlna \
225                 --enable-shared \
226                 --disable-native-texlive-build \
227                 --disable-largefile \
228                 $(use_enable xetex) \
229                 $(use_enable cjk ptex) \
230                 $(use_enable cjk eptex) \
231                 $(use_enable cjk uptex) \
232                 $(use_enable cjk euptex) \
233                 $(use_enable cjk mendexk) \
234                 $(use_enable cjk makejvf) \
235                 $(use_enable tk texdoctk) \
236                 $(use_with X x)
237 }
238
239 src_compile() {
240         tc-export CC CXX AR RANLIB
241         emake SHELL="${EPREFIX}"/bin/sh texmf="${EPREFIX}"${TEXMF_PATH:-/usr/share/texmf-dist}
242
243         cd "${B}" || die
244         # Mimic updmap --syncwithtrees to enable only fonts installed
245         # Code copied from updmap script
246         for i in `egrep '^(Mixed|Kanji)?Map' "texmf-dist/web2c/updmap.cfg" | sed 's@.* @@'`; do
247                 texlive-common_is_file_present_in_texmf "$i" || echo "$i"
248         done > "${T}/updmap_update"
249         {
250                 sed 's@/@\\/@g; s@^@/^MixedMap[     ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
251                 sed 's@/@\\/@g; s@^@/^Map[  ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
252                 sed 's@/@\\/@g; s@^@/^KanjiMap[     ]*@; s@$@$/s/^/#! /@' <"${T}/updmap_update"
253         } > "${T}/updmap_update2"
254         sed -f "${T}/updmap_update2" "texmf-dist/web2c/updmap.cfg" >    "${T}/updmap_update3"\
255                 && cat "${T}/updmap_update3" > "texmf-dist/web2c/updmap.cfg"
256 }
257
258 src_install() {
259         dodir ${TEXMF_PATH:-/usr/share/texmf-dist}/web2c
260         emake DESTDIR="${D}" texmf="${ED}${TEXMF_PATH:-/usr/share/texmf-dist}" run_texlinks="true" run_mktexlsr="true" install
261
262         cd "${B}" || die
263         dodir /usr/share # just in case
264         cp -pR texmf-dist "${ED}/usr/share/" || die "failed to install texmf trees"
265         cp -pR "${WORKDIR}"/tlpkg "${ED}/usr/share/" || die "failed to install tlpkg files"
266
267         # When X is disabled mf-nowin doesn't exist but some scripts expect it to
268         # exist. Instead, it is called mf, so we symlink it to please everything.
269         use X || dosym mf /usr/bin/mf-nowin
270
271         docinto texk
272         cd "${B}/texk"
273         dodoc ChangeLog README
274
275         docinto dviljk
276         cd "${B}/texk/dviljk"
277         dodoc ChangeLog README NEWS
278
279         docinto makeindexk
280         cd "${B}/texk/makeindexk"
281         dodoc ChangeLog NOTES README
282
283         docinto web2c
284         cd "${B}/texk/web2c"
285         dodoc ChangeLog NEWS PROJECTS README
286
287         use doc || rm -rf "${ED}/usr/share/texmf-dist/doc"
288
289         dodir /etc/env.d
290         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"
291         # populate /etc/texmf
292         keepdir /etc/texmf/web2c
293
294         # take care of updmap.cfg and language.d files
295         keepdir /etc/texmf/{updmap.d,language.dat.d,language.def.d,language.dat.lua.d}
296
297         mv "${ED}${TEXMF_PATH}/web2c/updmap.cfg" "${ED}/etc/texmf/updmap.d/00updmap.cfg" || die "moving updmap.cfg failed"
298
299         # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d files
300         # by texmf-update
301         rm -f "${ED}${TEXMF_PATH}/web2c/fmtutil.cnf"
302         # Remove bundled and invalid updmap.cfg
303         rm -f "${ED}/usr/share/texmf-dist/web2c/updmap.cfg"
304
305         texlive-common_handle_config_files
306
307         keepdir /usr/share/texmf-site
308
309         # the virtex symlink is not installed
310         # The links has to be relative, since the targets
311         # is not present at this stage and MacOS doesn't
312         # like non-existing targets
313         dosym tex /usr/bin/virtex
314         dosym pdftex /usr/bin/pdfvirtex
315
316         # Rename mpost to leave room for mplib
317         mv "${ED}/usr/bin/mpost" "${ED}/usr/bin/mpost-${P}"
318         dosym "mpost-${P}" /usr/bin/mpost
319
320         # Ditto for pdftex
321         mv "${ED}/usr/bin/pdftex" "${ED}/usr/bin/pdftex-${P}"
322         dosym "pdftex-${P}" /usr/bin/pdftex
323 }
324
325 pkg_postinst() {
326         etexmf-update
327
328         elog
329         elog "If you have configuration files in ${EPREFIX}/etc/texmf to merge,"
330         elog "please update them and run ${EPREFIX}/usr/sbin/texmf-update."
331         elog
332         ewarn "If you are migrating from an older TeX distribution"
333         ewarn "Please make sure you have read:"
334         ewarn "https://www.gentoo.org/proj/en/tex/texlive-migration-guide.xml"
335         ewarn "in order to avoid possible problems"
336         elog
337         elog "TeXLive has been split in various ebuilds. If you are missing a"
338         elog "package to process your TeX documents, you can install"
339         elog "dev-tex/texmfind to easily search for them."
340         elog
341 }