aboutsummaryrefslogtreecommitdiff
path: root/games/icebreaker/icebreaker.SlackBuild
blob: c9c939155b8e36cd6ebbc4b079080a81658093b3 (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
#!/bin/bash

# Slackware build script for icebreaker

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

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

# 20230107 bkw: Updated for v2.2.1! After 20+ years, the author came
# back to this game and released a new version.

# 20170703 bkw: Updated for v1.9.7, the last beta, with theme support.
# Development on this game stopped in 2002, so there will never be a 2.0
# release. If anyone finds bugs in 1.9.7, let me know.

# 20211019 bkw: BUILD=3
# - move high score file to /var/games/icebreaker, to match other
#   games on SBo.
# - include README.themes in doc dir.
# - new-style icons.

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

PRGNAM=icebreaker
VERSION=${VERSION:-2.2.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

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}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
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 {} \+

# 20230107 bkw: on Slackware 15.0, -Werror doesn't hurt anything, but
# get rid of it anyway for future-proofing.
sed -i 's,-Werror,,' Makefile

# 20230107 bkw: 2.x has no system-wide high scores (it's per-user only)
# but the man page hasn't been updated to tell us that.
sed -i -e 's,$HIGHSCOREDIR,~/.icebreaker/,' \
       -e 's,system-wide,per-user,' \
       $PRGNAM.man.in

# 20230107 bkw: need this to allow the game to create the high score
# file if it doesn't already exist. Also give it sane permissions.
sed -i 's/O_RDWR/O_RDWR|O_CREAT,0644/' lock.c

make \
  prefix=/usr \
  mandir=/usr/man \
  bindir=/usr/games \
  OPTIMIZE="$SLKCFLAGS"

strip $PRGNAM

make -j1 install \
  prefix=$PKG/usr \
  mandir=$PKG/usr/man \
  bindir=$PKG/usr/games

gzip -9 $PKG/usr/man/man6/$PRGNAM.6

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a ChangeLog LICENSE README README.themes TODO $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

# 20230107 bkw: 2.2.1 source includes a .desktop file, but it has issues
# (e.g. no Categories), so keep using our own.
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

for i in 16 22 32 48 64 96 128; do
  px=$( basename $i | cut -d. -f1 )
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  convert -resize $size ${PRGNAM}_128.png $dir/$PRGNAM.png
done

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

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