From 6c6fe34a5bdebae8cd785e416716146508fccf79 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 11 Jul 2018 04:10:42 -0400 Subject: games/jfsw: Updated for version 20180424_8fc2d54. Signed-off-by: B. Watson --- games/jfsw/README | 7 ++- games/jfsw/fixsegfault.diff | 12 +++++ games/jfsw/jfsw-use-me.patch | 19 -------- games/jfsw/jfsw.SlackBuild | 108 ++++++++++++++++++++++++++++++++----------- games/jfsw/jfsw.info | 16 +++---- games/jfsw/slack-desc | 2 +- 6 files changed, 109 insertions(+), 55 deletions(-) create mode 100644 games/jfsw/fixsegfault.diff delete mode 100644 games/jfsw/jfsw-use-me.patch diff --git a/games/jfsw/README b/games/jfsw/README index 23ccdc457ad3..e9b566f2a252 100644 --- a/games/jfsw/README +++ b/games/jfsw/README @@ -14,7 +14,12 @@ If you have sw.grp from the full version of the game, you may also want to install jfsw_hires_pack for some graphic enhancements (don't bother trying if all you have is the shareware sw.grp: it segfaults on startup). -Note #1: If you run into an issue turning left or right with the mouse, +Optional dependencies: SDL2 and/or fluidsynth. These will be autodetected +and used if they are installed. SDL2 provides a slightly better user +experience (YMMV), but fluidsynth doesn't actually seem to *do* anything +for jfsw. + +Note: If you run into an issue turning left or right with the mouse, edit the config file (~/.jfsw/sw.cfg) and change MouseAnalogAxes0 to "analog_turning" and MouseAnalogAxes1 to "analog_moving". The digital axes should have "" values. diff --git a/games/jfsw/fixsegfault.diff b/games/jfsw/fixsegfault.diff new file mode 100644 index 000000000000..9290ffef9613 --- /dev/null +++ b/games/jfsw/fixsegfault.diff @@ -0,0 +1,12 @@ +diff -Naur jfsw.orig/src/menus.c jfsw/src/menus.c +--- jfsw.orig/src/menus.c 2017-03-24 23:22:17.000000000 -0400 ++++ jfsw/src/menus.c 2018-07-10 22:51:52.032019948 -0400 +@@ -2540,7 +2540,7 @@ + CONTROL_ClearUserInput(&mnu_input); + CONTROL_GetUserInput(&mnu_input); + +- if (KB_KeyPressed(sc_Y) || KB_KeyPressed(sc_Enter) || mnu_input.button0) ++ if (KB_KeyPressed(sc_Y) || KB_KeyPressed(sc_Enter)) + return (TRUE); + else + return (FALSE); diff --git a/games/jfsw/jfsw-use-me.patch b/games/jfsw/jfsw-use-me.patch deleted file mode 100644 index fac46fff2fd1..000000000000 --- a/games/jfsw/jfsw-use-me.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -u -r jfsw-orig/jfbuild/src/kplib.c jfsw/jfbuild/src/kplib.c ---- jfsw-orig/jfbuild/src/kplib.c 2016-02-20 06:31:24.000000000 +0000 -+++ jfsw/jfbuild/src/kplib.c 2016-06-08 00:12:21.495980101 +0100 -@@ -181,13 +181,13 @@ - static int gslidew = 0, gslider = 0, xm, xmn[4], xr0, xr1, xplc, yplc; - static INT_PTR nfplace; - static int clen[320], cclen[19], bitpos, filt, xsiz, ysiz; --static int xsizbpl, ixsiz, ixoff, iyoff, ixstp, iystp, intlac, nbpl, trnsrgb ASMNAME("trnsrgb"); -+static int xsizbpl, ixsiz, ixoff, iyoff, ixstp, iystp, intlac, nbpl, __attribute__((used)) trnsrgb ASMNAME("trnsrgb"); - static int ccind[19] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; - static int hxbit[59][2], ibuf0[288], nbuf0[32], ibuf1[32], nbuf1[32]; - static const unsigned char *filptr; - static unsigned char slidebuf[32768], opixbuf0[4], opixbuf1[4]; - static unsigned char pnginited = 0, olinbuf[65536] ASMNAME("olinbuf"); //WARNING:max xres is: 65536/bpp-1 --static int gotcmov = -2, abstab10[1024] ASMNAME("abstab10"); -+static int gotcmov = -2, __attribute__((used)) abstab10[1024] ASMNAME("abstab10"); - - //Variables to speed up dynamic Huffman decoding: - #define LOGQHUFSIZ0 9 diff --git a/games/jfsw/jfsw.SlackBuild b/games/jfsw/jfsw.SlackBuild index 956dded9944e..2d2fa28a3bd9 100644 --- a/games/jfsw/jfsw.SlackBuild +++ b/games/jfsw/jfsw.SlackBuild @@ -7,8 +7,29 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20180710 bkw: +# - updated for 20180424_8fc2d54 (latest git). +# - finally fix long-standing segfault bug. +# - document new optional deps in README. +# - make slack-desc show runtime library deps. +# - remove freepats from REQUIRES. I've never been able to get the +# music to play in jfsw anyway. + +# When updating to the latest commit of jfsw, we gotta make sure we +# get the correct commits of the other 3 sources (jfaudiolib, jfbuild, +# jfmact). To do this: +# git clone https://github.com/jonof/jfsw.git jfsw.tmp +# cd jfsw.tmp +# git submodule init +# git submodule update +# Fortunately only the .info file needs to be updated. This script +# parses it instead of having the commit hashes hardcoded here too. +# VERSION is duplicated as usual, but here it only serves to name the +# package (you could build just fine with any VERSION so long as the +# .info file is correct). + PRGNAM=jfsw -VERSION=${VERSION:-20160220_54912c4} +VERSION=${VERSION:-20180424_8fc2d54} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -41,49 +62,84 @@ fi set -e +# We got 4 source tarballs to extract, so create an enclosing $PRGNAM +# dir to put them all in (for ease of cleanup, if nothing else). When +# we're ready to build, the source will all be in $TMP/$PRGNAM/$PRGNAM. rm -rf $PKG -mkdir -p $TMP $PKG $OUTPUT -cd $TMP -for SRCNAM in \ - jfsw-54912c4964a5d68d4fd68dba1d3affcfe2062766 \ - jfaudiolib-ea5613edadcf691a4867a750546f33ef84885fbf \ - jfbuild-b129b7ee9ce468022610dc8194786c0bac1f66ef \ - jfmact-f915216973de73c42c326fdd3b1734ac12316427 \ -; do +rm -rf $TMP/$PRGNAM +mkdir -p $TMP/$PRGNAM $PKG $OUTPUT +cd $TMP/$PRGNAM + +# 20180710 bkw: this is an unusual thing for a SlackBuild to do: +# parse its own .info file. Done this way to avoid duplicating +# all those full-length git hashes in both files. +if [ ! -e "$CWD/$PRGNAM.info" ]; then + echo "$PRGNAM.info not found, where did it go?" 1>&2 + exit 1 +fi + +# For paranoia's sake, don't actually source the entire .info file, just +# grab the DOWNLOAD= assignment. This rather cryptic sed command means +# "start printing lines when you hit one that starts with DOWNLOAD, +# and exit when you hit one that ends with gz and a double-quote +# (plus possible trailing whitespace)". Result is the multi-line DOWNLOAD +# assigment only. +DLFRAG="$( mktemp ./tmp.info.XXXXXX )" +sed -n '/^DOWNLOAD/,$p;/gz" *$/q' < "$CWD/$PRGNAM.info" > $DLFRAG +source $DLFRAG + +for URL in $DOWNLOAD; do + SRCNAM="$( basename "$URL" .tar.gz )" PNAM=$(echo $SRCNAM | sed -e 's/-.*//') + [ "$PNAM" = "$PRGNAM" ] || DIRS="$TMP/$PRGNAM/$PNAM $DIRS" rm -rf $SRCNAM $PNAM tar xvf $CWD/$SRCNAM.tar.gz mv $SRCNAM $PNAM done cd $PRGNAM -mv \ - $TMP/jfaudiolib \ - $TMP/jfbuild \ - $TMP/jfmact \ - . +mv $DIRS . 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 \ + -o -perm 511 \) -exec chmod 755 {} \+ -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ + +# 20180711 bkw: how to trigger a known segfault: +# make a save game, load that save game, die while holding the +# fire button +# I came up with a band-aid to work around the segfault. Stops the +# fire button from working the same as a Y keypress (or at all), in Y/N +# prompts. Patch was sent upstream: https://github.com/jonof/jfsw/issues/14 +patch -p1 < $CWD/fixsegfault.diff -patch -p1 < $CWD/jfsw-use-me.patch +# 20180711 bkw: The -Wno-return-type isn't needed for gcc but does no +# harm. Left in place in case someone wants to build this with clang +# (add a CC=clang arg to the make command, or 'export CC=clang'). + +# 20180711 bkw: JFAUDIOLIB_USE_SDLMIXER=1 doesn't work (build fail due +# to missing driver_sdlmixer.c). Maybe someday it'll work and then we +# can maybe hear the in-game music? (or not?) make \ RELEASE=1 \ PREFIX=/usr/share/games/$PRGNAM \ - CFLAGS="$SLKCFLAGS" \ + CFLAGS="$SLKCFLAGS -Wno-return-type" \ CXXFLAGS="$SLKCFLAGS" -# no 'make install' target +# So far, we haven't got options to disable the optional stuff, but +# at least document what the binary package needs in its slack-desc. BIN_NAME=sw +SDLVER=1.2 +WITHFLUID=without +ldd $BIN_NAME | grep -q libSDL2 && SDLVER=2.0 +ldd $BIN_NAME | grep -q libfluidsynth && WITHFLUID=with + +# no 'make install' target mkdir -p $PKG/usr/games install -s -m0755 -oroot -groot $BIN_NAME $PKG/usr/games -cd $PKG/usr/games - ln -s $BIN_NAME $PRGNAM -cd - +ln -s $BIN_NAME $PKG/usr/games/$PRGNAM # Data directory included in package, even though we don't include data file. # Why? Because the user might be grabbing sw.grp from a retail CD-ROM, and @@ -98,14 +154,14 @@ mkdir -p $PKG/usr/share/applications cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a \ - GNU.TXT readme.txt releasenotes.html \ - $PKG/usr/doc/$PRGNAM-$VERSION +cp -a GNU.TXT readme.txt releasenotes.html $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README_SBo.txt mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +sed -e "s,@WITHFLUID@,$WITHFLUID," \ + -e "s,@SDLVER@,$SDLVER, " \ + $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG diff --git a/games/jfsw/jfsw.info b/games/jfsw/jfsw.info index 5f3c725a893c..986bec380b32 100644 --- a/games/jfsw/jfsw.info +++ b/games/jfsw/jfsw.info @@ -1,16 +1,16 @@ PRGNAM="jfsw" -VERSION="20160220_54912c4" +VERSION="20180424_8fc2d54" HOMEPAGE="http://www.jonof.id.au/jfsw" -DOWNLOAD="https://github.com/jonof/jfsw/archive/54912c4/jfsw-54912c4964a5d68d4fd68dba1d3affcfe2062766.tar.gz \ - https://github.com/jonof/jfaudiolib/archive/ea5613e/jfaudiolib-ea5613edadcf691a4867a750546f33ef84885fbf.tar.gz \ - https://github.com/jonof/jfbuild/archive/b129b7e/jfbuild-b129b7ee9ce468022610dc8194786c0bac1f66ef.tar.gz \ +DOWNLOAD="https://github.com/jonof/jfsw/archive/8fc2d54/jfsw-8fc2d549d4ad840021da40e9021c6a2b891f41c2.tar.gz \ + https://github.com/jonof/jfaudiolib/archive/94ea357/jfaudiolib-94ea3575592fa7730e32ac8c6bc383639eafecf8.tar.gz \ + https://github.com/jonof/jfbuild/archive/9fd9fc3/jfbuild-9fd9fc3ca880966df78249cd6d8463de26a73351.tar.gz \ https://github.com/jonof/jfmact/archive/f915216/jfmact-f915216973de73c42c326fdd3b1734ac12316427.tar.gz" -MD5SUM="ded58dc228640fbafa8d9cfb155cd783 \ - d9429e47d88aa4b7a62ba8bfdf3d033f \ - 9fab17bb9f119be304d4a8591d5be5d1 \ +MD5SUM="def769103d62b71e05f0678a836be271 \ + 57f8c038767447236103c75da87bdd56 \ + 7a6a40a506f69b2f1617a142ae4e18c1 \ ad429cc636cba0c265a857c138a92a9d" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="freepats" +REQUIRES="" MAINTAINER="B. Watson" EMAIL="yalhcru@gmail.com" diff --git a/games/jfsw/slack-desc b/games/jfsw/slack-desc index 7f466bba1c9c..1dc31d514463 100644 --- a/games/jfsw/slack-desc +++ b/games/jfsw/slack-desc @@ -12,7 +12,7 @@ jfsw: The aim of this port is to present Shadow Warrior as closely as jfsw: possible to the original game while adding optional features to expand jfsw: the possibilities of the game. jfsw: -jfsw: +jfsw: Package built with SDL @SDLVER@ and @WITHFLUID@ fluidsynth. jfsw: jfsw: jfsw: -- cgit v1.2.3