summaryrefslogtreecommitdiff
path: root/games/typhoon_2001/typhoon_2001.SlackBuild
blob: c9cc7765c50595b9ce96d9ba8d4f02a4efbf4d88 (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
#!/bin/bash

# SlackBuild script for Typhoon 2001
# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# This game is binary only and works like a DOS game (it expects to
# be run from its own directory), so for system-wide installation it
# needs a symlink forest in the user's home directory... except the
# typhoon.cfg needs to be a real file and be writable by the user.
# (it will be created the first time the game is run).

# 20211216 bkw: BUILD=3
# - make sound work OOTB: run binary with aoss wrapper.

# 20211012 bkw: BUILD=2
# - binary in /usr/games.
# - new-style icons.
# - fix typo in README and slack-desc.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=typhoon_2001
VERSION=${VERSION:-r3992}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

# this used to check for unsupported ARCH and exit the script, but
# it's perfectly cromulent to want to build a 32-bit package on x86_64,
# so the check is gone and the ARCH is hardcoded.
ARCH=i586

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -fr $TMP/$PRGNAM $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $TMP $PKG $OUTPUT

# Grr. tarball doesn't contain a top-level dir, it pollutes the
# current dir...
mkdir $TMP/$PRGNAM
cd $TMP/$PRGNAM
tar xvf $CWD/${PRGNAM}_$VERSION.tar.gz

# Don't trust the ownership/permissions...
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
chmod 755 typhoon

# OK, put everything where it goes in a proper Slack package...
mkdir -p $PKG/usr/share/games/$PRGNAM \
         $PKG/usr/libexec \
         $PKG/usr/doc/$PRGNAM-$VERSION \
         $PKG/install \
         $PKG/usr/games

cp -a readme_linux.txt $PKG/usr/doc/$PRGNAM-$VERSION
cp -a typhoon $PKG/usr/libexec
cp -a game *.mod *.dat $PKG/usr/share/games/$PRGNAM

install -m 0755 $CWD/$PRGNAM $PKG/usr/games/$PRGNAM

mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

# Icon extracted from the windows .exe with wrestool, converted with icotool
mkdir -p $PKG/usr/share/pixmaps \
         $PKG/usr/share/icons/hicolor/32x32/apps
cat $CWD/$PRGNAM.png > $PKG/usr/share/icons/hicolor/32x32/apps/$PRGNAM.png
ln -s ../icons/hicolor/32x32/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

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