texlive-bin: enable extglob locally in preinst script (#1643)
[termux-packages] / packages / texlive-bin / build.sh
CommitLineData
dce832a2
HG
1TERMUX_PKG_HOMEPAGE=https://www.tug.org/texlive/
2TERMUX_PKG_DESCRIPTION="TeX Live is a distribution of the TeX typesetting system."
3TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91"
4_MAJOR_VERSION=20170524
5_MINOR_VERSION=
104ad022 6TERMUX_PKG_REVISION=3
dce832a2
HG
7TERMUX_PKG_VERSION=${_MAJOR_VERSION}${_MINOR_VERSION}
8TERMUX_PKG_SRCURL=ftp://tug.org/historic/systems/texlive/${TERMUX_PKG_VERSION:0:4}/texlive-${TERMUX_PKG_VERSION}-source.tar.xz
9TERMUX_PKG_SHA256="0161695304e941334dc0b3b5dabcf8edf46c09b7bc33eea8229b5ead7ccfb2aa"
10TERMUX_PKG_DEPENDS="freetype, libpng, libgd, libgmp, libmpfr, libicu, liblua, poppler, libgraphite, harfbuzz-icu, perl"
1ec6c4b8 11TERMUX_PKG_BUILD_DEPENDS="icu-devtools"
dce832a2
HG
12TERMUX_PKG_BREAKS="texlive (<< 20170524-3)"
13TERMUX_PKG_REPLACES="texlive (<< 20170524-3)"
93372882 14TERMUX_PKG_RECOMMENDS="texlive"
dce832a2
HG
15TERMUX_PKG_NO_DEVELSPLIT=yes
16
17TL_ROOT=$TERMUX_PREFIX/opt/texlive/${TERMUX_PKG_VERSION:0:4}
18TL_BINDIR=$TL_ROOT/bin/custom
19
20TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
21AR=ar \
22RANLIB=ranlib \
23BUILDAR=ar \
24BUILDRANLIB=ranlib \
25ac_cv_c_bigendian=no \
26--prefix=$TL_ROOT \
27--bindir=$TL_BINDIR \
28--datarootdir=$TL_ROOT \
29--datadir=$TERMUX_PREFIX/share \
30--mandir=$TERMUX_PREFIX/share/man \
31--docdir=$TERMUX_PREFIX/share/doc \
32--infodir=$TERMUX_PREFIX/share/info \
33--libdir=$TERMUX_PREFIX/lib \
34--includedir=$TERMUX_PREFIX/include \
35--build=$TERMUX_BUILD_TUPLE \
36--enable-ttfdump=no \
37--enable-makeindexk=yes \
38--enable-makejvf=no \
39--enable-mendexk=no \
40--enable-musixtnt=no \
41--enable-ps2pk=no \
42--enable-seetexk=no \
43--enable-gregorio=no \
44--disable-native-texlive-build \
45--disable-bibtexu \
46--disable-dvisvgm \
47--disable-dialog \
48--disable-psutils \
49--disable-multiplatform \
50--disable-t1utils \
51--enable-luatex \
52--disable-luajittex \
53--disable-mflua \
54--disable-mfluajit \
55--disable-xz \
56--disable-pmx \
57--without-texinfo \
58--without-xdvipdfmx \
59--without-texi2html \
60--with-system-cairo \
61--with-system-graphite2 \
62--with-system-harfbuzz \
63--with-system-gd \
64--with-system-gmp \
65--with-system-icu \
66--with-system-lua \
67--with-system-mpfr \
68--with-system-poppler \
69--with-system-zlib \
70--with-system-xpdf \
71--with-system-lua \
72--without-x \
73--with-banner-add=/Termux"
74
0b67d3bb 75# These files are provided by texlive:
93372882
HG
76TERMUX_PKG_RM_AFTER_INSTALL="
77opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/texconfig/tcfmgr.map
78opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/texconfig/tcfmgr
79opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/texmf.cnf
80opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/mktex.opt
81opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/mktexdir.opt
82opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/mktexnam.opt
83opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/fmtutil.cnf
84opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/mktexdir
85opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/mktexnam
86opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/web2c/mktexupd
87opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvipdfmx/dvipdfmx.cfg
88opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/color.pro
89opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/crop.pro
90opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/finclude.pro
91opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/hps.pro
92opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/special.pro
93opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/tex.pro
94opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/texps.pro
95opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/base/texc.pro
96opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/dvips/gsftopk/render.ps
97opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/allcm.sh
98opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/allneeded.sh
99opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/dvi2fax.sh
100opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/dvired.sh
101opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/kpsetool.sh
102opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/kpsewhere.sh
103opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/texconfig-dialog.sh
104opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/texconfig-sys.sh
105opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/texconfig.sh
106opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/texlinks.sh
107opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/fmtutil-sys.sh
108opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/fmtutil.pl
109opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/tlmgr.pl
110opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/updmap-sys.sh
111opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/texlive/updmap.pl
112opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/simpdftex/simpdftex
113opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/fonts/cmap/dvipdfmx/EUC-UCS2
114opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/fonts/map/glyphlist/pdfglyphlist.txt
115opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/fonts/map/glyphlist/glyphlist.txt
116opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/fonts/map/glyphlist/texglyphlist.txt
117opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/fonts/map/dvipdfmx/cid-x.map
118opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/fonts/enc/dvips/base/7t.enc
119opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/luaotfload/luaotfload-tool.lua
120opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/oberdiek/pdfatfi.pl
121opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/lua2dox/lua2dox_filter
122opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/context/perl/mptopdf.pl
123opt/texlive/${TERMUX_PKG_VERSION:0:4}/texmf-dist/scripts/checkcites/checkcites.lua"
dce832a2
HG
124
125termux_step_pre_configure() {
126 # When building against libicu 59.1 or later we need c++11:
127 CXXFLAGS+=" -std=c++11"
128}
129
130termux_step_post_make_install () {
0b67d3bb 131 # Add bin dir to path for new shells (doesn't work for zsh and others)
dce832a2 132 mkdir -p $TERMUX_PREFIX/etc/profile.d/
0b67d3bb 133 echo "#!$TERMUX_PREFIX/bin/sh" > $TERMUX_PREFIX/etc/profile.d/texlive.sh
104ad022 134 echo "export TMPDIR=$TERMUX_PREFIX/tmp" >> $TERMUX_PREFIX/etc/profile.d/texlive.sh
0b67d3bb 135 echo "export PATH=\$PATH:$TL_BINDIR" >> $TERMUX_PREFIX/etc/profile.d/texlive.sh
dce832a2 136 chmod 0744 $TERMUX_PREFIX/etc/profile.d/texlive.sh
0b67d3bb 137 # Replace tlmgr link with a small wrapper that prevents common break on "tlmgr update --self"
dce832a2
HG
138 mv $TL_BINDIR/tlmgr $TL_BINDIR/tlmgr.ln
139 echo "#!$TERMUX_PREFIX/bin/sh" > $TL_BINDIR/tlmgr
140 echo "termux-fix-shebang $TL_ROOT/texmf-dist/scripts/texlive/tlmgr.pl" >> $TL_BINDIR/tlmgr
141 echo "sed -E -i '"'s@`/bin/sh@`'$TERMUX_PREFIX"/bin/sh@g' ${TL_ROOT}/tlpkg/TeXLive/TLUtils.pm" >> $TL_BINDIR/tlmgr
142 echo 'tlmgr.ln "$@"' >> $TL_BINDIR/tlmgr
143 chmod 0744 $TL_BINDIR/tlmgr
144}
145
146termux_step_create_debscripts () {
147 # Clean texlive's folder if needed (run on fresh install)
0b67d3bb
HG
148 echo "#!$TERMUX_PREFIX/bin/sh" > preinst
149 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
dce832a2 150 echo "rm -rf $TERMUX_PREFIX/etc/profile.d/texlive.sh" >> preinst
0b67d3bb 151 echo "rm -rf $TERMUX_PREFIX/opt/texlive/2016" >> preinst
dce832a2 152 # Let's not delete the previous texmf-dist so that people who have installed a full distribution won't need to download everything again
104ad022 153 echo "shopt -s extglob" >> preinst # !(texmf-dist) is an extended glob which is turned off in scripts
dce832a2 154 echo "rm -rf $TERMUX_PREFIX/opt/texlive/2017/!(texmf-dist)" >> preinst
104ad022 155 echo "shopt -u extglob" >> preinst # disable extglob again just in case
dce832a2
HG
156 echo "exit 0" >> preinst
157 chmod 0755 preinst
158}