#!/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 SPRGNAM=Phalanx PRGNAM=phalanx VERSION=XXII 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=$(echo $PRGNAM | tr "A-Z" "a-z")-$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/$SPRGNAM-$VERSION.$SUFFISSO cd $SPRGNAM-$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 ## apply a patch from the scid distribution scid.sourceforge.net by ## Pascal Georges zcat $CWD/setboard.patch.gz | patch -p1 --verbose ## setting the defines zcat $CWD/defines.patch.gz | patch -p0 --verbose ## compile make CFLAGS="$SLKCFLAGS -Wall -fomit-frame-pointer --std=gnu89 -D_GNU_SOURCE" ## strip the binaries strip --strip-unneeded phalanx ## install mkdir -p $PKG/usr/games mkdir -p $PKG/usr/share/games/phalanx mkdir -p $PKG/var/games/phalanx cp phalanx $PKG/usr/games cp $CWD/xphalanx $PKG/usr/games cp eco.phalanx pbook.phalanx sbook.phalanx $PKG/usr/share/games/phalanx cp learn.phalanx $PKG/var/games/phalanx/ chmod 777 $PKG/var/games/phalanx/ chmod 666 $PKG/var/games/phalanx/learn.phalanx ## adding documentation mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a COPYING HISTORY README $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/phalanx.6.gz $CWD/xphalanx.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-doninstallme.tgz fi