154 lines
4.9 KiB
Bash
154 lines
4.9 KiB
Bash
#!/bin/sh
|
|
|
|
# Slackware build script for skulltag
|
|
|
|
# Written by B. Watson (yalhcru@gmail.com)
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
PRGNAM=skulltag
|
|
VERSION=${VERSION:-098d}
|
|
BUILD=${BUILD:-2}
|
|
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
|
|
LIBDIRSUFFIX=""
|
|
TARARCH=x86
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
LIBDIRSUFFIX=""
|
|
TARARCH=x86
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
LIBDIRSUFFIX="64"
|
|
TARARCH=x86_64
|
|
else
|
|
echo "Unsupported ARCH '$ARCH'. Supported ARCH values are 'i586' 'i686' 'x86_64'"
|
|
exit 1
|
|
fi
|
|
|
|
set -e
|
|
|
|
# This is closed-source software. 3 tarballs here:
|
|
# BASE: platform-independent data, mostly goes in usr/share/skulltag
|
|
# GAME: game binary + a couple of shared libs.
|
|
# FMOD: old version of shared lib required for the game bin. The fmodapi
|
|
# from SBo can't be used because it's too new. Note that our default
|
|
# skulltag.ini has fmodapi *disabled* (in favor of emulated OPL), and
|
|
# enabling fmodapi from the in-game menus doesn't work (no music heard).
|
|
# This fmodapi shared lib exists *just* to make the damn game runnable.
|
|
|
|
BASE=$CWD/st-v${VERSION}_linux-base.tar.bz2
|
|
GAME=$CWD/st-v${VERSION}_linux-$TARARCH.tar.bz2
|
|
FMOD=$CWD/fmodapi42416linux$LIBDIRSUFFIX.tar.gz
|
|
|
|
# The shared libs will all be installed in usr/lib$LIBDIRSUFFIX/skulltag/
|
|
# so as not to interfere with the system lib dir. The game binary will also go
|
|
# there, with a wrapper script to set LD_LIBRARY_PATH.
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
cd $TMP
|
|
rm -rf $PRGNAM-$VERSION
|
|
mkdir -p $PRGNAM-$VERSION
|
|
cd $PRGNAM-$VERSION
|
|
tar xvf $BASE
|
|
tar xvf $GAME
|
|
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 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
mkdir -p \
|
|
$PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM \
|
|
$PKG/usr/bin \
|
|
$PKG/usr/share/$PRGNAM \
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
mv $PRGNAM $PRGNAM-server *.so $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM
|
|
install -m0644 *.pk3 $PKG/usr/share/$PRGNAM
|
|
install -m0644 *.txt $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
# The announcer and skins stuff seems like it ought to go in
|
|
# /usr/share/$PRGNAM (same as the .pk3 files), but strace shows
|
|
# that it looks in /usr/lib$LIBDIRSUFFIX/$PRGNAM, and I can't find
|
|
# a way to change it in the config file.
|
|
chmod 0644 announcer/* skins/*
|
|
cp -a announcer skins $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM
|
|
|
|
mkdir fmod
|
|
cd fmod
|
|
tar xvf $FMOD
|
|
install -m0755 \
|
|
fmodapi*/api/lib*/libfmodex$LIBDIRSUFFIX-*.so \
|
|
$PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM
|
|
|
|
sed "s,@LIB@,lib$LIBDIRSUFFIX,g" < $CWD/$PRGNAM.sh > $PKG/usr/bin/$PRGNAM
|
|
chmod 755 $PKG/usr/bin/$PRGNAM
|
|
ln -s $PRGNAM $PKG/usr/bin/$PRGNAM-server
|
|
|
|
# The included ini file changes the following program defaults:
|
|
|
|
# - Sets the skulltag master server to master.skulltag.net (this is the
|
|
# correct skullag_masterip since October 2011).
|
|
|
|
# - Sets the savegame path to ~/.skulltag. The default savegame path in
|
|
# the skulltag binary is ~.skulltag (missing the slash), which creates
|
|
# savegames in a subdirectory of the current dir (confusing for us
|
|
# CLI users). This issue has been fixed upstream in the current
|
|
# dev snapshot.
|
|
|
|
# - Searches for wads and other files in /usr/share/skulltag (since
|
|
# that's where this package installs skulltag's .pk3 data) and
|
|
# /usr/share/games/doom (for compatibility with existing SBo zdoom
|
|
# package)
|
|
|
|
# - Disables FMOD audio (use emulated OPL instead, since FMOD doesn't seem
|
|
# to actually work)
|
|
|
|
# - Uses ALSA instead of OSS as the default audio output device. OSS has been
|
|
# deprecated for maybe 10 years now, it's beyond me why app developers
|
|
# continue to make it the default.
|
|
|
|
# The wrapper script will copy the default .ini to ~/.skulltag/skulltag.ini
|
|
# if it doesn't already exist.
|
|
|
|
cat $CWD/$PRGNAM.ini > $PKG/usr/share/$PRGNAM/$PRGNAM.ini.default
|
|
|
|
# The program ships with no useful documentation. Users are expected to use
|
|
# the wiki, so let's give the user the URL.
|
|
cat $CWD/README_docs.txt > $PKG/usr/doc/$PRGNAM-$VERSION/README_docs.txt
|
|
|
|
# PNG icon converted from a GIF on skulltag.com
|
|
mkdir -p $PKG/usr/share/pixmaps
|
|
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
|
|
|
|
# .desktop is a modified copy of zdoom.desktop
|
|
mkdir -p $PKG/usr/share/applications
|
|
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
mkdir -p $PKG/usr/share/applications
|
|
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
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}
|