summaryrefslogtreecommitdiff
path: root/games/skulltag/skulltag.SlackBuild
blob: 428e898e107a04561bd8c1d88731913ca83dfd8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/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:-1}
TAG=${TAG:-_SBo}

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
  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 'i486' '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 . \
 \( -perm 777 -o -perm 775 -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}