#!/bin/bash # tetex.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $ARCH in arm) export SLKCFLAGS="-O2 -march=armv4t" export LIBDIRSUFFIX="" ;; *) export SLKCFLAGS="-O2" ;; esac # Safer to purge this first: rm -rf /usr/share/texmf rm -rf /usr/share/texmf-var rm -rf /usr/share/texi2html # Make a clean new directory: mkdir -p /usr/share/texmf ( cd /usr/share/texmf tar xvvf $CWD/tetex-texmf-$VERSION.tar.xz || exit 1 chown -R root:root . # Change the sell-by date: zcat $CWD/tetex.leet.diff.gz | patch -p1 --verbose || exit 1 find . -type f -perm 666 -exec chmod 644 {} \; ) || exit 1 cd $TMPBUILD tar xvvf $CWD/$PKGNAM-src-$VERSION.tar.xz cd $PKGNAM-src-$VERSION || exit 1 chown -R root:root . find . -type f -perm 666 -exec chmod 644 {} \; # Fix possible xpdf overflows: zcat $CWD/tetex.CVE-2005-3193.diff.gz | patch -p1 --verbose || exit 1 # /var/lib/texmf is a better font location than /var/tmp/texfonts: zcat $CWD/tetex.var.fonts.diff.gz | patch -p1 --verbose || exit 1 # Even better is something in your $HOME directory: zcat $CWD/tetex.fontcachedirinhome.diff.gz | patch -p1 --verbose || exit 1 # Use mkstemp() in dvipdfm: zcat $CWD/tetex.dvipdfm.mkstemp.diff.gz | patch -p1 --verbose || exit 1 # Use mktemp in scripts: zcat $CWD/tetex.scripts.mktemp.diff.gz | patch -p1 --verbose || exit 1 # Try to use more modern browsers. # Attempt to use them in this order: firefox, seamonkey, mozilla, links, lynx. zcat $CWD/tetex.browsers.diff.gz | patch -p1 --verbose || exit 1 # Add bplain and bamstex info to fmtutil.cnf: zcat $CWD/tetex.amstex.fmtutil.diff.gz | patch -p1 --verbose || exit 1 # Don't leave texconfig junk in $TMP: zcat $CWD/tetex.tmp.cleanup.diff.gz | patch -p1 --verbose || exit 1 # Fix the cpascal header so there's no conflict with getline() in the # generated C code: zcat $CWD/tetex.cpascal.getline.posix.2008.diff.gz | patch -p1 --verbose || exit 1 # Patch for libpng-1.4.0: zcat $CWD/tetex.png14.diff.gz | patch -p1 --verbose || exit 1 # Another problem caused by getline() in glibc: zcat $CWD/tetex.afm2tfm.getline.diff.gz | patch -p1 --verbose || exit 1 # Configure: CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr/share/texmf \ --datadir=/usr/share \ --disable-multiplatform \ --disable-a4 \ --without-dialog \ --without-texinfo \ --with-system-ncurses \ --with-system-pnglib \ --with-system-t1lib \ --with-system-tifflib \ --with-system-zlib \ --with-ps=gs \ --enable-ipc \ --enable-freetype \ --with-etex || failconfig # --without-texinfo # Really, it doesn't hurt to include these twice... # This was reported to fix a problem with newer GNU sources and "make dvi". # It does, in fact, fix a bug where the etex binary/engine really should be # used when etex and dvi output are requested, but the example given to me # (which was "make dvi" in GNU binutils) also has some problems that have to # be fixed. This confused me for a good long time. ;-) # BTW, the fix for the binutils docs is to edit bfd.texinfo and remove that # @tex through @end tex section near the top. Then build twice. Hit enter # if it "sticks". zcat $CWD/tetex.etex.diff.gz | patch -p1 --verbose || exit 1 # Build: make all $NUMJOBS || make all || exit 1 # Install: make install strip if ! echo $PATH | grep /usr/share/texmf/bin ; then PATH=$PATH:/usr/share/texmf/bin fi # ... [don't] make links to all binaries in /usr/bin for the final package. # [that would be really pointless... $PATH should work, period. ] # If latex isn't there, maybe we need to do this: if [ ! -r /usr/share/texmf/bin/latex ]; then texconfig init fi # Let's start with these defaults: texconfig confall texconfig dvips paper letter texconfig xdvi paper us # These *might* be useful... # Some are known to be not-so-useful, though, as they put the config files # into /root/.texmf-config, which we're simply going to throw away anyway # so it won't interfere with server testing. If you need these options, # you'll probably have to run texconfig yourself in your own user (or root) # account. texconfig mode ljfour #texconfig xdvi paper a4 texconfig dvips mode ljfour #texconfig dvips paper a4 texconfig dvips printcmd - texconfig dvips add bjc600 texconfig dvips add stcolor texconfig dvips add deskjet texconfig dvips add ljet4 texconfig dvips -P bjc600 mode canonbjc texconfig dvips -P stcolor mode epstylus texconfig dvips -P deskjet mode deskjet texconfig dvips -P ljet4 mode ljfour texconfig font ro texconfig rehash # Add jadetex to the package: . $CWD/jadetex.build # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Toss redundant docs: ( cd /usr/share/texmf/doc for file in `find . -name "*.dvi"` ; do rm -f `dirname $file`/`basename $file .dvi`.pdf done ) # Toss redundant docs: ( cd /usr/share/texmf/doc for file in `find . -name "*.dvi"` ; do rm -f `dirname $file`/`basename $file .dvi`.pdf done ) # Discard local configurations: if [ -e /root/.texmf-config ]; then mv /root/.texmf-config /root/.texmf-config-$(mcookie) echo "/root/.texmf-config moved out of the way... you may wish" echo "to purge any /root/.texmf-config-* directories if the" echo "cruft heap gets too large." fi # Now, package the /usr/share/texmf/ and /usr/share/texi2html trees. # Package tetex-doc.tgz and tetex-bin.tgz seperately. PKG1=$TMP/package-tetex PKG2=$TMP/package-tetex-doc rm -rf $PKG1 $PKG2 mkdir -p $PKG1 $PKG2 mkdir -p $PKG1/usr/share mv /usr/share/texmf $PKG1/usr/share mv /usr/share/texmf-var $PKG1/usr/share mv /usr/share/texi2html $PKG1/usr/share # The tetex.tgz file will need an installation script to add # /usr/share/texmf/bin to the $PATH and /usr/share/texmf/man to the $MANPATH: mkdir -p $PKG1/etc/profile.d cp -a $CWD/profile.d/tetex.* $PKG1/etc/profile.d chown root:root $PKG1/etc/profile.d/tetex.* chmod 755 $PKG1/etc/profile.d/tetex.* # Install package descriptions: mkdir -p $PKG1/install cp $CWD/slack-desc.tetex $PKG1/install/slack-desc mkdir -p $PKG2/install cp $CWD/slack-desc.tetex-doc $PKG2/install/slack-desc # Strip everything: ( cd $PKG1 find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) # Gzip man pages: gzip -9 $PKG1/usr/share/texmf/man/man?/*.? # Fix manpage symlinks: ( cd $PKG1/usr/share/texmf/man for dir in man? ; do ( cd $dir for file in *.? ; do if [ -L $file ]; then LINK=$(readlink $file) rm $file ln -sf ${LINK}.gz ${file}.gz fi done ) done ) # Move some of the files into the docs package: mkdir -p $PKG2/usr/share/texmf/doc mv $PKG1/usr/share/texmf/doc/* $PKG2/usr/share/texmf/doc mkdir -p $PKG2/usr/share/texinfo mv /usr/share/texinfo/html $PKG2/usr/share/texinfo mv $PKG1/usr/share/texmf/info $PKG2/usr ( cd $PKG1/usr/share/texmf ; ln -sf /usr/info . ) # Make docs link in /usr/doc/: mkdir -p $PKG2/usr/doc ( cd $PKG2/usr/doc ; rm -rf $PKGNAM-$VERSION ) ( cd $PKG2/usr/doc ; ln -sf /usr/share/texmf/doc $PKGNAM-$VERSION ) # Set policies for both packages: for i in $PKG1 $PKG2 ; do cd $i # Slackware policies: slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # set all files to root.root, chmod -R og-w, slackchown, slack644docs done # Build Main Tetex package: ( cd $PKG1 && slackmp ) # Build Tetex doc package: ( cd $PKG2 PKGNAM=tetex-doc # so that slackmp wipes the old tetex-doc package, not the "tetex" one we just built! # and now override the package name to be imapd: SLACKPACKAGE=tetex-doc-$VERSION-$ARCH-$BUILD.tgz slackmp ) # Build the packages -- this can be chopped once I've rebuilt and I know # the slackmp stuff above works. #cd $PKG1 #makepkg -l y -c n $PKGSTORE/$PKGSERIES/$PKGNAM-$VERSION-$ARCH-$BUILD.tgz #cd $PKG2 #makepkg -l y -c n $PKGSTORE/$PKGSERIES/$PKGNAM-doc-$VERSION-$ARCH-$BUILD.tgz # End.