slackbuilds_ponce/games/starfighter/starfighter.SlackBuild
Tim Dickson 22ac1a019a
games/starfighter: Updated for version 2.1.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2020-04-10 00:56:10 +07:00

87 lines
2.2 KiB
Bash

#!/bin/sh
# Slackware build script for starfighter
# Written by Tim Dickson dickson.tim at googlemail.com
# changelog
# updated 15/10/2016 for v1.6
# make file now supports destdir and project comes with desktop file and icon
# so separate one not needed.
# doc location still changed to support slackware prefered location
# updated 05/03/2017 for v1.7
# updated 22/07/2019 for v2.0 (2.0.0.3)
# updated 09/04/2020 for v2.1 applied workrounds for compile flag updates
# and change in source tar file.
PRGNAM=starfighter
VERSION=${VERSION:-2.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION-src
#change tar options to remove warning.
tar -xv --warning=no-unknown-keyword -f $CWD/$PRGNAM-$VERSION-src.tar.gz
cd $PRGNAM-$VERSION-src
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
CFLAGS="$SLKFLAGS"
CXXFLAGS="$SLKCFLAGS"
#add extra nowarn option for gcc versions<8
./configure SF_NOWARN=1\
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
# Add the build script to the package docs
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}