#!/bin/bash # flex.SlackBuild # by Stuart Winter for the Slackware porting Project. # Heavily based on the original Slackware build script. # 01-Jun-2004 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PACKAGE export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PACKAGE export PKG=$TMP/package-$PACKAGE mkpkgdirs # Delete and re-create temporary directories # Determine the CFLAGS for the known architectures: case $PORTARCH in arm) ARCH_CFLAGS="-O2 -march=armv3 -mtune=xscale" ;; powerpc) ARCH_CFLAGS="-O2 " ;; sparc) ARCH_CFLAGS="-O2" ;; *) ARCH_CFLAGS="-O2" ;; esac # Untar source: tar zxvvf $CWD/$PACKAGE-$VERSION.tar.gz cd $PACKAGE-* slackhousekeeping # Modify flex to work with newer, standards-complient gcc: zcat $CWD/flex-2.5.4a-skel.patch.gz | patch -p1 --verbose zcat $CWD/flex-2.5.4-glibc22.patch.gz | patch -p1 --verbose zcat $CWD/flex-2.5.4a-gcc3.patch.gz | patch -p1 --verbose zcat $CWD/flex-2.5.4a-gcc31.patch.gz | patch -p1 --verbose zcat $CWD/flex-2.5.4a2.patch.gz | patch -p1 --verbose # Install docs: mkdir -p $PKG/usr/doc/$PACKAGE-$VERSION/MISC cp -a INSTALL NEWS README \ $PKG/usr/doc/$PACKAGE-$VERSION ( cd MISC cp -a EBCDIC README alloca.c debflex.awk parse.c parse.h \ testxxLexer.l fastwc \ $PKG/usr/doc/$PACKAGE-$VERSION/MISC ) # Configure: CFLAGS="$ARCH_CFLAGS" \ ./configure \ --prefix=/usr || failconfig # Build: make CFLAGS="$ARCH_CFLAGS" LDFLAGS=-s || failmake # Start fake root server start_fakeroot # Explode the package framework: ( cd $PKG && explodepkg $CWD/_flex.tar.gz ) # Install binaries: install -m755 flex $PKG/usr/bin install -m644 FlexLexer.h $PKG/usr/include install -m644 libfl.a $PKG/usr/lib # Install man pages: install -m644 flex.1 $PKG/usr/man/man1 # Install info pages: cd MISC/texinfo makeinfo flex.texi mkdir -p $PKG/usr/info install -m644 flex.info $PKG/usr/info # Slackware policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # set all files to root.root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh # Build the package: if [ $PORTARCH = arm ]; then . $PORTCWD/arm/pkger else makepkg -l y -c n $PKGSTORE/$PKGSERIES/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz fi # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links