summaryrefslogtreecommitdiff
path: root/games/snes9x
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2018-12-01 06:17:07 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-12-09 13:17:26 +0700
commita37ec368d131665ded2ce402594c49d59951da90 (patch)
treec009c3b228658118c4b8c4ae2f76ba831aedb662 /games/snes9x
parentcad17332823a4ebe5f70605fed8a592877d27318 (diff)
downloadslackbuilds-a37ec368d131665ded2ce402594c49d59951da90.tar.gz
games/snes9x: Updated for version 1.57.
Signed-off-by: B. Watson <yalhcru@gmail.com>
Diffstat (limited to 'games/snes9x')
-rw-r--r--games/snes9x/README35
-rw-r--r--games/snes9x/doinst.sh1
-rw-r--r--games/snes9x/fix_config_file_segfaults.diff28
-rw-r--r--games/snes9x/libretro_lto_variable.diff112
-rw-r--r--games/snes9x/slack-desc2
-rw-r--r--games/snes9x/snes9x.SlackBuild104
-rw-r--r--games/snes9x/snes9x.info6
7 files changed, 257 insertions, 31 deletions
diff --git a/games/snes9x/README b/games/snes9x/README
index 7ecb15c3da..7583521398 100644
--- a/games/snes9x/README
+++ b/games/snes9x/README
@@ -5,16 +5,33 @@ emulator. It basically allows you to play most games designed for the SNES
and Super Famicom Nintendo game systems on your PC or Workstation. The
games include some real gems that were only ever released in Japan.
-RetroArch is an optional dependency to run the snes9x libretro core.
+When you first run snes9x:
-If you're upgrading from snes9x-1.55, you'll have to delete your old
-config file:
+- The first thing you'll want to do is configure the controls. By default
+ there are *no* controls set up; you'll be unable to play any games! The
+ config is under Options -> Preferences, in the Joypads tab. You can
+ configure either keyboard or joystick/gamepad controls, but not both.
- rm -rf ~/.snes9x
+- If the game audio is choppy or distorted, try setting the sound driver
+ to Pulse or ALSA (Options -> Preferences -> Sound tab). Specifically,
+ avoid SDL audio (unfortunately it's the default if PULSE=no).
-Apologies for any inconvenience.
+Notes:
-Also, with 1.56.1, you might notice some user interface differences. This
-is because 1.55 used GTK+-3.0, but 1.56 and newer require a version of
-GTK+-3.0 that's newer than Slackware 14.2 provides. So, starting with
-1.56, this build uses the GTK+-2.0 UI.
+- The package can optionally include the snes9x libretro core, for use
+ with RetroArch. By default, the core will be built if RetroArch is
+ installed. You can set RETROARCH=yes to force the core to be built,
+ or RETROARCH=no to forcibly disable the core. Note that RetroArch
+ doesn't have to be installed to build the libretro core, but it's
+ useless without RetroArch installed.
+
+- Starting with 1.56.1, you might notice some user interface
+ differences. This is because 1.55 used GTK+-3.0, but 1.56 and newer
+ require a version of GTK+-3.0 that's newer than Slackware 14.2
+ provides. So, starting with 1.56, this build uses the GTK+-2.0 UI.
+
+- Starting with 1.57, OSS audio is disabled by default. Most users
+ won't be affected, since pulseaudio is now the default audio system on
+ Slackware, and ALSA is the fallback option. If you *need* OSS support,
+ set OSS=yes in the script's environment. You may also disable PulseAudio
+ by setting PULSE=no in the environment.
diff --git a/games/snes9x/doinst.sh b/games/snes9x/doinst.sh
index 4a25de5e6f..65c7e2eeb9 100644
--- a/games/snes9x/doinst.sh
+++ b/games/snes9x/doinst.sh
@@ -7,4 +7,3 @@ if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
fi
fi
-
diff --git a/games/snes9x/fix_config_file_segfaults.diff b/games/snes9x/fix_config_file_segfaults.diff
new file mode 100644
index 0000000000..b67f14befd
--- /dev/null
+++ b/games/snes9x/fix_config_file_segfaults.diff
@@ -0,0 +1,28 @@
+diff --git a/gtk/src/gtk_config.cpp b/gtk/src/gtk_config.cpp
+index bf06de7..1ccd4f2 100644
+--- a/gtk/src/gtk_config.cpp
++++ b/gtk/src/gtk_config.cpp
+@@ -463,9 +463,9 @@ int Snes9xConfig::load_config_file ()
+ return -1;
+
+ std::string none;
+-#define inbool(key, var) var = cf.GetBool (key)
+-#define inint(key, var) var = cf.GetInt (key)
+-#define infloat(key, var) var = atof (cf.GetString (key, none).c_str())
++#define inbool(key, var) { if (cf.Exists (key)) var = cf.GetBool (key); }
++#define inint(key, var) { if (cf.Exists(key)) var = cf.GetInt (key); }
++#define infloat(key, var) { if (cf.Exists(key)) var = atof (cf.GetString (key, none).c_str()); }
+ #define instr(key, var) strcpy (var, cf.GetString (key, none).c_str())
+
+ #undef z
+@@ -683,8 +683,8 @@ int Snes9xConfig::load_config_file ()
+ hires_effect = CLAMP (hires_effect, 0, 2);
+ Settings.DynamicRateLimit = CLAMP (Settings.DynamicRateLimit, 1, 1000);
+ Settings.SuperFXClockMultiplier = CLAMP (Settings.SuperFXClockMultiplier, 50, 400);
+- ntsc_scanline_intensity = MAX (ntsc_scanline_intensity, 4);
+- scanline_filter_intensity = MAX (scanline_filter_intensity, 3);
++ ntsc_scanline_intensity = CLAMP (ntsc_scanline_intensity, 0, 4);
++ scanline_filter_intensity = CLAMP (scanline_filter_intensity, 0, 3);
+
+ return 0;
+ }
diff --git a/games/snes9x/libretro_lto_variable.diff b/games/snes9x/libretro_lto_variable.diff
new file mode 100644
index 0000000000..d2f0f5a4e8
--- /dev/null
+++ b/games/snes9x/libretro_lto_variable.diff
@@ -0,0 +1,112 @@
+diff --git a/libretro/Makefile b/libretro/Makefile
+index c0311b1..dd55ffd 100644
+--- a/libretro/Makefile
++++ b/libretro/Makefile
+@@ -2,6 +2,7 @@ DEBUG = 0
+ HAVE_EXCEPTIONS = 0
+ HAVE_STRINGS_H = 1
+
++LTO ?= -flto
+ SPACE :=
+ SPACE := $(SPACE) $(SPACE)
+ BACKSLASH :=
+@@ -45,9 +46,9 @@ endif
+
+ # Unix
+ ifneq (,$(findstring unix,$(platform)))
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ TARGET := $(TARGET_NAME)_libretro.so
+ fpic := -fPIC
+ ifneq ($(findstring SunOS,$(shell uname -a)),)
+@@ -70,9 +71,9 @@ ifneq (,$(findstring unix,$(platform)))
+
+ # OS X
+ else ifeq ($(platform), osx)
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ TARGET := $(TARGET_NAME)_libretro.dylib
+ fpic := -fPIC
+ SHARED := -dynamiclib
+@@ -102,9 +103,9 @@ else ifeq ($(platform), libnx)
+
+ # iOS
+ else ifneq (,$(findstring ios,$(platform)))
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ TARGET := $(TARGET_NAME)_libretro_ios.dylib
+ fpic := -fPIC
+ SHARED := -dynamiclib
+@@ -134,9 +135,9 @@ else ifneq (,$(findstring ios,$(platform)))
+
+ # Theos
+ else ifeq ($(platform), theos_ios)
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ DEPLOYMENT_IOSVERSION = 5.0
+ TARGET = iphone:latest:$(DEPLOYMENT_IOSVERSION)
+ ARCHS = armv7 armv7s
+@@ -159,9 +160,9 @@ else ifeq ($(platform), qnx)
+
+ # Vita
+ else ifeq ($(platform), vita)
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ TARGET := $(TARGET_NAME)_libretro_$(platform).so
+ fpic := -fPIC
+ CC = arm-vita-eabi-gcc$(EXE_EXT)
+@@ -199,9 +200,9 @@ else ifneq (,$(filter $(platform), ps3 sncps3 psl1ght))
+
+ # Xbox 360
+ else ifeq ($(platform), xenon)
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ TARGET := $(TARGET_NAME)_libretro_xenon360.a
+ CC = xenon-gcc$(EXE_EXT)
+ CXX = xenon-g++$(EXE_EXT)
+@@ -465,9 +466,9 @@ CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
+ CXXFLAGS += -D_CRT_SECURE_NO_DEPRECATE
+ # Windows
+ else
+- CFLAGS += -flto
+- CXXFLAGS += -flto
+- LDFLAGS += -flto
++ CFLAGS += $(LTO)
++ CXXFLAGS += $(LTO)
++ LDFLAGS += $(LTO)
+ TARGET := $(TARGET_NAME)_libretro.dll
+ CC = gcc
+ CXX = g++
+@@ -569,7 +570,7 @@ $(TARGET): $(OBJECTS)
+ ifeq ($(STATIC_LINKING), 1)
+ $(AR) rcs $@ $(OBJECTS)
+ else
+- $(LD) $(fpic) $(SHARED) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
++ +$(LD) $(fpic) $(SHARED) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
+ endif
+
+ %.o: %.cpp
diff --git a/games/snes9x/slack-desc b/games/snes9x/slack-desc
index 66b39ead30..d08f491b0f 100644
--- a/games/snes9x/slack-desc
+++ b/games/snes9x/slack-desc
@@ -14,6 +14,6 @@ snes9x: for the SNES and Super Famicom Nintendo game systems on your PC or
snes9x: Workstation. The games include some real gems that were only ever
snes9x: released in Japan.
snes9x:
-snes9x:
+snes9x: Build options: PULSE=@WITHPULSE@ OSS=@WITHOSS@ RETROARCH=@build_ra@
snes9x:
snes9x:
diff --git a/games/snes9x/snes9x.SlackBuild b/games/snes9x/snes9x.SlackBuild
index a3de7ffc59..c00c1ce2b3 100644
--- a/games/snes9x/snes9x.SlackBuild
+++ b/games/snes9x/snes9x.SlackBuild
@@ -6,6 +6,21 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+# 20181201 bkw:
+# - update for 1.57.
+# - disable OSS audio by default, add OSS=yes option.
+# - autodetect RetroArch, add RETROARCH=yes|no option.
+# - document the above in the README.
+# - document PULSE=no io README.
+# - stop including snes9x.conf.default in the docdir, since it's
+# outdated and will cause snes9x to segfault if you try to use it!
+# - since we now have 3 build options, make slack-desc show them.
+# - add patch from upstream to speed up linking the libretro core if
+# -jX is in MAKEFLAGS.
+# - add patch fro upstream to stop segfaulting if the config file is
+# missing the ScanlineIntensity variable. Means I can finaly remove
+# the "you should delete your old config file" from the README.
+
# 20180730 bkw:
# - BUILD=2.
# - add libretro/RetroArch, thanks to orbea.
@@ -38,8 +53,8 @@
# can't build 1.53 any more.
PRGNAM=snes9x
-VERSION=${VERSION:-1.56.2}
-BUILD=${BUILD:-2}
+VERSION=${VERSION:-1.57}
+BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -84,20 +99,50 @@ chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
-# Fix the libretro build for 14.2.
-# From upstream git: https://github.com/snes9xgit/snes9x.git
-# commits abb4b4c39 and a77b3b379b
-patch -p1 < $CWD/libretro.diff
+# Various patches, depending on the version we're building. Currently
+# this script should work with 1.56.2 and 1.57. Anything older and you're
+# on your own.
+
+# For 1.56.2, libretro.diff fixes the libretro build, it's upstream's
+# commits abb4b4c39 and a77b3b379b. Already included in 1.57.
+
+# For 1.57 (and 1.56.2 I hope), fix_config_file_segfaults.diff is
+# upstream's commit 5e9f068. libretro_lto_variable is 21d6275 (thanks
+# to orbea for coding this one & sending it upstream, based on my vague
+# idea). Future 1.57.x or 1.58 will include these already.
+
+# At some point, this set of cases will be too complex for me to want to
+# maintain & test it, and it'll go away (this script will only support
+# the latest version, whatever that happens to be).
+
+case "$VERSION" in
+ 1.5[0-5]*|1.[0-4]*) ;; # doubt these build anyway
+ 1.56.2) PATCHES="libretro" ;;
+ 1.57) PATCHES="fix_config_file_segfaults libretro_lto_variable";;
+ *) ;;
+esac
+
+[ -n "$PATCHES" ] && for p in $PATCHES; do
+ [ -e "$CWD/$p.diff" ] && patch -p1 < "$CWD/$p.diff"
+done
cd gtk
./autogen.sh
+WITHPULSE=yes
if [ "$PULSE" = "no" ] || ! pkg-config --exists libpulse; then
PULSEOPT="--without-pulseaudio"
+ WITHPULSE=no
+fi
+
+WITHOSS=yes
+if [ "${OSS:-no}" = "no" ]; then
+ OSSOPT="--without-oss"
+ WITHOSS=no
fi
-CFLAGS="$SLKCFLAGS" \
-CXXFLAGS="$SLKCFLAGS" \
+CFLAGS="-g $SLKCFLAGS" \
+CXXFLAGS="-g $SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
@@ -110,10 +155,11 @@ CXXFLAGS="$SLKCFLAGS" \
--without-gtk3 \
--without-portaudio \
$PULSEOPT \
+ $OSSOPT \
--build=$ARCH-slackware-linux
make
-make install-strip DESTDIR=$PKG
+make install DESTDIR=$PKG
# RetroArch support, contributed by orbea (Hunter Sezen).
# Note that the source here is self-contained, there's no build-time
@@ -122,13 +168,32 @@ make install-strip DESTDIR=$PKG
# https://raw.githubusercontent.com/libretro/libretro-super/383f18fd7c36ffd5fe76ebac58e9e596dde67e66/dist/info/snes9x_libretro.info
# Renamed .info => -info to avoid confusing SBo tools that deal with
# SBo's .info files.
-( LIBNAM=${PRGNAM}_libretro
- cd ../libretro
- make
- install -sDm0755 $LIBNAM.so $PKG/usr/lib${LIBDIRSUFFIX}/libretro/$LIBNAM.so
- install -Dm0644 $CWD/$LIBNAM-info \
- $PKG/usr/lib${LIBDIRSUFFIX}/libretro/info/$LIBNAM.info
-)
+# 20181201 bkw: made this optional, auto-detected, and controllable
+# via environment. It makes the build take 7x as long, no point wasting
+# time building it if it's not wanted/needed.
+
+case "$RETROARCH" in
+ yes) build_ra=yes ;;
+ no) build_ra=no ;;
+ *) if [ -x /usr/share/games/retroarch ]; then
+ build_ra=yes
+ else
+ build_ra=no
+ fi ;;
+esac
+
+if [ "$build_ra" = "yes" ]; then
+ echo "=== Building libretro core"
+ ( LIBNAM=${PRGNAM}_libretro
+ cd ../libretro
+ make LTO="-flto=jobserver"
+ install -sDm0755 $LIBNAM.so $PKG/usr/lib${LIBDIRSUFFIX}/libretro/$LIBNAM.so
+ install -Dm0644 $CWD/$LIBNAM-info \
+ $PKG/usr/lib${LIBDIRSUFFIX}/libretro/info/$LIBNAM.info
+ )
+else
+ echo "=== NOT building libretro core"
+fi
mkdir -p $PKG/usr/man/man6
gzip -9c $CWD/snes9x-gtk.6 > $PKG/usr/man/man6/snes9x-gtk.6.gz
@@ -138,6 +203,7 @@ ln -s $PRGNAM-gtk $PKG/usr/games/$PRGNAM
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
OLDDOC=$PKGDOC/${PRGNAM}_original_docs
mkdir -p $OLDDOC
+rm -f ../docs/snes9x.conf.default # outdated, useless
cp -a doc/* $PKGDOC
cp -a ../docs/* $OLDDOC
cat $CWD/README_docs.txt > $PKGDOC/README_docs.txt
@@ -154,7 +220,11 @@ cd -
cat data/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
+sed -e "s,@WITHPULSE@,$WITHPULSE," \
+ -e "s,@WITHOSS@,$WITHOSS," \
+ -e "s,@build_ra@,$build_ra," \
+ < $CWD/slack-desc \
+ > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
diff --git a/games/snes9x/snes9x.info b/games/snes9x/snes9x.info
index 1f098c0ddb..da8405ae11 100644
--- a/games/snes9x/snes9x.info
+++ b/games/snes9x/snes9x.info
@@ -1,8 +1,8 @@
PRGNAM="snes9x"
-VERSION="1.56.2"
+VERSION="1.57"
HOMEPAGE="https://github.com/snes9xgit/snes9x"
-DOWNLOAD="https://github.com/snes9xgit/snes9x/archive/1.56.2/snes9x-1.56.2.tar.gz"
-MD5SUM="a92f7a31477caeeb68715d939443afd2"
+DOWNLOAD="https://github.com/snes9xgit/snes9x/archive/1.57/snes9x-1.57.tar.gz"
+MD5SUM="881b740d08a7d42d4a33dee962dcdbdc"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="SDL2"