From e6b5b84db59f58477ac1805d67dfdbb062aeee04 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 8 Aug 2016 17:18:53 -0400 Subject: [PATCH] games/eduke32: Updated for version 20160704_5811. --- games/eduke32/README | 7 +++- games/eduke32/compilefix.diff | 12 +++++++ games/eduke32/eduke32.SlackBuild | 58 +++++++++++++++++++++++++++----- games/eduke32/eduke32.info | 6 ++-- games/eduke32/eduke32.wrapper | 55 +++++++++++++++++++++++++----- games/eduke32/slack-desc | 2 +- 6 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 games/eduke32/compilefix.diff diff --git a/games/eduke32/README b/games/eduke32/README index f04c35e737..cca6e9518e 100644 --- a/games/eduke32/README +++ b/games/eduke32/README @@ -8,8 +8,13 @@ Nukem 3D. For convenience, the shareware GRP file has been packaged as eduke32_shareware_data, also available from slackbuilds.org. See README_game_data.txt +eduke32 is an SDL application. It can be built with either SDL 1.2 +(included in Slackware), or SDL 2 (from SlackBuilds.org). By default, SDL +2 is used if it's installed, otherwise SDL 1.2 is used. To force building +with SDL 1.2, export SDL2=no in the environment before building eduke32. + If you want to play the HRP (High Resolution Pack), get the -eduke32_hires_pack package from slackbuilds.org +eduke32_hires_pack package from slackbuilds.org. To hear the in-game music, either use the Music Pack (see eduke32_hires_pack), or else install a set of MIDI patches (either diff --git a/games/eduke32/compilefix.diff b/games/eduke32/compilefix.diff new file mode 100644 index 0000000000..7b7ae7e49a --- /dev/null +++ b/games/eduke32/compilefix.diff @@ -0,0 +1,12 @@ +diff -Naur eduke32_20160704-5811.orig/build/src/util/generateicon.c eduke32_20160704-5811/build/src/util/generateicon.c +--- eduke32_20160704-5811.orig/build/src/util/generateicon.c 2013-10-06 03:50:16.000000000 -0400 ++++ eduke32_20160704-5811/build/src/util/generateicon.c 2016-08-07 23:58:35.091530858 -0400 +@@ -64,7 +64,7 @@ + + memset(&icon, 0, sizeof(icon)); + +- kpzload(argv[1], (intptr_t*)&icon.pixels, (int32_t*)&bpl, (int32_t*)&icon.width, (int32_t*)&icon.height); ++ kpzload(argv[1], (intptr_t*)&icon.pixels, (int32_t*)&icon.width, (int32_t*)&icon.height); + if (!icon.pixels) { + Bfprintf(stderr, "Failure loading %s\n", argv[1]); + return 1; diff --git a/games/eduke32/eduke32.SlackBuild b/games/eduke32/eduke32.SlackBuild index 0e8f1d28be..d0fb64ceec 100644 --- a/games/eduke32/eduke32.SlackBuild +++ b/games/eduke32/eduke32.SlackBuild @@ -6,8 +6,21 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20160808 bkw: +# - update for 20160704_5811 +# - install samples/ to the doc dir, not the game data dir +# - rework wrapper script to let mods like bloodcm be installed +# system-wide in /usr/share/games/eduke32 +# - add compilefix.diff to get the tools to build +# - support SDL2 build, add SDL2=no to force SDL1 +# - use OPTIMIZATIONS instead of ARCH for $SLKCFLAGS, upstream +# changed the build a bit +# - undocumented VPX flag now defaults to "yes", since libvpx is a +# core Slackware 14.2 package +# - slack-desc shows SDL version and whether or not libvpx was used. + PRGNAM=eduke32 -VERSION=${VERSION:-20150510_5182} +VERSION=${VERSION:-20160704_5811} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -18,14 +31,14 @@ OUTPUT=${OUTPUT:-/tmp} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" @@ -52,10 +65,16 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -if [ "${VPX:-no}" != "yes" ]; then +# this was always undocumented, defaulted to "no" in Slack <= 14.1. +# should be safe to default to "yes" now that 14.2 has libvpx. +if [ "${VPX:-yes}" != "yes" ]; then VPXFLAG="USE_LIBVPX=0" +else + ANDVPX=" and libvpx" fi +patch -p1 < $CWD/compilefix.diff + # On some systems, the game spits out tons of warnings: # Error: glGetTexLevelParameteriv returned GL_FALSE! # These don't seem to actually hurt anything (the game looks @@ -63,12 +82,31 @@ fi # the log output. sed -i '/"Error: glGetTexLevelParameteriv/d' build/src/texcache.c +# SDL2 might be preferred for some users. Specifically, those of us +# who use a left-handed mouse (SDL1 gets the button mappings backwards). +SDL2=${SDL2:-auto} +if [ "$SDL2" = "auto" ]; then + sdl2-config --version >/dev/null && SDL_TARGET=2 +elif [ "$SDL2" = "yes" ]; then + SDL_TARGET=2 +else + SDL_TARGET=1 +fi + # Mildly confusing: the Makefile uses ARCH for arch-specific cflags -make ARCH="$SLKCFLAGS" $VPXFLAG SDL_TARGET=1 +make \ + ARCH="" \ + OPTIMIZATIONS="$SLKCFLAGS" \ + SDL_TARGET=$SDL_TARGET \ + $VPXFLAG # Build the utilities, if requested. if [ "${BUILD_UTILS:-yes}" = "yes" ]; then - make utils ARCH="$SLKCFLAGS" $VPXFLAG SDL_TARGET=1 + make utils \ + OPTIMIZATIONS="$SLKCFLAGS" \ + ARCH="" \ + $VPXFLAG \ + SDL_TARGET=$SDL_TARGET \ for i in kextract kgroup transpal wad2art wad2map; do install -s -D -m0755 $i $PKG/usr/games/$i @@ -92,7 +130,6 @@ install -D -m0755 $CWD/$PRGNAM.wrapper $PKG/usr/games/$PRGNAM mkdir -p $PKG/usr/share/games/$PRGNAM cd package/sdk cp *.hlp *.HLP names.h tiles.cfg $PKG/usr/share/games/$PRGNAM -cp -r samples $PKG/usr/share/games/$PRGNAM/samples cd - mkdir -p $PKG/usr/share/applications @@ -104,13 +141,16 @@ cp $CWD/$PRGNAM.png $PKG/usr/share/pixmaps mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp build/buildlic.txt source/gpl-2.0.txt $CWD/README_game_data.txt \ $PKG/usr/doc/$PRGNAM-$VERSION +cp -r package/sdk/samples $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild ( cd $PKG/usr/share/games/$PRGNAM ln -s ../../../doc/$PRGNAM-$VERSION/README_game_data.txt . ) mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +sed -e "s,@SDL_TARGET@,$SDL_TARGET," \ + -e "s,@ANDVPX@,$ANDVPX," \ + $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG diff --git a/games/eduke32/eduke32.info b/games/eduke32/eduke32.info index bcba259743..9755c65cbe 100644 --- a/games/eduke32/eduke32.info +++ b/games/eduke32/eduke32.info @@ -1,8 +1,8 @@ PRGNAM="eduke32" -VERSION="20150510_5182" +VERSION="20160704_5811" HOMEPAGE="http://www.eduke32.com/" -DOWNLOAD="http://dukeworld.duke4.net/eduke32/synthesis/20150510-5182/eduke32_src_20150510-5182.tar.xz" -MD5SUM="b5b0ba822d9e1fffdd7132374bb36540" +DOWNLOAD="http://dukeworld.duke4.net/eduke32/synthesis/20160704-5811/eduke32_src_20160704-5811.tar.xz" +MD5SUM="979df7dfbe3584f88b40cdab88e37f4a" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" diff --git a/games/eduke32/eduke32.wrapper b/games/eduke32/eduke32.wrapper index 64696863bd..7509c7f09d 100644 --- a/games/eduke32/eduke32.wrapper +++ b/games/eduke32/eduke32.wrapper @@ -1,24 +1,63 @@ #!/bin/sh -# Wrapper script for eduke32 and mapster32 -# Ensure ~/.eduke32 exists, populate with a symlink forest -# (Need this because the game normally expects to run from its own dir) +# Wrapper script for eduke32 and mapster32. +# Ensure ~/.eduke32 exists, populate with a symlink forest. +# Need this because the game normally expects to run from its own dir. +# This version supports game mods. Currently only tested with bloodcm. SHAREDIR=/usr/share/games/eduke32 BINDIR=/usr/libexec/eduke32 +USERDIR=$HOME/.eduke32 -PROG="`echo $0 | sed 's/.*\///'`" -mkdir -p ~/.eduke32 +PROG="$( basename $0 )" +mkdir -p $USERDIR -if ! cd ~/.eduke32; then - echo 2>&1 "$PROG: Can't create ~/.eduke32 directory" +if ! cd $USERDIR; then + echo 2>&1 "$PROG: Can't create $USERDIR directory" exit 1 fi -for i in samples autoload m32help.hlp SEHELP.HLP STHELP.HLP names.h tiles.cfg; do +# These files need to be present, but not writable, symlinks +# to /usr/share are OK. +for i in m32help.hlp SEHELP.HLP STHELP.HLP names.h tiles.cfg; do if [ -e $SHAREDIR/$i -a ! -e $i ]; then ln -s $SHAREDIR/$i $i fi done +# For directories, it's more complex. + +# We don't know in advance what directories might be present, since +# packages can install game mods (e.g. bloodcm). So link them all. +# Unfortunately it can't be a simple symlink, because the *.cfg files +# inside mod directories need to really exist in $USERDIR, writable by +# the user, so he can save his settings. + +# The autoload subdir isn't a mod, but it's treated the same way so +# individual users can have different autoload stuff. If you install +# eduke32_hires_pack, this means users can disable it by removing their +# symlink in ~/.eduke32/autoload (without disturbing anything else they +# might have in autoload). + +# I wish there were a simpler way to do this. The only other solution +# would be to patch the eduke32 source, to make it save .cfg files in a +# different location than the game data dirs... but I'd rather handle it +# with a wrapper script because it's easier to debug. + +# So, here's how we handle the directories: +for i in $SHAREDIR/*/; do + dir=$( basename $i ) + if [ ! -e $dir ]; then + mkdir $dir + ln -s $SHAREDIR/$dir/* $dir + rm -f $dir/*.cfg + cp $SHAREDIR/$dir/*.cfg $dir + fi +done + +# If this is left over in $USERDIR, it's from a previous version of this +# script, and it doesn't belong there. samples/ isn't a mod, it's actually +# documentation, and is now installed in /usr/doc/eduke32-$VERSION. +rm -f samples + exec $BINDIR/$PROG "$@" diff --git a/games/eduke32/slack-desc b/games/eduke32/slack-desc index 187fa210d7..9d6373e6a7 100644 --- a/games/eduke32/slack-desc +++ b/games/eduke32/slack-desc @@ -15,5 +15,5 @@ eduke32: eduke32: To play the game, you will need the DUKE3D.GRP file from either the eduke32: Duke Nukem 3D CD-ROM, or from the shareware version of Duke Nukem 3D. eduke32: -eduke32: +eduke32: This package built with SDL @SDL_TARGET@@ANDVPX@. eduke32: