1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 #TL_UPSTREAM_PATCHLEVEL="1"
9 TL_SOURCE_VERSION=20130530
11 inherit eutils flag-o-matic toolchain-funcs libtool texlive-common
13 MY_PV=${PN%-core}-${TL_SOURCE_VERSION}-source
15 DESCRIPTION="A complete TeX distribution"
16 HOMEPAGE="http://tug.org/texlive/"
18 LICENSE="GPL-2 LPPL-1.3c TeX"
20 SRC_URI="mirror://gentoo/${MY_PV}.tar.xz"
23 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-patches-${PATCHLEVEL}.tar.xz"
24 # mirror://gentoo/texlive-core-upstream-patches-${TL_UPSTREAM_PATCHLEVEL}.tar.xz"
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
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
46 TL_CORE_BINEXTRA_SRC_MODULES="
47 adhocfilelist.source hyphenex.source listings-ext.source mkjobtexmf.source
48 pfarrei.source texdef.source
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}"
55 for i in ${TL_CORE_EXTRA_MODULES}; do
56 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.xz"
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"
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"
68 SRC_URI="${SRC_URI} )"
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"
73 TEXMF_PATH=/usr/share/texmf-dist
75 MODULAR_X_DEPEND="X? (
85 COMMON_DEPEND="${MODULAR_X_DEPEND}
88 !<app-text/texlive-2007
90 !<dev-texlive/texlive-basic-2013
91 !<dev-texlive/texlive-metapost-2011
94 >=media-libs/libpng-1.2.43-r2:0=
95 >=app-text/poppler-0.12.3-r3:=
97 >=x11-libs/pixman-0.18
99 >=media-libs/harfbuzz-0.9.20[icu,graphite]
102 media-libs/fontconfig
104 media-libs/freetype:2
106 >=dev-libs/kpathsea-6.1.1_p20130530
107 cjk? ( >=dev-libs/ptexenc-1.3.1_p20130530 )"
109 DEPEND="${COMMON_DEPEND}
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 )"
123 # texdoc needs luatex.
124 PDEPEND=">=dev-tex/luatex-0.76"
126 S="${WORKDIR}/${P}_build"
127 B="${WORKDIR}/${MY_PV}"
131 mkdir -p "${S}" || die "failed to create build dir"
134 RELOC_TARGET=texmf-dist
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}"
144 for i in $(<"${T}/reloclist"); do
145 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
148 mv "${WORKDIR}"/texmf* "${B}" || die "failed to move texmf files"
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"
158 # It fails on alpha without this
159 use alpha && append-ldflags "-Wl,--no-relax"
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.
165 tc-export CC CXX AR RANLIB
166 ECONF_SOURCE="${B}" \
168 --bindir="${EPREFIX}"/usr/bin \
170 --with-system-freetype2 \
172 --with-system-libpng \
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 \
180 --with-system-ptexenc \
181 --with-system-harfbuzz \
183 --with-system-graphite2 \
184 --with-system-cairo \
185 --with-system-pixman \
188 --disable-multiplatform \
192 --enable-tektronixwin \
193 --enable-unitermwin \
204 --disable-lcdf-typetools \
218 --disable-xdvipdfmx \
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) \
234 tc-export CC CXX AR RANLIB
235 emake SHELL="${EPREFIX}"/bin/sh texmf="${EPREFIX}"${TEXMF_PATH:-/usr/share/texmf-dist} || die "emake failed"
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"
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"
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"
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"
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
267 dodoc ChangeLog README || die "failed to install texk docs"
270 cd "${B}/texk/dviljk"
271 dodoc ChangeLog README NEWS || die "failed to install dviljk docs"
274 cd "${B}/texk/makeindexk"
275 dodoc ChangeLog NOTES README || die "failed to install makeindexk docs"
279 dodoc ChangeLog NEWS PROJECTS README || die "failed to install web2c docs"
281 use doc || rm -rf "${ED}/usr/share/texmf-dist/doc"
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
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}
291 mv "${ED}${TEXMF_PATH}/web2c/updmap.cfg" "${ED}/etc/texmf/updmap.d/00updmap.cfg" || die "moving updmap.cfg failed"
293 # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d files
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"
299 texlive-common_handle_config_files
301 keepdir /usr/share/texmf-site
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
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
315 mv "${ED}/usr/bin/pdftex" "${ED}/usr/bin/pdftex-${P}"
316 dosym "pdftex-${P}" /usr/bin/pdftex
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."
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."
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."
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"
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."