# remove luatex stuff from config file if not enabled
-if ! depends_is_enabled $SPELL lua51; then
- sed -i -e '/luatex/d' ${INSTALL_ROOT}/usr/share/texmf/web2c/fmtutil.cnf
+if ! is_depends_enabled $SPELL LUA; then
+ sed -i -e '/luatex/d' "$fmtutilcnf"
fi &&
# create symlinks to latex, pdflatex, etc
-${INSTALL_ROOT}/usr/bin/texlinks -f
${INSTALL_ROOT}/usr/share/texmf/web2c/fmtutil.cnf ${INSTALL_ROOT}/usr/bin &&
+${INSTALL_ROOT}/usr/bin/texlinks -f "$fmtutilcnf" ${INSTALL_ROOT}/usr/bin &&
+
+# updmap and fmtutil-sys are broken without an install of TexLive::TLUtils
+# This comes with the installer, which we don't use, one source:
+# ftp://tug.org/texlive/historic/2012/tlnet-final/tlpkg/
+# Now, there happens to be a copy here, too ... just using it.
+# Rationale for the hack here: This spell installs updmap, so it should
+# damn well also ensure that this tool can run.
+# Proper use would install tlpkg, which we don't use, just for that lib.
+mkdir -p "$INSTALL_ROOT/usr/share/tlpkg" &&
+cp -vdR "$SOURCE_DIRECTORY/texk/tests/TeXLive" \
+ "$INSTALL_ROOT/usr/share/tlpkg" &&
-# allow fontconfig to see latex fonts
+# allow fontconfig to see latex fonts
install -Cv ${SPELL_DIRECTORY}/09-texlive-fonts.conf
${INSTALL_ROOT}/etc/fonts/conf.avail &&
ln -fs ${INSTALL_ROOT}/etc/fonts/conf.avail/09-texlive-fonts.conf
${INSTALL_ROOT}/etc/fonts/conf.d &&
-fc-cache -fsv &&
+fc-cache -fsv &&
-if is_depends_enabled $SPELL lua ; then
+if is_depends_enabled $SPELL LUA; then
# update filename db & create formats for context
mtxrun --generate &&
# generate fonts for luatex & context
OSFONTDIR="${INSTALL_ROOT}/usr/share/texmf-dist/fonts/;${INSTALL_ROOT}/usr/share/texmf/fonts/;${INSTALL_ROOT}/usr/local/share/texmf/fonts"
mtxrun --script fonts --reload
-fi &&
-
-# updmap is broken without an install of TexLive::TLUtils
-# This comes with the installer, which we don't use, one source:
-# ftp://tug.org/texlive/historic/2012/tlnet-final/tlpkg/
-# Now, there happens to be a copy here, too ... just using it.
-# Rationale for the hack here: This spell installs updmap, so it should
-# damn well also ensure that this tool can run.
-# Proper use would install tlpkg, which we don't use, just for that lib.
-mkdir -p "$INSTALL_ROOT/usr/share/tlpkg" &&
-cp -vr "$SOURCE_DIRECTORY/texk/tests/TeXLive"
"$INSTALL_ROOT/usr/share/tlpkg"
+fi
diff --git a/latex/texlive/PRE_BUILD b/latex/texlive/PRE_BUILD
index 9ada7b5..05cfc69 100755
--- a/latex/texlive/PRE_BUILD
+++ b/latex/texlive/PRE_BUILD
@@ -1,22 +1,65 @@
default_pre_build &&
-cd ${SOURCE_DIRECTORY} &&
+cd "$SOURCE_DIRECTORY" &&
-# Use /usr/share/texmf and /usr/share/texmf-dist, adapted from lunarlinux
+# removing as much internal things as possible
+ #asymptote \
+ #devnag \
+ #lacheck \
+ #m-tx \
+ #pmx \
+ #texdoctk \
+ #tpic2pdftex \
+ #vlna \
+ #xindy \
+for i in \
+ ps2eps \
+ t1utils \
+ xpdfopen
+do
+ rm -rf utils/"$i"
+done &&
+
+# Override bundled libraries' buildsystems to force system versions
+# XXX lua52 and luajit can't be so easily removed due to internal API
+# dependencies.
+for i in \
+ cairo \
+ freetype2 \
+ gd \
+ gmp \
+ graphite2 \
+ harfbuzz \
+ icu \
+ libpaper \
+ libpng \
+ mpfr \
+ pixman \
+ poppler \
+ potrace \
+ xpdf \
+ zlib \
+ zziplib
+do
+ rm -rf libs/"$i" &&
+ mkdir libs/"$i" &&
+ cat <<"!" > libs/"$i"/configure &&
+#!/bin/sh
+echo '%:;echo $@ target suppressed' > Makefile
+!
+ chmod 755 libs/"$i"/configure
+done &&
+
+# Use /usr/share/texmf and /usr/share/texmf-dist, adapted from lunarlinux
find -name Makefile\* -exec sed -i -e
"s:\(\$.\)prefix\(./tex\):\1datadir\2:" {} \; &&
find -name configure -exec sed -i -e "s:\(\$.\)prefix\(./tex\):\1datadir\2:"
{} \; &&
find -name \*.info -exec sed -i -e "s:/usr/local:/usr:" {} \; &&
find -name \*.texi -exec sed -i -e "s:/usr/local:/usr:" {} \; &&
-patch -p1 < ${SPELL_DIRECTORY}/fix_paths.patch
-
-# the sed on the patch is live so it will take into
-# account INSTALL_ROOT
-sed "s:/usr/share:$INSTALL_ROOT/usr/share:g"
$SPELL_DIRECTORY/texmf.cnf_fix.patch | patch -p0 &&
-# patch mtxrun for context taking into account $INSTALL_ROOT, see HISTORY
-sed "s:/usr/bin:$INSTALL_ROOT/usr/bin:g" $SPELL_DIRECTORY/mtxrun_fix.patch |
patch -p0 &&
-
-# removing as much internal things as possible
-rm -rf utils/{dialog,gzip,lzma,ps2eps,psutils,t1utils,texinfo,pdfopen} &&
-rm -rf
libs/{freetype2,lua51,libpng,jpeg,expat,gd,luafilesystem,luafontforge,luamd5,luapeg,luazip,luazlib,ncurses,t1lib,unzip}
&&
+# Patch paths in texmf.cnf
+sedit '
+ s@^TEXMFROOT =.*@&/usr/share@
+ /^TEXMFLOCAL =/ s@=.*@= $SELFAUTODIR/local/share/texmf@
+ /^TEXMFSYSVAR =/ s@=.*@= /var/tmp/texmf-var@
+' texk/kpathsea/texmf.cnf &&