summaryrefslogtreecommitdiffstats
path: root/games/snes9x/snes9x.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'games/snes9x/snes9x.SlackBuild')
-rw-r--r--games/snes9x/snes9x.SlackBuild238
1 files changed, 107 insertions, 131 deletions
diff --git a/games/snes9x/snes9x.SlackBuild b/games/snes9x/snes9x.SlackBuild
index c00c1ce2b3..ad26551806 100644
--- a/games/snes9x/snes9x.SlackBuild
+++ b/games/snes9x/snes9x.SlackBuild
@@ -1,61 +1,31 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for snes9x
-# 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.
-# 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.
-# - add --without-portaudio to configure args. snes9x runs about
-# 1 frame/sec if I start it up with the sound driver set to portaudio,
-# and I've gotten a report of it blasting high-volume white noise
-# thru the speakers if you switch to portaudio while a ROM is already
-# running. I can't see any reason to use it in favor of pulse, alsa,
-# oss, or sdl audio.
-# - don't extract windows, mac, old-school unix stuff from tarball.
-# uses 50% less $TMP space.
-
-# 20180623 bkw: update for 1.56.2.
-# 20180611 bkw:
-# - update for 1.56.1.
-# - switch the UI from gtk3 to gtk2, as 14.2's gtk3 is too old.
-# - add undocumented PULSE=no build option (in anticipation of 15.0's
-# pure-alsa-system).
-# - add SDL2 to REQUIRES. technically, it's not truly required: snes9x
-# only uses SDL2 to support joysticks. playing with the keyboard/mouse
-# would still work without it. 15.0 is coming soon, and will have SDL2
-# in the core OS, so don't bother me about this decision.
-# - update README, the snes9x_gtk build went away in 2010, no need to
-# mention it now. also add notes about upgrading from 1.55.
-# 20171221 bkw: use --without-system-zip to build bundled unzip, instead
-# of adding minizip as a dependency.
-# 20171213 bkw: update for 1.55.
-# 20170302 bkw: use long-format github URL
-# 20161015 bkw: update for 1.54.1. script has changed enough that it
-# can't build 1.53 any more.
+# 20230418 bkw: BUILD=2, make portaudio optional + autodetected.
+# 20230410 bkw: update for 1.62.3.
+# Most of the work needed for this update was done by M.Dinslage,
+# to whom I owe thanks. I updated the man page, and added the
+# non-GUI binary plus a man page for it.
+
+# For older change-comments, see ChangeLog.old (it was getting too long
+# to keep in the script).
+
+cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=snes9x
-VERSION=${VERSION:-1.57}
-BUILD=${BUILD:-1}
+VERSION=${VERSION:-1.62.3}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+SPIRVVER="2021-01-15"
+VULKVER="1.3.246"
+GLSLANGVER="12.1.0"
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -65,11 +35,17 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
+# Note: the flags we set here are followed by -O3, meaning the
+# -O2 does nothing. *shrug*
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
@@ -90,83 +66,70 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
-# Don't extract the stuff we don't need, this saves 7.9MB in $TMP.
+# Don't extract the stuff we don't need, this saves a few MB in $TMP.
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz \
- --wildcards --exclude '*/win32/*' \
- --exclude '*/macosx/*' --exclude '*/unix/*'
+ --wildcards \
+ --exclude '*/win32/*' \
+ --exclude '*/macosx/*'
cd $PRGNAM-$VERSION
+
+tar xvf $CWD/glslang-$GLSLANGVER.tar.gz \
+ -C external/glslang --strip-components=1
+tar xvf $CWD/SPIRV-Cross-$SPIRVVER.tar.gz \
+ -C external/SPIRV-Cross --strip-components=1
+tar xvf $CWD/Vulkan-Headers-$VULKVER.tar.gz \
+ -C external/vulkan-headers --strip-components=1
+
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 {} \+
-# 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"
+ PULSEOPT="-DUSE_PULSEAUDIO=OFF"
WITHPULSE=no
fi
WITHOSS=yes
if [ "${OSS:-no}" = "no" ]; then
- OSSOPT="--without-oss"
+ OSSOPT="-DUSE_OSS=OFF"
WITHOSS=no
fi
-CFLAGS="-g $SLKCFLAGS" \
-CXXFLAGS="-g $SLKCFLAGS" \
-./configure \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --bindir=/usr/games \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --with-netplay \
- --without-system-zip \
- --with-gtk2 \
- --without-gtk3 \
- --without-portaudio \
- $PULSEOPT \
- $OSSOPT \
- --build=$ARCH-slackware-linux
-
-make
-make install DESTDIR=$PKG
+WITH_PA=no
+PA_OPT="-DUSE_PORTAUDIO=OFF"
+if pkg-config --exists portaudio-2.0 && [ "${PORTAUDIO:-yes}" = "yes" ]; then
+ WITH_PA=yes
+ PA_OPT="-DUSE_PORTAUDIO=ON"
+fi
+
+SLKCFLAGS+=" -DNDEBUG"
+mkdir -p gtk/build
+cd gtk/build
+ cmake \
+ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_BINDIR=games \
+ $PULSEOPT $OSSOPT $PA_OPT \
+ -DCMAKE_INSTALL_DATAROOTDIR=share \
+ -DUSE_SYSTEMZIP=OFF \
+ -DCMAKE_BUILD_TYPE=Release ..
+ make VERBOSE=1
+ make install/strip DESTDIR=$PKG
+cd -
+
+# 20230410 bkw: Insidious weirdness: The bitmap icons all look the
+# same, but the .svg icon looks completely different. Just get rid
+# of it; we have the bitmap icons at every size we could want.
+rm -rf $PKG/usr/share/icons/hicolor/scalable
# RetroArch support, contributed by orbea (Hunter Sezen).
# Note that the source here is self-contained, there's no build-time
# dependency on RetroArch or libretro or such.
# snes9x_libretro-info originally came from:
# https://raw.githubusercontent.com/libretro/libretro-super/383f18fd7c36ffd5fe76ebac58e9e596dde67e66/dist/info/snes9x_libretro.info
-# Renamed .info => -info to avoid confusing SBo tools that deal with
+# Renamed .info => .info.txt to avoid confusing SBo tools that deal with
# SBo's .info files.
# 20181201 bkw: made this optional, auto-detected, and controllable
# via environment. It makes the build take 7x as long, no point wasting
@@ -185,47 +148,60 @@ esac
if [ "$build_ra" = "yes" ]; then
echo "=== Building libretro core"
( LIBNAM=${PRGNAM}_libretro
- cd ../libretro
+ PKGLIB=$PKG/usr/lib$LIBDIRSUFFIX
+ 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
+ install -sDm0755 $LIBNAM.so $PKGLIB/libretro/$LIBNAM.so
+ install -Dm0644 -o root -g root $CWD/$LIBNAM.info.txt \
+ $PKGLIB/libretro/info/$LIBNAM.info
)
else
echo "=== NOT building libretro core"
fi
+# Go ahead and include the non-gui binary. Note that it doesn't
+# support OSS or Pulse (only ALSA), so the OSS and PULSE environment
+# vars don't affect it.
+cd unix
+ CFLAGS="$SLKCFLAGS" \
+ CXXFLAGS="$SLKCFLAGS" \
+ ./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --enable-gamepad \
+ --enable-gzip \
+ --enable-screenshot \
+ --enable-zip \
+ --without-system-zip \
+ --build=$ARCH-slackware-linux
+ make
+cd -
+
+# No 'make install' target.
+install -s -m0755 unix/snes9x $PKG/usr/games/snes9x
+
+# Man pages written by SlackBuild author.
mkdir -p $PKG/usr/man/man6
gzip -9c $CWD/snes9x-gtk.6 > $PKG/usr/man/man6/snes9x-gtk.6.gz
-ln -s $PRGNAM-gtk.6.gz $PKG/usr/man/man6/$PRGNAM.6.gz
-ln -s $PRGNAM-gtk $PKG/usr/games/$PRGNAM
+gzip -9c $CWD/snes9x.6 > $PKG/usr/man/man6/snes9x.6.gz
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
+mkdir -p $PKGDOC
+cp -a LICENSE README* docs/* unix/docs/* unix/snes9x.conf.default $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
-# We don't need 3 copies of the LGPL v2.1 (we already have the GPL
-# and proprietary snes9x licenses...)
-cd $PKGDOC
- rm -f snes_ntsc_license.txt ${PRGNAM}_original_docs/lgpl-2.1.txt
- ln -s lgpl.txt snes_ntsc_license.txt
- ln -s ../lgpl.txt ${PRGNAM}_original_docs/lgpl-2.1.txt
-cd -
-
-cat data/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
-
mkdir -p $PKG/install
-sed -e "s,@WITHPULSE@,$WITHPULSE," \
- -e "s,@WITHOSS@,$WITHOSS," \
- -e "s,@build_ra@,$build_ra," \
+sed -e "s,@PU@,$WITHPULSE," \
+ -e "s,@OSS@,$WITHOSS," \
+ -e "s,@PA@,$WITH_PA," \
+ -e "s,@RA@,$build_ra," \
< $CWD/slack-desc \
> $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE