#!/bin/sh -x # Heavily based on the Slackware 12.2 SlackBuild # written by Marco Pessotto revision date 11/1/2009 # 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. set -e PRGNAM=toga2 VERSION=141SE_posix ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-mp} CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-$CWD} SUFFISSO=tar.gz PKGNAM=$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" fi rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION rm -rf $PRGNAM tar -xvvf $CWD/$PRGNAM-$VERSION.$SUFFISSO mv src $PRGNAM-$VERSION cd $PRGNAM-$VERSION || exit 1 chmod -R u+w,go+r-w,a-s . if [ "$1" == "test" ]; then echo "Not running as root! It's a test" else chown -R root:root . fi ## there's no configure make \ CXXFLAGS="-pipe $SLKCFLAGS \ -fno-exceptions -fno-rtti -Wall \ -fstrict-aliasing \ -fomit-frame-pointer" ## strip the binaries strip --strip-unneeded $PRGNAM ## install mkdir -p $PKG/usr/games cp $PRGNAM $PKG/usr/games ## adding documentation mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a CHANGELOG COPYING copying.txt LICENSE readme.txt $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild ## add the manpage (thanks to debian) mkdir -p $PKG/usr/man/man6 cp $CWD/$PRGNAM.6.gz $PKG/usr/man/man6 mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc rm -f $OUTPUT/$PKGNAM cd $PKG || exit 1 ## better safe than sorry if [ "$1" == "test" ]; then echo "Not running as root! It's a test" else chown -R root:root . fi requiredbuilder -v -y -s $CWD $PKG /sbin/makepkg -l y -c n $OUTPUT/$PKGNAM if [ "$1" == "test" ]; then echo "Not running as root! Renaming the package" mv $OUTPUT/$PKGNAM $OUTPUT/$PKGNAM-dontinstallme.tgz fi