texlive: fix installation issues and reported shebang issue (#957)
[termux-packages] / packages / texlive / termux-install-tl.sh
1
2 TL_VERSION=2016
3 TL_ROOT=$PREFIX/opt/texlive
4
5 export TMPDIR=$PREFIX/tmp/
6 mkdir -p $TMPDIR/termux-tl-installer
7 cd $TMPDIR/termux-tl-installer
8
9 wget http://mirror.ctan.org/systems/texlive/Source/install-tl-unx.tar.gz -O install-tl-unx.tar.gz
10 tar xzfv install-tl-unx.tar.gz > flist
11
12 cd $(head -1 flist)
13
14 #patch install-tl
15 sed -E -i "s@/bin/sh@$PREFIX/bin/sh@" tlpkg/TeXLive/TLUtils.pm
16
17 cat > texlive_inst.profile << XXHEREXX
18
19 selected_scheme scheme-custom
20 TEXDIR ${TL_ROOT}/${TL_VERSION}
21 TEXMFCONFIG ~/.texlive${TL_VERSION}/texmf-config
22 TEXMFHOME ~/texmf
23 TEXMFLOCAL ${TL_ROOT}/texmf-local
24 TEXMFSYSCONFIG ${TL_ROOT}/${TL_VERSION}/texmf-config
25 TEXMFSYSVAR ${TL_ROOT}/${TL_VERSION}/texmf-var
26 TEXMFVAR ~/.texlive${TL_VERSION}/texmf-var
27 collection-basic 1
28 collection-latex 1
29 collection-luatex 1
30 in_place 0
31 option_adjustrepo 1
32 option_autobackup 1
33 option_backupdir tlpkg/backups
34 option_desktop_integration 0
35 option_doc 0
36 option_file_assocs 0
37 option_fmt 1
38 option_letter 0
39 option_menu_integration 1
40 option_path 0
41 option_post_code 1
42 option_src 0
43 option_sys_bin $PREFIX/bin
44 option_sys_info $PREFIX/local/share/info
45 option_sys_man $PREFIX/local/share/man
46 option_w32_multi_user 0
47 option_write18_restricted 1
48 portable 0
49
50 XXHEREXX
51
52 #start installer with a profile and premade binaries
53 perl ./install-tl --custom-bin=$TL_ROOT/${TL_VERSION}/bin/pkg --profile texlive_inst.profile
54
55 mkdir -p $PREFIX/etc/profile.d/
56
57 cat > $PREFIX/etc/profile.d/texlive.sh << XXHEREXX
58 export PATH=\$PATH:$TL_ROOT/${TL_VERSION}/bin/custom
59 export TMPDIR=$PREFIX/tmp/
60 XXHEREXX
61
62 #fix tlpkg
63 sed -E -i "s@/bin/sh@$PREFIX/bin/sh@" ${TL_ROOT}/${TL_VERSION}/tlpkg/TeXLive/TLUtils.pm
64
65 #fix shebangs
66 sed -i -E "1 s@^#\!(.*)/[sx]?bin/(.*)@#\!$PREFIX/bin/\2@" ${TL_ROOT}/${TL_VERSION}/texmf-dist/web2c/*
67 sed -i -E "1 s@^#\!(.*)/[sx]?bin/(.*)@#\!$PREFIX/bin/\2@" ${TL_ROOT}/${TL_VERSION}/bin/custom/*
68
69 #source the environment
70 . $PREFIX/etc/profile.d/texlive.sh
71
72 #setup links
73 texlinks
74
75 rm -rf $TMPDIR/termux-tl-installer