summaryrefslogtreecommitdiffstats
path: root/games/tkgames/tkgames.SlackBuild
blob: 47f0b3eab450d9a741b6636773877f747a07c082 (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
#!/bin/bash

# Slackware build script for tkgames

# Written by B. Watson (urchlay@slackware.uk)

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

# Note: I'm only packaging the games. The other stuff is:
# - alert, basically xmessage rewritten in tcl/tk.
# - tkexe, a "run command" dialog (we have plenty of those already).
# - mamex and sdlmamex, outdated frontends for outdated MAME ports.
#   modern MAME has its own frontend anyway.
# - the docs mention "Scid vs. PC" and "TkTimidity++", but these aren't
#   in the tarball.
# - also not packaging tksol/tksol_green (same game, different background).

# If I'm being 100% honest, I really only care about tkhearts. There
# aren't a lot of choices for playing Hearts on Linux, unless you want
# to play in a browser and look at ads.

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

PRGNAM=tkgames
VERSION=${VERSION:-1.3}
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
tar xvf $CWD/$PRGNAM-$VERSION.tgz
cd $PRGNAM-$VERSION
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 {} \+

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKG/usr/games $PKG/usr/share/games $PKG/usr/man/man6 $PKGDOC

# cruft and hidden docs.
cp -a tksol/readme $PKGDOC/tksol.txt
cp -a tkhangman/README $PKGDOC/tkhangman.txt
gzip -9c < tksol/tksol.6 > $PKG/usr/man/man6/tksol.6.gz
rm -rf */.menus.swp tksol/{tksol.6,readme,install,tksol_green} \
       tkhangman/{extras,hangman,README,INSTALL}

# tkhearts logs too much to stdout, including spoilers (e.g. if one of
# the AIs decides to shoot the moon). squelch.
sed -i '/^[\t ]*puts  *"/s,^,#,' tkhearts-*

# These are self-contained executables, run from anywhere, no external files.
for i in tkhearts tkspider tktk tktp tkyahtzee; do
  cp -a $i-* $PKG/usr/games/$i
done

# These need external files, and have an install directory.
for i in polypuzzle tkhangman tksol; do
  sed -i 's,/usr/local/lib,/usr/share/games,' $i/$i
  mv $i/$i $PKG/usr/games/$i
  cp -a $i $PKG/usr/share/games/$i
done

# Some icons extracted from the tcl code (where they appear as
# base64'ed gifs), some were already external files. Tweaked them with
# the gimp to look good as 64x64.
mkdir -p $PKG/usr/share/icons/hicolor/64x64/apps $PKG/usr/share/pixmaps
install -oroot -groot -m0644 $CWD/icons/* $PKG/usr/share/icons/hicolor/64x64/apps
for i in $CWD/icons/*; do
  ln -s ../icons/hicolor/64x64/apps/$(basename $i) $PKG/usr/share/pixmaps
done

# .desktop files written for this SlackBuild.
mkdir -p $PKG/usr/share/applications
install -oroot -groot -m0644 $CWD/desktop/*.desktop $PKG/usr/share/applications

cp -a docs/index.{html,txt} docs/images $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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