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

# Slackware build script for zork

# Written by B. Watson (yalhcru@gmail.com)

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

# VERSION is the last modification date of this script. The various zcode
# files of course have their own version information, but at this late date
# they aren't going to ever change.

# 20211011 bkw:
# - move executables to /usr/games.
# - new-style icons.
# - man page.
# - reflow readme-*.txt (with fmt -s).

# 20140219 bkw: fix .desktop files so they validate.

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

PRGNAM=zork
VERSION=${VERSION:-20211011}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

ARCH=noarch

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 -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir $PRGNAM-$VERSION
cd $PRGNAM-$VERSION

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION

# zork 1/2/3 are z-code version 3 (z3), uu is z5.
mkdir -p $PKG/usr/share/zcode $PKGDOC/invisiclues
for game in 1 2 3; do
  rm -rf *
  unzip -a -LL $CWD/zork$game.zip
  cat data/zork$game.dat > $PKG/usr/share/zcode/zork$game.z3
  fmt -s readme.txt > $PKGDOC/readme-zork$game.txt
done

rm -rf *
unzip -a -LL $CWD/ztuu.zip
cat ztuu.z5 > $PKG/usr/share/zcode/ztuu.z5
fmt -s readme.txt > $PKGDOC/readme-ztuu.txt
cat invisiclues.txt > $PKGDOC/invisiclues/ztuu.txt
cat invisiclues.html > $PKGDOC/invisiclues/ztuu.html

# ztuu has invisiclues in the zip file, add the clues for 1/2/3 also
cat $CWD/ZorkI.inv > $PKGDOC/invisiclues/zork1.txt
cat $CWD/ZorkII.inv > $PKGDOC/invisiclues/zork2.txt
cat $CWD/ZorkIII.inv > $PKGDOC/invisiclues/zork3.txt

cat $CWD/README.interpreters > $PKGDOC/README.interpreters
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

# Script wrapper and .desktop files written for this SlackBuild
mkdir -p \
  $PKG/usr/share/games/zork \
  $PKG/usr/games \
  $PKG/usr/man/man6 \
  $PKG/usr/share/applications \
  $PKG/usr/share/pixmaps

install -m0755 $CWD/zorkwrapper.sh $PKG/usr/share/games/zork/zorkwrapper.sh
gzip -9c < $CWD/zorkwrapper.sh.6 > $PKG/usr/man/man6/zorkwrapper.sh.6.gz

for game in zork1 zork2 zork3 ztuu; do
  ln -s ../share/games/zork/zorkwrapper.sh $PKG/usr/games/$game
  ln -s zorkwrapper.sh.6.gz $PKG/usr/man/man6/$game.6.gz
  cat $CWD/desktop/$game.desktop > $PKG/usr/share/applications/$game.desktop
done

# zork1 => zork, so we have an exe and a man page matching the package name.
ln -s zorkwrapper.sh.6.gz $PKG/usr/man/man6/$PRGNAM.6.gz
ln -s ../share/games/zork/zorkwrapper.sh $PKG/usr/games/$PRGNAM

# Icons created with mkicons.sh, q.v.
for i in $CWD/icons/*.png; do
  px=$( basename $i | cut -d. -f1 )
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  cat $i > $dir/$PRGNAM.png
done

ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

mkdir -p $PKG/install
sed "s,@VERSION@,$VERSION," $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