2021-07-03 19:48:15 +02:00
|
|
|
#!/bin/bash
|
2016-08-15 01:44:23 +02:00
|
|
|
|
|
|
|
# Slackware build script for bstone
|
|
|
|
|
2022-06-08 18:27:10 +02:00
|
|
|
# Written by B. Watson (urchlay@slackware.uk)
|
2016-08-15 01:44:23 +02:00
|
|
|
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
|
2023-01-11 20:08:16 +01:00
|
|
|
# 20230111 bkw: update for v1.2.12.
|
|
|
|
|
2021-10-05 01:40:27 +02:00
|
|
|
# 20211004 bkw:
|
|
|
|
# - update for v1.2.11.
|
|
|
|
# - include .txt version of license.
|
|
|
|
# - datadir.diff changed again.
|
|
|
|
# - update .desktop file.
|
|
|
|
# - better README doc on how to play the full version.
|
|
|
|
|
2020-12-19 07:47:17 +01:00
|
|
|
# 20201219 bkw: update for v1.2.9.
|
2020-08-05 00:26:44 +02:00
|
|
|
# 20200804 bkw: update for v1.2.8. datadir.diff changed again.
|
2020-02-22 08:47:19 +01:00
|
|
|
# 20200222 bkw: update for v1.1.16_2.
|
2019-11-27 20:20:06 +01:00
|
|
|
# 20191127 bkw: update for v1.1.14. datadir.diff had to change so we can't
|
|
|
|
# build old versions any more.
|
2017-09-21 08:50:44 +02:00
|
|
|
# 20170921 bkw: update for v1.1.9.
|
2017-08-07 19:52:23 +02:00
|
|
|
# 20170807 bkw: update for v1.1.8, use upstream's icon instead of mine.
|
2017-06-21 22:46:03 +02:00
|
|
|
# 20170621 bkw: fix build on -current
|
|
|
|
|
2021-07-04 11:41:06 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2016-08-15 01:44:23 +02:00
|
|
|
PRGNAM=bstone
|
2023-01-11 20:08:16 +01:00
|
|
|
VERSION=${VERSION:-1.2.12}
|
2016-08-15 01:44:23 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 12:23:38 +02:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2016-08-15 01:44:23 +02:00
|
|
|
|
2020-02-22 08:47:19 +01:00
|
|
|
SRCVER=${VERSION/_/-}
|
|
|
|
|
2016-08-15 01:44:23 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i586 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 12:23:38 +02:00
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-08-15 01:44:23 +02:00
|
|
|
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
|
2020-02-22 08:47:19 +01:00
|
|
|
rm -rf $PRGNAM-$SRCVER
|
2021-10-05 01:40:27 +02:00
|
|
|
tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
|
2020-02-22 08:47:19 +01:00
|
|
|
cd $PRGNAM-$SRCVER
|
2016-08-15 01:44:23 +02:00
|
|
|
chown -R root:root .
|
2019-11-27 20:20:06 +01:00
|
|
|
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
|
|
|
|
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
|
2016-08-15 01:44:23 +02:00
|
|
|
|
|
|
|
# look in /usr/share/games/bstone for game data files, not the
|
|
|
|
# directory the executable lives in. the --data_dir option can
|
|
|
|
# still override this.
|
|
|
|
patch -p1 < $CWD/datadir.diff
|
|
|
|
|
|
|
|
# make install and install/strip are borked, do manual install.
|
|
|
|
# always include the shareware data in the package, the game will
|
2021-10-05 01:40:27 +02:00
|
|
|
# automatically use it if the user hasn't installed the full version,
|
|
|
|
# or offer a choice of full version or shareware if he has both.
|
2016-08-15 01:44:23 +02:00
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
|
|
|
|
-DMAN_INSTALL_DIR=/usr/man \
|
2021-10-05 01:40:27 +02:00
|
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
2016-08-15 01:44:23 +02:00
|
|
|
make
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/games $PKG/usr/share/games/$PRGNAM
|
2021-10-05 01:40:27 +02:00
|
|
|
install -s -m0755 src/$PRGNAM $PKG/usr/games
|
2016-08-15 01:44:23 +02:00
|
|
|
|
|
|
|
unzip $CWD/1bs30.zip
|
|
|
|
unzip BSSW30.SHR \*.BS1
|
|
|
|
install -oroot -groot -m0644 *.BS1 $PKG/usr/share/games/$PRGNAM
|
|
|
|
cd ..
|
|
|
|
|
2017-08-07 19:52:23 +02:00
|
|
|
# man page and .desktop written for this build. icon converted from upstream's
|
|
|
|
# src/sys/win32/bstone_icon.ico.
|
2016-08-15 01:44:23 +02:00
|
|
|
mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps $PKG/usr/man/man6
|
|
|
|
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
|
|
|
|
gzip -9c < $CWD/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
|
|
|
|
|
2021-10-05 01:40:27 +02:00
|
|
|
# the original source code license is supplied only as a MS word .doc
|
|
|
|
# file. we ship it as-is, but rename it to something without spaces in
|
|
|
|
# the filename. also, ship a pre-converted text version (created with
|
|
|
|
# wvText, then hand-edited to fix the formatting).
|
|
|
|
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
LIC=blake_stone_source_code_license
|
|
|
|
mkdir -p $PKGDOC
|
|
|
|
cp -a LICENSE README.md TODO.md CHANGE* $PKGDOC
|
|
|
|
cp -a *.doc $PKGDOC/$LIC.doc
|
|
|
|
cat $CWD/$LIC.txt > $PKGDOC/$LIC.txt
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
|
2016-08-15 01:44:23 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
2021-07-04 12:23:38 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|