summaryrefslogtreecommitdiff
path: root/portsToCome/texlive/Pkgfile
blob: e4e314fc1b5362681c9c2f28f9a7ab01aa86e212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Description: TeX distribution for UNIX compatible systems.
# URL:         http://www.tug.org/tetex/
# Maintainer:  Erich Eckner, crux at eckner dot net
# Contributor: John Vogel, jvogel4 at stny dot rr dot com
# Depends on:  clisp ghostscript icu libgd libmpfr poppler xorg-libxaw xorg-libxi zziplib

name=texlive
version=20190410
release=1
source=(ftp://tug.org/historic/systems/texlive/${version:0:4}/$name-$version-texmf.tar.xz
        ftp://tug.org/historic/systems/texlive/${version:0:4}/$name-$version-source.tar.xz
        http://download.savannah.gnu.org/releases/texi2html/texi2html-5.0.tar.bz2
        support-system-poppler-0.76.-01.patch
        reinstate-setting-HAVE_LIBGS-for-non-TL-builds.patch)

build() {
  # remove broken symlinks
  # -exec rm '{}' \+ was a tip I got from romster, it will batch to rm and perform better on large quantities
  find $SRC -type l -xtype l -exec rm '{}' \+

  cd $name-$version-source

  chmod -R a-s $SRC

  find $SRC \
    \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
    -exec chmod 755 {} \; -o \
    \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
    -exec chmod 644 {} \;

  # fix build with poppler >= 0.76 (upstream patch, cherry-picked from git-svn)
  patch -Np1 -i $SRC/support-system-poppler-0.76.-01.patch
  cp -pv texk/web2c/pdftexdir/pdftoepdf{-poppler0.76.0,}.cc
  cp -pv texk/web2c/pdftexdir/pdftosrc{-poppler0.76.0,}.cc
  # fix libgs linking issue with dvisvgm (upstream patch, cherry-picked from git-svn)
  patch -Np1 -i $SRC/reinstate-setting-HAVE_LIBGS-for-non-TL-builds.patch

  # Fix some paths
  sed -i 's/SELFAUTOPARENT/TEXMFROOT/' texk/tex4htk/t4ht.c
  sed -i 's|TEXMFROOT = .*|TEXMFROOT = $SELFAUTODIR/share|g' texk/kpathsea/texmf.cnf
  sed -i 's|TEXMFLOCAL = .*|TEXMFLOCAL = $TEXMFROOT/texmf-local|g' texk/kpathsea/texmf.cnf
  # taken from archs texlive-bin PKGBUILD
  # https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/texlive-bin
  # line 116
  find utils/xindy -name Makefile -exec sed -i -e "s|^prefix =.\+$|prefix = $pkgdir/usr|" \
    -e "s|^mandir =.\+$|mandir = \${prefix}/share/man|" -e "s|^datadir =.\+$|datadir = \${datarootdir}/texmf|" \
    -e "s|^docdir =.\+$|docdir = \${datadir}/doc/xindy|" '{}' \;

  export TEXMFCNF=""
  export KPATHSEA_WARNING=0

  mkdir build
  cd build

  # consider disabling parts that conflict with other ports, like psutils
  # some options included seem to be the default, remove them?
  #  (--disable-multiplatform, enable-largefile, ...)
  # what is required to enable xindy? is it worth the trouble?
  # # no idea about xindy, never really needed it until now and I am not sure what the benefits are.
  # # I have to say though that I like to keep this beast at least a bit slim .footprint-wise, so if it's not needed right now, I wouldn't bother
  # # I went ahead and tried to cluster everything to make it a bit more readable
  # # also I attempt to provide a working xindy and luatex env
  ../configure \
    --prefix=/usr \
    --with-banner-add=" $(crux)" \
    --with-clisp-runtime=system \
    --enable-{libtool-hack,luatex,shared,xindy} \
    --with-system-{cairo,freetype2,gd,gmp,icu,libpng,mpfr,ncurses,pixman,poppler,t1lib,xpdf,zlib,zziplib} \
    --with-x \
    --with-xdvi-x-toolkit=xaw \
    --disable-{bibtexu,debug,dialog,missing,native-texlive-build,psutils,static,xindy-doc,xindy-rules}

  make
  make DESTDIR=$PKG install

  cd ..

  perl_sitelib=$(perl -V:sitelib | sed -e "s|sitelib=[']\(.*\)['].*$|\1|")
  install -d $PKG/$perl_sitelib/TeXLive
  install texk/tests/TeXLive/TL{Config,Utils}.pm $PKG/$perl_sitelib/TeXLive

  # Create symlinks
  PATH="$PKG/usr/bin:$PATH" LD_LIBRARY_PATH+="$PKG/usr/lib:$LD_LIBRARY_PATH" \
    texlinks -f $PKG/usr/share/texmf-dist/web2c/fmtutil.cnf $PKG/usr/bin

  cd $SRC/$name-$version-texmf

  # Fix some paths
  sed -i 's|TEXMFROOT = .*|TEXMFROOT = $SELFAUTODIR/share|g'  texmf-dist/web2c/texmf.cnf
  sed -i 's|TEXMFLOCAL = .*|TEXMFLOCAL = $TEXMFROOT/texmf-local|g'  texmf-dist/web2c/texmf.cnf

  mv $PKG/usr/share/texmf-dist $PKG/usr/share/texmf-dist.tmp
  mv texmf-dist $PKG/usr/share

  # sub-optimal but better than copying texmf-dist!
  cp -a $PKG/usr/share/texmf-dist.tmp/* $PKG/usr/share/texmf-dist
  rm -r $PKG/usr/share/texmf-dist.tmp

  cd $SRC/texi2html-*

  ./configure --prefix=/usr

  make
  make install DESTDIR=$PKG

  rm -r $PKG/usr/share/{info,locale,texmf-dist/doc}
  rm -r $PKG/usr/bin/tlmgr
  rm -r $PKG/usr/share/texmf-dist/scripts/texlive/tlmgr{,gui}.pl
  find  $PKG/usr/share/texmf-dist \
    -regex '.*/\(COPYING\|README\|AUTHORS\|INSTALL\|ChangeLog\|NEWS\|TODO\).*' \
    -exec rm '{}' \+
}