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

# Slackware build script for liquidwar6

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

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

# 20211031 bkw: BUILD=3
# - fix build on -current again.
# - use upstream's icon and .desktop.
# - install/remove info file in doinst/douninst.
# - new-style icons.
# - always include the extra game maps. they don't take up much space,
#   and it's one less hoop to make people jump through.

# 20170621 bkw: fix build on -current

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

PRGNAM=liquidwar6
VERSION=${VERSION:-0.6.3902}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

MAPVER=${MAPVER:-0.0.13beta}
SHORTNAM=${PRGNAM/[0-9]*/}

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.gz
cd $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-extra-maps-$MAPVER.tar.gz
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 {} \+

# -current needs this:
sed -i 's,-Werror,,' configure

# 20211031 bkw: it looks like we ought to be able to force the
# guile-config binary by setting GUILE_CONFIG in the env, but later
# on the configure script uses the hard-coded name "guile-config" (the
# one we want is "guile-config1.8"). So:
mkdir -p fakebin
ln -s /usr/bin/guile-config1.8 fakebin/guile-config
export PATH=$(pwd)/fakebin:$PATH

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --bindir=/usr/games \
  --datadir=/usr/share/games \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --infodir=/usr/info \
  --enable-shared \
  --disable-static \
  --enable-allinone \
  --mandir=/usr/man

make
make install-strip DESTDIR=$PKG

DIRVER="$( echo $VERSION | cut -d. -f1,2 )"
EXTRADIR=$PKG/usr/share/games/$PRGNAM-$DIRVER/map/extra
mkdir -p $EXTRADIR
cp -r $PRGNAM-extra-maps-$MAPVER/map/* $EXTRADIR

# the .desktop and icon should be installed in --datarootdir, not
# --datadir. Sigh.
mv $PKG/usr/share/games/applications $PKG/usr/share/applications
sed -i 's,Exec=,&/usr/games/,' $PKG/usr/share/applications/$PRGNAM.desktop
mv $PKG/usr/share/games/pixmaps $PKG/usr/share/pixmaps
rm -f $PKG/usr/share/pixmaps/$PRGNAM.png
# pixmaps still contains upstream's 48x48 xpm icon.

for px in 16 32 48 64 128; do
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  convert -resize $size data/icon/$PRGNAM.png $dir/$PRGNAM.png
done

gzip $PKG/usr/man/man6/$PRGNAM.6
( cd $PKG/usr/man/man6 ; ln -s $PRGNAM.6.gz $SHORTNAM.6.gz )
( cd $PKG/usr/games ; ln -s $PRGNAM $SHORTNAM )

# see doinst.sh and douninst.sh, for how to install/remove info files.
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/info/*

# The package docs are just a skeleton, completely useless
# (the real docs are the info pages)
rm -rf $PKG/usr/share/doc

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README NEWS ChangeLog COPYING AUTHORS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
sed "s,@MAPVER@,$MAPVER," $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh  > $PKG/install/doinst.sh
cat $CWD/douninst.sh  > $PKG/install/douninst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE