Properly package texlive and split package into texlive & texlive-bin (#1203)
[termux-packages] / packages / texlive-bin / build.sh
1 TERMUX_PKG_HOMEPAGE=https://www.tug.org/texlive/
2 TERMUX_PKG_DESCRIPTION="TeX Live is a distribution of the TeX typesetting system."
3 TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91"
4 _MAJOR_VERSION=20170524
5 _MINOR_VERSION=
6 TERMUX_PKG_VERSION=${_MAJOR_VERSION}${_MINOR_VERSION}
7 TERMUX_PKG_SRCURL=ftp://tug.org/historic/systems/texlive/${TERMUX_PKG_VERSION:0:4}/texlive-${TERMUX_PKG_VERSION}-source.tar.xz
8 TERMUX_PKG_SHA256="0161695304e941334dc0b3b5dabcf8edf46c09b7bc33eea8229b5ead7ccfb2aa"
9 TERMUX_PKG_DEPENDS="freetype, libpng, libgd, libgmp, libmpfr, libicu, liblua, poppler, libgraphite, harfbuzz-icu, perl"
10 TERMUX_PKG_FOLDERNAME=texlive-${_MAJOR_VERSION}-source
11 TERMUX_PKG_BREAKS="texlive (<< 20170524-3)"
12 TERMUX_PKG_REPLACES="texlive (<< 20170524-3)"
13 TERMUX_PKG_NO_DEVELSPLIT=yes
14
15 TL_ROOT=$TERMUX_PREFIX/opt/texlive/${TERMUX_PKG_VERSION:0:4}
16 TL_BINDIR=$TL_ROOT/bin/custom
17
18 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
19 AR=ar \
20 RANLIB=ranlib \
21 BUILDAR=ar \
22 BUILDRANLIB=ranlib \
23 ac_cv_c_bigendian=no \
24 --prefix=$TL_ROOT \
25 --bindir=$TL_BINDIR \
26 --datarootdir=$TL_ROOT \
27 --datadir=$TERMUX_PREFIX/share \
28 --mandir=$TERMUX_PREFIX/share/man \
29 --docdir=$TERMUX_PREFIX/share/doc \
30 --infodir=$TERMUX_PREFIX/share/info \
31 --libdir=$TERMUX_PREFIX/lib \
32 --includedir=$TERMUX_PREFIX/include \
33 --build=$TERMUX_BUILD_TUPLE \
34 --enable-ttfdump=no \
35 --enable-makeindexk=yes \
36 --enable-makejvf=no \
37 --enable-mendexk=no \
38 --enable-musixtnt=no \
39 --enable-ps2pk=no \
40 --enable-seetexk=no \
41 --enable-gregorio=no \
42 --disable-native-texlive-build \
43 --disable-bibtexu \
44 --disable-dvisvgm \
45 --disable-dialog \
46 --disable-psutils \
47 --disable-multiplatform \
48 --disable-t1utils \
49 --enable-luatex \
50 --disable-luajittex \
51 --disable-mflua \
52 --disable-mfluajit \
53 --disable-xz \
54 --disable-pmx \
55 --without-texinfo \
56 --without-xdvipdfmx \
57 --without-texi2html \
58 --with-system-cairo \
59 --with-system-graphite2 \
60 --with-system-harfbuzz \
61 --with-system-gd \
62 --with-system-gmp \
63 --with-system-icu \
64 --with-system-lua \
65 --with-system-mpfr \
66 --with-system-poppler \
67 --with-system-zlib \
68 --with-system-xpdf \
69 --with-system-lua \
70 --without-x \
71 --with-banner-add=/Termux"
72
73 TERMUX_PKG_RM_AFTER_INSTALL="opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist"
74
75 termux_step_pre_configure() {
76 # When building against libicu 59.1 or later we need c++11:
77 CXXFLAGS+=" -std=c++11"
78 }
79
80 termux_step_post_make_install () {
81 mkdir -p $TERMUX_PREFIX/etc/profile.d/
82 echo "export PATH=\$PATH:$TL_BINDIR" > $TERMUX_PREFIX/etc/profile.d/texlive.sh
83 echo "export TMPDIR=$TERMUX_PREFIX/tmp/" >> $TERMUX_PREFIX/etc/profile.d/texlive.sh
84 chmod 0744 $TERMUX_PREFIX/etc/profile.d/texlive.sh
85 mv $TL_BINDIR/tlmgr $TL_BINDIR/tlmgr.ln
86 echo "#!$TERMUX_PREFIX/bin/sh" > $TL_BINDIR/tlmgr
87 echo "termux-fix-shebang $TL_ROOT/texmf-dist/scripts/texlive/tlmgr.pl" >> $TL_BINDIR/tlmgr
88 echo "sed -E -i '"'s@`/bin/sh@`'$TERMUX_PREFIX"/bin/sh@g' ${TL_ROOT}/tlpkg/TeXLive/TLUtils.pm" >> $TL_BINDIR/tlmgr
89 echo 'tlmgr.ln "$@"' >> $TL_BINDIR/tlmgr
90 chmod 0744 $TL_BINDIR/tlmgr
91 }
92
93 termux_step_create_debscripts () {
94 # Clean texlive's folder if needed (run on fresh install)
95 echo "if [ ! -f $TERMUX_PREFIX/opt/texlive/2016/install-tl -a ! -f $TERMUX_PREFIX/opt/texlive/2017/install-tl ]; then exit 0; else echo 'Removing residual files from old version of TeX Live for Termux'; fi" > preinst
96 echo "rm -rf $TERMUX_PREFIX/etc/profile.d/texlive.sh" >> preinst
97 echo "rm -rf $TERMUX_PREFIX/opt/texlive/2016"
98 # Let's not delete the previous texmf-dist so that people who have installed a full distribution won't need to download everything again
99 echo "rm -rf $TERMUX_PREFIX/opt/texlive/2017/!(texmf-dist)" >> preinst
100 echo "exit 0" >> preinst
101 chmod 0755 preinst
102 }