summaryrefslogtreecommitdiffstats
path: root/games/srb2/srb2.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'games/srb2/srb2.SlackBuild')
-rw-r--r--games/srb2/srb2.SlackBuild48
1 files changed, 41 insertions, 7 deletions
diff --git a/games/srb2/srb2.SlackBuild b/games/srb2/srb2.SlackBuild
index 356c8bfb5c..526ac57f9a 100644
--- a/games/srb2/srb2.SlackBuild
+++ b/games/srb2/srb2.SlackBuild
@@ -1,15 +1,23 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for srb2
-# Written by B. Watson (yalhcru@gmail.com)
+# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+# 20230714 bkw: updated for v2.2.11.
+# - new deps (see .info file).
+# - cmake sed stuff to allow building without net access.
+# - new-style icons.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
PRGNAM=srb2
-VERSION=${VERSION:-2.2.8}
+VERSION=${VERSION:-2.2.11}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -19,7 +27,11 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+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}
@@ -71,7 +83,11 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
( cd assets
mkdir installer
cd installer
- unzip $CWD/SRB2-v$VERSION-Full.zip '*.dta' '*.pk3'
+
+ # upstream release a 2.2.8 followed by a 229, handle either.
+ ZIPFILE="$CWD/SRB2-v$VERSION-Full.zip"
+ [ -e "$ZIPFILE" ] || ZIPFILE="$CWD/SRB2-v${VERSION//.}-Full.zip"
+ unzip "$ZIPFILE" '*.dta' '*.pk3'
)
# As shipped, the path /usr/games/SRB2 is hardcoded in various places
@@ -80,6 +96,12 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
sed -i 's,usr/games,usr/share/games,g' \
src/sdl/i_system.c src/sdl/i_ttf.c
+# 20230714 bkw: cmake silliness. it wants to download Ccache.cmake to
+# support ccache on Linux. on Windows, it seems to support ccache
+# without external dependency... and it turns out, this support works
+# on Linux as well. So:
+sed -i '/CMAKE_HOST_SYSTEM_NAME/s,STREQ.*,MATCHES Linux),' CMakeLists.txt
+
mkdir -p build
cd build
cmake \
@@ -88,6 +110,7 @@ cd build
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DMAN_INSTALL_DIR=/usr/man \
+ -DUSE_CCACHE=ON \
-DCMAKE_BUILD_TYPE=Release ..
make VERBOSE=1
#make install/strip DESTDIR=$PKG # don't bother, it's broken
@@ -98,11 +121,22 @@ mkdir -p $PKG/usr/games $PKG/usr/share/games/SRB2 \
$PKG/usr/share/pixmaps $PKG/usr/share/applications \
$PKG/usr/doc/$PRGNAM-$VERSION
# as of 2.2.8 the binary's name changed.
+# 20230714 bkw: ...and it changed again in 2.2.11.
+[ -x build/bin/lsdl$PRGNAM-$VERSION ] || mv build/bin/lsdl$PRGNAM build/bin/lsdl$PRGNAM-$VERSION
install -s -m0755 build/bin/lsdl$PRGNAM-$VERSION $PKG/usr/games
ln -s lsdl$PRGNAM-$VERSION $PKG/usr/games/lsdl$PRGNAM
ln -s lsdl$PRGNAM-$VERSION $PKG/usr/games/$PRGNAM
install -m0644 assets/LICENSE* assets/README* $PKG/usr/doc/$PRGNAM-$VERSION
-install -m0644 $PRGNAM.png $PKG/usr/share/pixmaps
+
+hicolor=$PKG/usr/share/icons/hicolor
+for px in 16 22 32 48 64 128 256; do
+ sz=${px}x${px}
+ dir=$hicolor/$sz/apps
+ mkdir -p $dir
+ convert -resize $sz $PRGNAM.png $dir/$PRGNAM.png
+done
+
+ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
echo -n "Copying data files: "
( cd assets/installer
@@ -129,4 +163,4 @@ 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:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE