# Note: depends on pkg-config
# Note: depends on perl
# Note: depends on texlive-texmf
# Note: depends on zlib
# Note: depends on freetype
# Note: depends on libpng
# Note: depends on icu
# Note: depends on poppler
# Note: depends on gd
# Note: depends on gtk+
# Note: depends on cairo
wget -c ftp://tug.org/texlive/historic/2015/texlive-20150521-source.tar.xz
tar -xJf texlive-20150521-source.tar.xz
cd texlive-20150521-source
sed -i -e '/^TEXMFROOT/{s|=.*|= /usr/share|;}' texk/kpathsea/texmf.cnf
mkdir -p builddir
cd builddir
../configure --prefix="/usr" --datarootdir="/usr/share" --disable-native-texlive-build --without-x --with-system-cairo --with-system-zlib --with-system-freetype --with-system-libpng --with-system-icu --with-system-poppler --with-system-gmp --with-system-mpfr --with-system-gd
make # Doesn't mind -j#
make install
cp -r ../texk/tests/TeXLive "`perl -e 'print $INC[0]'`" # as root, install the fmtutil dependencies
ln -s pdftex /usr/bin/pdflatex
ln -s pdftex /usr/bin/latex
mktexlsr # as root
fmtutil-sys --all || true # as root, ignore exit status