#!/bin/bash shopt -s extglob ulimit -s unlimited # texlive.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for Slackware ARM. # # Copyright 2009, 2017 Patrick J. Volkerding, Sebeka, MN, USA # Copyright 2009-2014 Robby Workman, Northport, AL, USA # Copyright 2016-2017 Johannes Schoepfer, Germany # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD case $ARCH in arm|aarch64) SLKLDFLAGS="-Wl,-z,relro" ;; esac # To save on maintenance, and since we carry the same versions as x86 Slackware, # let's pull the version numbers from the x86 trunk: XSB=$CWD/$PKGNAM.SlackBuild [ ! -x $XSB ] && { echo "ERROR: Cannot find x86 SlackBuild for ${PKGNAM}!" ; exit 1; } for upstreamvar in \ TEXMFVERSION \ ; do eval $( egrep "^${upstreamvar}=" $XSB ) echo "Upstream variable: ${upstreamvar} version $( eval $( echo "echo \$${upstreamvar}" ) )" done # Extract source: tar xvvf $CWD/$PKGNAM-*source.tar.!(*sign|*asc|*sig) cd $PKGNAM*/ || exit 1 slackhousekeeping # Apply patches: cat $CWD/patches/fixes-210420.patch | patch -p1 --verbose || exit 1 # Define a few new symbols since the Slackware 15.0 release: zcat $CWD/texlive.unicode5.0.diff.gz | patch -p1 --verbose || exit 1 # Configure: mkdir build pushd build CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ LDFLAGS="$SLKLDFLAGS" \ ../configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ --docdir=/usr/doc/$PKGNAM-$VERSION \ --infodir=/usr/info \ --with-banner-add=' on Slackware' \ --disable-native-texlive-build \ --enable-largefile \ --enable-shared \ --disable-static \ --disable-missing \ --disable-multiplatform \ --disable-debug \ --disable-dialog \ --disable-xz \ --with-x \ --disable-dvisvgm \ --enable-xindy \ --disable-xindy-docs \ --disable-xindy-rules \ --with-clisp-runtime=system \ --enable-gc=system \ --with-system-zlib \ --with-system-libpng \ --with-system-t1lib \ --with-system-gd \ --with-system-freetype2 \ --with-system-libgs \ --with-system-icu \ --with-system-pixman \ --with-system-cairo \ --with-system-gmp \ --with-system-mpfr \ --with-system-fontconfig \ --with-system-ncurses \ --with-system-harfbuzz \ --disable-linked-scripts \ --host=${SLK_ARCH_HOST} \ --build=${SLK_ARCH_BUILD} || failconfig # Build: make $NUMJOBS || make || failmake # This failes on the 'mendex' test - it includes some of the Slackware ARM build # system scripts into the logs.. no idea. #make check || failmake # Install into package framework: make install-strip DESTDIR=$PKG || failinstall popd TEXMFROOT=/usr/share # Remove all files which are covered by tlnet rm -rf $PKG$TEXMFROOT $PKG/usr/man $PKG/usr/info # install the tlnet stuff mkdir -p $PKG$TEXMFROOT tar xvf $CWD/texlive-base-$TEXMFVERSION.tar.xz -C $PKG$TEXMFROOT || exit 1 chown -R root:root $PKG chmod -R u+w,go-w,a+rX-st $PKG # use symlinks/scripts from tlnet mv $PKG$TEXMFROOT/texmf-dist/linked_scripts/* $PKG/usr/bin rmdir $PKG$TEXMFROOT/texmf-dist/linked_scripts # Remove this if it's a dangling symlink: if file $PKG/usr/bin/texdoctk | grep -wq "broken symbolic link" ; then rm -f $PKG/usr/bin/texdoctk fi # xindy expects to be executed within $TEXMFROOT/texmf-dist/scripts ln -vsf $TEXMFROOT/texmf-dist/scripts/xindy/xindy.pl $PKG/usr/bin/xindy # set some paths sed -i \ -e "s|^TEXMFROOT.*|TEXMFROOT = $TEXMFROOT|" \ -e "s|^TEXMFLOCAL.*|TEXMFLOCAL = \$TEXMFROOT/texmf-local|" \ -e "s|^OSFONTDIR.*|OSFONTDIR = ~/.fonts:/usr/share/fonts|" \ $PKG$TEXMFROOT/texmf-dist/web2c/texmf.cnf # disable obsolete aleph/lamed/cslatex/pdfcslatex sed -i \ -e 's|^aleph|#! aleph|' \ -e 's|^lamed|#! lamed|' \ -e 's|^cslatex|#! cslatex|' \ -e 's|^pdfcslatex|#! pdfcslatex|' \ $PKG$TEXMFROOT/texmf-dist/web2c/fmtutil.cnf # make ConTeXt work: sed -i \ -e "s|selfautoparent:|$TEXMFROOT/|g" \ -e "s|\(TEXMFLOCAL[ ]*=[ ]*\)[^,]*|\1\"$TEXMFROOT/texmf-local\"|" \ $PKG$TEXMFROOT/texmf-dist/web2c/texmfcnf.lua # provide texlive fonts optionally for other system apps mkdir -p $PKG/etc/fonts/conf.avail cat > $PKG/etc/fonts/conf.avail/09-texlive.conf << EOF $TEXMFROOT/texmf-dist/fonts/opentype $TEXMFROOT/texmf-dist/fonts/truetype EOF # Install the docs while we're still here mkdir -p $PKG/usr/doc/texlive-$VERSION cp -a ChangeLog README* $PKG/usr/doc/texlive-$VERSION # Install index of provided tex packages to the docs mv -fv $PKG$TEXMFROOT/texmf-dist/packages.base.gz $PKG/usr/doc/texlive-$VERSION # Put a symlink to $TEXMFROOT/texmf-dist/doc in our Slackware docdir ln -vsf $TEXMFROOT/texmf-dist/doc $PKG/usr/doc/texlive-$VERSION/doc # We won't make tlmgr easily available; it's still there, but # we'll make it harder to void the warranty :-) rm -f $PKG/usr/bin/tlmgr install -vpm644 $CWD/README.tlpkg $PKG/usr/doc/texlive-$VERSION/ # Create some directories to make it clear that they're owned by this package mkdir -vpm755 $PKG$TEXMFROOT/{texmf-config,texmf-var,texmf-local} # Add texlive perl modules mkdir -p $PKG/usr/share/perl5 mv -fv $PKG$TEXMFROOT/texmf-dist/scripts/texlive/TeXLive $PKG/usr/share/perl5/ # Move manual pages to the correct place mkdir $PKG/usr/man mv -fv $PKG$TEXMFROOT/texmf-dist/doc/man/man1 $PKG/usr/man mv -fv $PKG$TEXMFROOT/texmf-dist/doc/man/man5 $PKG/usr/man rmdir $PKG$TEXMFROOT/texmf-dist/doc/man # Handle the GNU info pages mv -fv $PKG$TEXMFROOT/texmf-dist/doc/info $PKG/usr # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slack_delete_lafiles # delete usr/lib{,64}/*.la slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # set standard Slackware file/dir permissions and ownerships slackdesc # install slack-desc and doinst.sh # ARM note: Note that the doinst.sh will have been placed by "slackdesc" above, but we'll overwrite # it below. # # Don't demand a global lock when running the install script: echo "# This install script should not collide with any other script's activities," > $PKG/install/doinst.sh echo "# so don't demand a lock by installpkg: NOLOCK" >> $PKG/install/doinst.sh zcat $CWD/doinst.sh.gz >> $PKG/install/doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links