#!/bin/bash ##SlackBuild style build script CWD=`pwd` NAME=lua VERSION=5.1.2 ARCH=i586 BUILD=1vl59 VL_PACKAGER=kidd if [ "$TMP" = "" ]; then TMP=/tmp fi if [ $UID != 0 ]; then echo "You need to be root to run this script." exit fi if [ ! -x /usr/bin/requiredbuilder ]; then echo "Requiredbuilder not installed, or not executable." exit fi if [ ! -d $TMP/finished-packages ]; then mkdir -p $TMP/finished-packages fi PKG=$TMP/package-$NAME rm -rf $PKG mkdir -p $PKG/usr mkdir $PKG/install if [ "$ARCH" = "i386" ]; then export CFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then export CFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i586" ]; then export CFLAGS="-O2 -march=i586 -mtune=i686" elif [ "$ARCH" = "s390" ]; then export CFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then export CFLAGS="-O2" fi CXXFLAGS="$CFLAGS" cd $TMP rm -rf $NAME-$VERSION tar zxvf $CWD/$NAME-$VERSION.tar.gz || exit 1 cd $NAME-$VERSION chown -R root:root . chmod -R a-s,u+rw,go-w+r . # Apply patch to make it compile the lib into a shared object cat $CWD/$NAME-$VERSION-shared.diff | patch -p1 || exit 1 # Let's use our custom CFLAGS from above sed -i "s/INSTALL_TOP= \/usr\/local/INSTALL_TOP= \/usr/" Makefile || exit 1 make linux cp $CWD/slack-desc . cat >> slack-desc << EOF #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: `awk "/\.\/configure\ /" config.log` EOF make install DESTDIR=$PKG # Let's make sure all of the library symlinks correctly exist ( cd $PKG/usr/lib ln -sf liblua.so.5.1.2 liblua.so ln -sf liblua.so.5.1.2 liblua.so.5 ) ( cd $PKG 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 ) # Remove some empty directories, I can't imagine why these are here. rm -rf $PKG/usr/share $PKG/usr/lib/lua mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a \ AUTHORS COPYING ChangeLog NEWS README TODO \ $PKG/usr/doc/$NAME-$VERSION cp -a doc/*.html doc/logo.gif doc/lua.css $PKG/usr/doc/$NAME-$VERSION/html cp -a etc test $PKG/usr/doc/$NAME-$VERSION/extras cp slack-desc $PKG/install cd $PKG requiredbuilder -v -y . makepkg -p -l y -c n $NAME-$VERSION-$ARCH-$BUILD.tlz cp $NAME-$VERSION-$ARCH-$BUILD.tlz $TMP/finished-packages echo "$NAME-$VERSION package is in $TMP/finished-packages" rm -rf $TMP/$NAME-$VERSION rm -rf $PKG