summaryrefslogtreecommitdiffstats
path: root/games/oblige/oblige.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'games/oblige/oblige.SlackBuild')
-rw-r--r--games/oblige/oblige.SlackBuild60
1 files changed, 47 insertions, 13 deletions
diff --git a/games/oblige/oblige.SlackBuild b/games/oblige/oblige.SlackBuild
index 8e9d2b4917..cbb0ef26b0 100644
--- a/games/oblige/oblige.SlackBuild
+++ b/games/oblige/oblige.SlackBuild
@@ -2,10 +2,17 @@
# Slackware build script for oblige
-# 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.
+# 20230107 bkw: BUILD=3, fix line endings in .desktop file.
+
+# 20211020 bkw: BUILD=2
+# - fix -current build.
+# - binary in /usr/games.
+# - new-style icons.
+
# 20171220 bkw:
# - update for 7.70. Upstream calls this the final release :(
@@ -41,7 +48,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=oblige
VERSION=${VERSION:-7.70}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -53,9 +60,6 @@ if [ -z "$ARCH" ]; then
esac
fi
-# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
-# the name of the created package would be, and then exit. This information
-# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@@ -84,6 +88,19 @@ set -e
SRCVER=${VERSION//./}
SRCNAM="Oblige" # grrrr!
+if [ ! -e $CWD/swap.$VERSION.diff.gz ]; then
+ supported="$( echo $( /bin/ls $CWD/*.diff.gz | sed 's,.*/,,' | cut -d. -f2,3 ) )"
+ cat <<EOF
+
+*** Unsupported version of oblige: $VERSION.
+*** Supported versions are: $supported.
+*** The build will probably fail. Press ^C to abort, or wait
+*** 10 seconds to continue.
+
+EOF
+ sleep 10
+fi
+
rm -rf $PKG
mkdir -p $TMP $PKG/usr/bin $PKG/usr/share/$PRGNAM $OUTPUT
cd $TMP
@@ -99,32 +116,49 @@ fi
cd ${SRCNAM}-${VERSION}-source
chown -R root:root .
-find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
- -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
- -exec chmod 644 {} \;
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+# N.B. these diffs *must* be gzipped, they contain a mix of \n and
+# \r\n line endings, git would strip the \r's.
+zcat $CWD/swap.$VERSION.diff.gz | patch -p1
# 'make install' would install the .desktop and icon to /usr, not PREFIX.
sed -i '/xdg-/d' Makefile
# if there's no prefabs/ dir, don't try to install it. doing it this
-# way allows this script to still build oblige 7.666, if needed.
+# way would allow this script to still build oblige 7.666, if needed.
if [ ! -d prefabs ]; then
sed -i '/\/prefabs/d' Makefile
fi
make PREFIX=/usr OPTIMISE="$SLKCFLAGS"
make install PREFIX=$PKG/usr
+mv $PKG/usr/bin $PKG/usr/games
# man page written for this build (based on --help output)
mkdir -p $PKG/usr/man/man6
gzip -9c < $CWD/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
# Starting with 6.20, upstream includes a .desktop and icon.
+# The icon's fugly though, see below.
+# 20230107 bkw: fix stoopid \r\n line endings.
mkdir -p $PKG/usr/share/pixmaps $PKG/usr/share/applications
-cat misc/icon_128x128.png > $PKG/usr/share/pixmaps/$PRGNAM.png
-cat misc/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
+sed -e "s,Exec=,Exec=/usr/games/," \
+ -e 's,\r,,g' \
+ < misc/$PRGNAM.desktop \
+ > $PKG/usr/share/applications/$PRGNAM.desktop
+
+# icons made from upstream's icon, by turning the background transparent.
+for i in $CWD/icons/*.png; do
+ px=$( basename $i | cut -d. -f1 )
+ size=${px}x${px}
+ dir=$PKG/usr/share/icons/hicolor/$size/apps
+ mkdir -p $dir
+ cat $i > $dir/$PRGNAM.png
+done
+
+ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
rm -f INSTALL.txt # don't need compile instruction in bin package