2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2016-08-22 03:39:07 +08:00
|
|
|
|
|
|
|
# Slackware build script for commandergenius
|
|
|
|
|
2022-06-09 00:27:13 +08:00
|
|
|
# Written by B. Watson (urchlay@slackware.uk)
|
2016-08-22 03:39:07 +08:00
|
|
|
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
|
2023-01-12 06:10:38 +08:00
|
|
|
# 20230111 bkw: updated for 3.2.0
|
2021-10-22 03:50:21 +08:00
|
|
|
# 20211021 bkw: updated for 3.0.8
|
2021-03-10 17:26:21 +08:00
|
|
|
# 20210310 bkw: updated for 2.7.7
|
2020-12-25 13:11:33 +08:00
|
|
|
# 20201224 bkw: updated for 2.7.3
|
2020-11-13 00:56:35 +08:00
|
|
|
# 20201111 bkw: updated for 2.6.3.1
|
2020-10-31 03:01:25 +08:00
|
|
|
# 20201030 bkw: updated for 2.6.3
|
2020-03-03 01:20:20 +08:00
|
|
|
# 20200302 bkw: updated for 2.3.9
|
2019-12-03 07:33:04 +08:00
|
|
|
# 20191202 bkw: updated for 2.3.8
|
2018-09-12 04:03:20 +08:00
|
|
|
# 20180911 bkw: updated for 2.2.3
|
2018-07-11 05:10:40 +08:00
|
|
|
# 20180709 bkw: updated for 2.2.2
|
|
|
|
# - upstream moved the project from github to gitlab. one nice side-effect
|
|
|
|
# of this is that the GsKit stuff is now included in the release tarball,
|
|
|
|
# which simplifies this script quite a bit. the downside of that is that
|
|
|
|
# this script can no longer build older versions.
|
|
|
|
# - SDL2 and python3 are now required.
|
|
|
|
|
|
|
|
# 20180101 bkw: updated for 2.0.0
|
2017-12-23 17:47:44 +08:00
|
|
|
# 20171222 bkw: updated for 1.9.9.8beta
|
|
|
|
# 20170826 bkw: updated for 1.9.9.5beta
|
|
|
|
# 20170725 bkw: updated for 1.9.9.2beta
|
2017-03-01 15:27:29 +08:00
|
|
|
# 20170301 bkw:
|
|
|
|
# - updated for 1.9.8.7beta
|
|
|
|
# - fix the build for the case where SDL2 is installed but SDL2_image is not.
|
|
|
|
# - update man page (level= option, correct author's full name)
|
|
|
|
# - use github long-form URL
|
|
|
|
# 20170122 bkw: updated for 1.9.8.1beta.
|
2017-01-23 03:20:48 +08:00
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2016-08-22 03:39:07 +08:00
|
|
|
PRGNAM=commandergenius
|
2023-01-12 06:10:38 +08:00
|
|
|
VERSION=${VERSION:-3.2.0}
|
2016-08-22 03:39:07 +08:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2016-08-22 03:39:07 +08:00
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i586 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 18:23:38 +08:00
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-08-22 03:39:07 +08: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
|
|
|
|
|
|
|
|
# I wish upstream would pick a name and stick with it... they also use
|
|
|
|
# ~/.CommanderGenius for user data, and their README mentions CGenius.
|
|
|
|
SRCNAM="Commander-Genius"
|
|
|
|
EXENAME="CGeniusExe"
|
|
|
|
DESKTOP="cgenius.desktop"
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2018-07-11 05:10:40 +08:00
|
|
|
rm -rf $SRCNAM-v$VERSION
|
|
|
|
# OSX and Windows stuff takes up 31MB in /tmp, no need to extract it.
|
2021-10-22 03:50:21 +08:00
|
|
|
# Also don't extract the prebuilt icotool binary (ugh).
|
2018-07-11 05:10:40 +08:00
|
|
|
tar xvf $CWD/$SRCNAM-v$VERSION.tar.bz2 \
|
2021-10-22 03:50:21 +08:00
|
|
|
--wildcards --exclude='*/dlls' --exclude='*/Build/Xcode' --exclude='*/icotool'
|
2018-07-11 05:10:40 +08:00
|
|
|
cd $SRCNAM-v$VERSION
|
2016-08-22 03:39:07 +08:00
|
|
|
chown -R root:root .
|
|
|
|
|
|
|
|
# permissions are blethcherous, please don't revert to template here.
|
|
|
|
find -L . -type f -a -exec chmod 644 '{}' '+'
|
|
|
|
find -L . -type d -a -exec chmod 755 '{}' '+'
|
|
|
|
|
|
|
|
# placate desktop-file-validate
|
2021-10-22 03:50:21 +08:00
|
|
|
sed -i -e 's,Application;,,' \
|
|
|
|
-e 's,cg\.svg,'$PRGNAM',' \
|
|
|
|
share/$DESKTOP
|
2016-08-22 03:39:07 +08:00
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2021-01-10 00:17:40 +08:00
|
|
|
cmake \
|
2018-07-11 05:10:40 +08:00
|
|
|
-DUSE_SDL2=yes \
|
2021-10-22 03:50:21 +08:00
|
|
|
-DDOCDIR=/usr/doc/$PRGNAM-$VERSION \
|
2016-08-22 03:39:07 +08:00
|
|
|
-DGAMES_SHAREDIR:STRING=/usr/share/games \
|
|
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
|
|
|
|
-DMAN_INSTALL_DIR=/usr/man \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
|
|
|
make VERBOSE=1
|
|
|
|
make install/strip DESTDIR=$PKG
|
|
|
|
cd ..
|
|
|
|
|
2021-10-22 03:50:21 +08:00
|
|
|
# clean up the icon names
|
|
|
|
for dir in $PKG/usr/share/icons/hicolor/*; do
|
|
|
|
px="$( basename $dir | cut -dx -f1 )"
|
|
|
|
mv $dir/apps/cg.$px.png $dir/apps/$PRGNAM.png
|
|
|
|
done
|
|
|
|
|
2016-08-22 03:39:07 +08:00
|
|
|
# upstream installs 2 identical-looking (but not byte-identical) icons
|
2021-10-22 03:50:21 +08:00
|
|
|
rm -f $PKG/usr/share/games/$PRGNAM/CGLogo.png
|
|
|
|
ln -s ../../icons/hicolor/512x512/apps/$PRGNAM.png \
|
|
|
|
$PKG/usr/share/games/$PRGNAM/CGLogo.png
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/share/pixmaps
|
|
|
|
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
|
2016-08-22 03:39:07 +08:00
|
|
|
|
|
|
|
# grrrr. don't force command-line users to remember the name is CGeniusExe
|
|
|
|
ln -s $EXENAME $PKG/usr/games/$PRGNAM
|
|
|
|
|
2021-10-22 03:50:21 +08:00
|
|
|
# the High Quality Pack.
|
2016-08-22 03:39:07 +08:00
|
|
|
cp -a hqp/* $PKG/usr/share/games/$PRGNAM
|
2021-10-22 03:50:21 +08:00
|
|
|
mv $PKG/usr/share/games/$PRGNAM/Readme_hqp.txt $PKG/usr/doc/$PRGNAM-$VERSION
|
2016-08-22 03:39:07 +08:00
|
|
|
|
|
|
|
# man page written for this SlackBuild.
|
|
|
|
mkdir -p $PKG/usr/man/man6
|
|
|
|
gzip -9c < $CWD/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
|
|
|
|
ln -s $PRGNAM.6.gz $PKG/usr/man/man6/$EXENAME.6.gz
|
|
|
|
|
2021-10-22 03:50:21 +08:00
|
|
|
# most of the docs were already installed.
|
2016-08-22 03:39:07 +08:00
|
|
|
cp -a COPYRIGHT $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
2018-09-12 04:03:20 +08:00
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
2016-08-22 03:39:07 +08:00
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|