2011-12-18 13:12:54 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-12-18 22:59:11 +01:00
|
|
|
# Slackware build script for yamagi-quake2
|
|
|
|
|
|
|
|
# Copyright 2012 Dugan Chen Canada
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# 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.
|
2011-12-18 13:12:54 +01:00
|
|
|
|
|
|
|
# Includes components from the Arch Linux AUR builds.
|
|
|
|
|
|
|
|
PRGNAM=yamagi-quake2
|
2014-01-14 17:04:50 +01:00
|
|
|
VERSION=${VERSION:-5.21}
|
2013-06-04 03:49:58 +02:00
|
|
|
BUILD=${BUILD:-1}
|
2011-12-18 13:12:54 +01:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2013-01-02 21:46:51 +01:00
|
|
|
CTFVER=${CTFVER:-1.02}
|
2013-06-04 03:49:58 +02:00
|
|
|
XATRIXVER=${XATRIXVER:-2.00}
|
2013-01-02 21:46:51 +01:00
|
|
|
ROGUEVER=${ROGUEVER:-1.07}
|
2011-12-18 13:12:54 +01:00
|
|
|
|
2014-01-14 17:04:50 +01:00
|
|
|
WITH_SDL2=${WITH_SDL2:-no}
|
|
|
|
WITH_OPENAL=${WITH_OPENAL:-no}
|
|
|
|
|
2011-12-18 13:12:54 +01:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -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
|
|
|
|
|
2012-05-01 17:57:30 +02:00
|
|
|
set -e
|
2011-12-18 13:12:54 +01:00
|
|
|
|
2011-12-23 11:52:17 +01:00
|
|
|
rm -rf $PKG $TMP/{quake2-$VERSION,ctf-$CTFVER,quake2-xatrix-$XATRIXVER,quake2-rogue-$ROGUEVER}
|
2011-12-18 13:12:54 +01:00
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
|
|
|
|
# Quake 2
|
|
|
|
|
|
|
|
cd $TMP
|
2011-12-23 11:52:17 +01:00
|
|
|
tar xvf $CWD/quake2-$VERSION.tar.xz
|
2011-12-18 13:12:54 +01:00
|
|
|
cd quake2-$VERSION
|
|
|
|
|
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2011-12-18 13:12:54 +01:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
2014-01-14 17:04:50 +01:00
|
|
|
make WITH_SDL2=$WITH_SDL2 WITH_OPENAL=$WITH_OPENAL
|
2011-12-18 13:12:54 +01:00
|
|
|
|
2011-12-23 11:52:17 +01:00
|
|
|
mkdir -p $PKG/usr/{bin,share/quake2/{ctf,xatrix,rogue}}
|
2011-12-18 13:12:54 +01:00
|
|
|
cp -r release/* $PKG/usr/share/quake2
|
2012-02-20 08:30:01 +01:00
|
|
|
mkdir -p $PKG/usr/share/quake2/baseq2
|
|
|
|
cp stuff/yq2.cfg $PKG/usr/share/quake2/baseq2
|
|
|
|
mkdir -p $PKG/usr/share/pixmaps
|
2012-12-18 22:59:11 +01:00
|
|
|
cp stuff/icon/Quake2.png $PKG/usr/share/pixmaps
|
2011-12-18 13:12:54 +01:00
|
|
|
install -D -m 755 $CWD/quake2.sh $PKG/usr/bin/quake2
|
2012-02-20 08:30:01 +01:00
|
|
|
mkdir -p $PKG/usr/share/applications
|
|
|
|
cat $CWD/quake2.desktop > $PKG/usr/share/applications/quake2.desktop
|
2011-12-18 13:12:54 +01:00
|
|
|
|
2011-12-23 11:52:17 +01:00
|
|
|
# CTF Support
|
|
|
|
|
|
|
|
cd $TMP
|
|
|
|
tar xvf $CWD/quake2-ctf-$CTFVER.tar.xz
|
2012-12-18 22:59:11 +01:00
|
|
|
cd quake2-ctf-$CTFVER
|
2011-12-23 11:52:17 +01:00
|
|
|
|
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2011-12-23 11:52:17 +01:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
make
|
|
|
|
cp -r release/* $PKG/usr/share/quake2/ctf
|
|
|
|
install -D -m 755 $CWD/ctf.sh $PKG/usr/bin/ctf
|
|
|
|
|
2011-12-18 13:12:54 +01:00
|
|
|
# Mission Pack 1 support
|
|
|
|
|
|
|
|
cd $TMP
|
2012-02-20 08:30:01 +01:00
|
|
|
tar xvf $CWD/quake2-xatrix-$XATRIXVER.tar.xz
|
2011-12-18 13:12:54 +01:00
|
|
|
cd quake2-xatrix-$XATRIXVER
|
|
|
|
|
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2011-12-18 13:12:54 +01:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
make
|
|
|
|
cp -r release/* $PKG/usr/share/quake2/xatrix
|
|
|
|
install -D -m 755 $CWD/xatrix.sh $PKG/usr/bin/xatrix
|
|
|
|
|
|
|
|
# Mission Pack 2 support
|
|
|
|
|
|
|
|
cd $TMP
|
2012-02-20 08:30:01 +01:00
|
|
|
tar xvf $CWD/quake2-rogue-$ROGUEVER.tar.xz
|
2011-12-18 13:12:54 +01:00
|
|
|
cd quake2-rogue-$ROGUEVER
|
|
|
|
|
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2011-12-18 13:12:54 +01:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
make
|
|
|
|
cp -r release/* $PKG/usr/share/quake2/rogue
|
|
|
|
install -D -m 755 $CWD/rogue.sh $PKG/usr/bin/rogue
|
|
|
|
|
|
|
|
find $PKG/usr/share/quake2 -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
|
|
|
# Documentation
|
|
|
|
|
2011-12-23 11:52:17 +01:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/{ctf-$CTFVER,quake2-xatrix-$XATRIXVER,quake2-rogue-$ROGUEVER}
|
2011-12-18 13:12:54 +01:00
|
|
|
|
|
|
|
cd $TMP
|
|
|
|
|
|
|
|
cp -a \
|
2013-02-09 19:35:42 +01:00
|
|
|
quake2-$VERSION/{CHANGELOG,CONTRIBUTE,LICENSE,README,stuff/yq2.cfg} \
|
2011-12-18 13:12:54 +01:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
|
|
|
|
cp -a \
|
2012-12-18 22:59:11 +01:00
|
|
|
quake2-ctf-$CTFVER/{CHANGELOG,LICENSE,README} \
|
2011-12-23 11:52:17 +01:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION/ctf-$CTFVER
|
|
|
|
|
|
|
|
cp -a \
|
2012-12-18 22:59:11 +01:00
|
|
|
quake2-xatrix-$XATRIXVER/{CHANGELOG,LICENSE,README} \
|
2011-12-18 13:12:54 +01:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION/quake2-xatrix-$XATRIXVER
|
|
|
|
|
|
|
|
cp -a \
|
2012-12-18 22:59:11 +01:00
|
|
|
quake2-rogue-$ROGUEVER/{CHANGELOG,LICENSE,README} \
|
2011-12-18 13:12:54 +01:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION/quake2-rogue-$ROGUEVER
|
|
|
|
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
2012-02-20 08:30:01 +01:00
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
2011-12-18 13:12:54 +01:00
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|