1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 #TL_UPSTREAM_PATCHLEVEL="1"
9 TL_SOURCE_VERSION=20140525
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 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
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
48 TL_CORE_BINEXTRA_SRC_MODULES="
49 adhocfilelist.source hyphenex.source listings-ext.source mkjobtexmf.source
50 pfarrei.source texdef.source
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}"
57 for i in ${TL_CORE_EXTRA_MODULES}; do
58 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.xz"
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"
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"
70 SRC_URI="${SRC_URI} )"
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"
75 TEXMF_PATH=/usr/share/texmf-dist
77 MODULAR_X_DEPEND="X? (
87 COMMON_DEPEND="${MODULAR_X_DEPEND}
90 !<app-text/texlive-2007
92 !<dev-texlive/texlive-basic-2014
93 !<dev-texlive/texlive-metapost-2011
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
106 >=media-libs/harfbuzz-0.9.20[icu,graphite]
109 media-libs/fontconfig
112 media-libs/freetype:2
113 >=dev-libs/kpathsea-6.2.0
114 cjk? ( >=dev-libs/ptexenc-1.3.2_p20140525-r1 )"
116 DEPEND="${COMMON_DEPEND}
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 )"
129 S="${WORKDIR}/${P}_build"
130 B="${WORKDIR}/${MY_PV}"
134 mkdir -p "${S}" || die "failed to create build dir"
137 RELOC_TARGET=texmf-dist
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}"
147 for i in $(<"${T}/reloclist"); do
148 mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
151 mv "${WORKDIR}"/texmf* "${B}" || die "failed to move texmf files"
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"
161 # It fails on alpha without this
162 use alpha && append-ldflags "-Wl,--no-relax"
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.
168 tc-export CC CXX AR RANLIB
169 ECONF_SOURCE="${B}" \
171 --bindir="${EPREFIX}"/usr/bin \
173 --with-system-freetype2 \
175 --with-system-libpng \
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 \
183 --with-system-ptexenc \
184 --with-system-harfbuzz \
186 --with-system-graphite2 \
187 --with-system-cairo \
188 --with-system-pixman \
189 --with-system-zziplib \
192 --disable-multiplatform \
196 --enable-tektronixwin \
197 --enable-unitermwin \
207 --disable-lcdf-typetools \
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) \
236 tc-export CC CXX AR RANLIB
237 emake SHELL="${EPREFIX}"/bin/sh texmf="${EPREFIX}"${TEXMF_PATH:-/usr/share/texmf-dist} || die "emake failed"
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"
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"
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"
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"
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
269 dodoc ChangeLog README || die "failed to install texk docs"
272 cd "${B}/texk/dviljk"
273 dodoc ChangeLog README NEWS || die "failed to install dviljk docs"
276 cd "${B}/texk/makeindexk"
277 dodoc ChangeLog NOTES README || die "failed to install makeindexk docs"
281 dodoc ChangeLog NEWS PROJECTS README || die "failed to install web2c docs"
283 use doc || rm -rf "${ED}/usr/share/texmf-dist/doc"
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
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}
293 mv "${ED}${TEXMF_PATH}/web2c/updmap.cfg" "${ED}/etc/texmf/updmap.d/00updmap.cfg" || die "moving updmap.cfg failed"
295 # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d files
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"
301 texlive-common_handle_config_files
303 keepdir /usr/share/texmf-site
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
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
317 mv "${ED}/usr/bin/pdftex" "${ED}/usr/bin/pdftex-${P}"
318 dosym "pdftex-${P}" /usr/bin/pdftex
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."
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"
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."