games/abuse: New maintainer, fix segfault.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-08-07 22:11:33 -04:00 committed by Willy Sudiarto Raharjo
parent 508d793fa8
commit a9bfc2f55b
No known key found for this signature in database
GPG key ID: 3F617144D7238786
14 changed files with 139 additions and 61 deletions

View file

@ -1,13 +1,7 @@
abuse (dark 2D side-scrolling platform game)
Abuse is a dark 2D side-scrolling platform game developed by Crack dot
Com in 1995. It features beautiful lighting, realistic animation and
nasty alien-like creatures to destroy.
It is now maintained by Sam Hocevar in an attempt to prevent it from
vanishing from the Internet.
If sound doesn't work for you or it is distorted, apply the supplied
patch with:
SOUNDFIX=YES ./abuse.SlackBuild
Optionally, for in-game music support you need to install TiMidity++
(and a set of sound patches for it).
Optional: For in-game music, install either eawpats or freepats.

View file

@ -1,12 +0,0 @@
diff -aurp ./src/sdlport/sound.cpp ../abuse-0.8//src/sdlport/sound.cpp
--- ./src/sdlport/sound.cpp 2011-05-09 03:58:30.000000000 -0400
+++ ../abuse-0.8//src/sdlport/sound.cpp 2011-05-21 20:46:44.487000027 -0400
@@ -65,7 +65,7 @@ int sound_init( int argc, char **argv )
}
free( sfxdir );
- if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 128) < 0)
+ if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024) < 0)
{
printf( "Sound: Unable to open audio - %s\nSound: Disabled (error)\n", SDL_GetError() );
return 0;

View file

@ -1,8 +1,8 @@
#!/bin/bash
#
# Slackware build script for Abuse
#
# Written by Rex Hauser <thundermachinegun[AT]gmail.com>
# Slackware build script for abuse
# Written by Rex Hauser, modified and now maintained by B. Watson.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
@ -21,12 +21,26 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20230807 bkw: BUILD=4
# - take over maintenance.
# - fix segfault on startup.
# - binary in /usr/games.
# - replace icon with the one from Xenoveritas (and prescale it).
# - update .desktop file.
# Note: there is a maintained fork: https://github.com/Xenoveritas/abuse.
# However, I can't get their 0.9.1 release to work correctly: it
# compiles and starts up, but does not respond to either mouse or
# keyboard no matter what I try. So I'm sticking with the old 0.8 from
# Sam Hocevar, with a patch backported from Xenoveritas to fix the
# segfault on startup (which seems to have been introduced by the new
# g++ in Slackware 15.0).
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=abuse
VERSION=${VERSION:-0.8}
BUILD=${BUILD:-3}
BUILD=${BUILD:-4}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -38,9 +52,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
@ -50,11 +61,6 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
DOCS="AUTHORS COPYING COPYING.GPL COPYING.WTFPL NEWS ChangeLog README TODO"
# Set this to YES if sound doesn't work
SOUNDFIX=${SOUNDFIX:-NO}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
@ -75,42 +81,49 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
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 {} +
if [ "$SOUNDFIX" = "YES" ]; then
patch -p0 < $CWD/$PRGNAM-$VERSION-sound_fix.patch
fi
# 20230807 bkw: this fix backported from https://github.com/Xenoveritas/abuse,
# commit 77a34f6.
patch -p1 < $CWD/fix-startup-segfault.diff
# 20230807 bkw: this used to be an optional patch. always apply it,
# since it doesn't cause any problems (and since the Xenoveritas fork
# does the same).
sed -i '/Mix_OpenAudio/s,128,1024,' src/sdlport/sound.cpp
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--bindir=/usr/games \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--build=$ARCH-slackware-linux
make
make DESTDIR=$PKG install
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
make install-strip DESTDIR=$PKG
gzip -9 $PKG/usr/man/man*/*
mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/abuse.desktop > $PKG/usr/share/applications/abuse.desktop
cat $PKG/usr/share/games/abuse/abuse.png > $PKG/usr/share/pixmaps/abuse.png
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
for i in $CWD/icons/*.png; do
px="$( basename $i .png )"
sz="${px}x${px}"
dir=$PKG/usr/share/icons/hicolor/$sz/apps
mkdir -p $dir
cat $i > $dir/$PRGNAM.png
done
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a AUTHORS COPYING* NEWS ChangeLog README TODO $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

View file

@ -1,8 +1,8 @@
[Desktop Entry]
Name=Abuse
GenericName=Dark 2D side-scrolling platform game
Exec=abuse
Comment=Dark 2D side-scrolling platform game
Exec=/usr/games/abuse
Icon=abuse
Terminal=false
Type=Application
Categories=Game;
Categories=Game;ArcadeGame;ActionGame;

View file

@ -0,0 +1,63 @@
diff -Naur abuse-0.8/src/lisp/lisp.cpp abuse-0.8.patched/src/lisp/lisp.cpp
--- abuse-0.8/src/lisp/lisp.cpp 2011-05-02 07:55:06.000000000 -0400
+++ abuse-0.8.patched/src/lisp/lisp.cpp 2023-08-07 20:52:41.197394085 -0400
@@ -867,7 +867,7 @@
size_t ret = 0;
#ifdef TYPE_CHECKING
- if (this && item_type(this) != (ltype)L_CONS_CELL)
+ if (item_type(this) != (ltype)L_CONS_CELL)
{
Print();
lbreak(" is not a sequence\n");
@@ -1275,7 +1275,7 @@
switch (item_type(this))
{
case L_CONS_CELL:
- if (!this)
+ if (ptr_is_null(this))
{
lprint_string("nil");
}
@@ -3080,7 +3080,7 @@
LObject *ret = NULL;
- if (this)
+ if (!ptr_is_null(this))
{
switch (item_type(this))
{
diff -Naur abuse-0.8/src/lisp/lisp.h abuse-0.8.patched/src/lisp/lisp.h
--- abuse-0.8/src/lisp/lisp.h 2011-05-02 07:55:06.000000000 -0400
+++ abuse-0.8.patched/src/lisp/lisp.h 2023-08-07 20:53:56.765386973 -0400
@@ -201,7 +201,28 @@
static inline LObject *&CAR(void *x) { return ((LList *)x)->car; }
static inline LObject *&CDR(void *x) { return ((LList *)x)->cdr; }
-static inline ltype item_type(void *x) { if (x) return *(ltype *)x; return L_CONS_CELL; }
+
+#ifdef __GNUC__
+/*
+ * C++ spec says "this" is always NON-NULL, recent versions of gcc will warn
+ * about this and optimizes the "if (this)" we use in some places away:
+ * "warning: nonnull argument this compared to NULL [-Wnonnull-compare]"
+ * We rely on "if (this)" checks in several places and refactoring this is
+ * non trivial. So we use this little helper marked with
+ * __attribute__((optimize("O0"))) to workaround this.
+ */
+static inline bool __attribute__((optimize("O0"))) ptr_is_null(void *ptr)
+{
+ return ptr == NULL;
+}
+#else
+static inline bool ptr_is_null(void *ptr)
+{
+ return ptr == NULL;
+}
+#endif
+
+static inline ltype item_type(void *x) { if (!ptr_is_null(x)) return *(ltype *)x; return L_CONS_CELL; }
void perm_space();
void tmp_space();

BIN
games/abuse/icons/128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
games/abuse/icons/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
games/abuse/icons/160.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
games/abuse/icons/22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
games/abuse/icons/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
games/abuse/icons/48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
games/abuse/icons/64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

20
games/abuse/mkicons.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/sh
src="$1"
shift
if [ -z "$src" -o ! -e "$src" -o "$*" ]; then
cat 1>&2 <<EOF
Usage: $0 /path/to/icon.png
EOF
fi
set -e
mkdir -p icons/
cat "$src" > icons/160.png
for i in 16 22 32 48 64 128; do
convert -resize ${i}x${i} "$src" icons/$i.png
done
exit 0

View file

@ -11,9 +11,9 @@ abuse:
abuse: Abuse is a dark 2D side-scrolling platform game developed by Crack dot
abuse: Com in 1995. It features beautiful lighting, realistic animation and
abuse: nasty alien-like creatures to destroy.
abuse: It is now maintained by Sam Hocevar in an attempt to prevent it from
abuse: vanishing from the Internet.
abuse:
abuse: Home page: http://abuse.zoy.org/
abuse:
abuse:
abuse:
abuse:
abuse:
abuse: