From 35cd4675691967bb8b0636f1365c4e48467696cb Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 23 Jan 2018 03:03:14 -0500 Subject: games/zsnes: Partial 64-bit support. Signed-off-by: B. Watson --- games/zsnes/README | 8 ++++ games/zsnes/slack-desc | 2 +- games/zsnes/zsnes.SlackBuild | 92 ++++++++++++++++++++++++++++---------------- games/zsnes/zsnes.info | 6 ++- 4 files changed, 72 insertions(+), 36 deletions(-) diff --git a/games/zsnes/README b/games/zsnes/README index 90b0f21ee0..303d2ae76e 100644 --- a/games/zsnes/README +++ b/games/zsnes/README @@ -1,5 +1,13 @@ +zsnes (SNES emulator) + ZSNES is a Super Nintendo emulator programmed by zsKnight and _Demo_. On April 2, 2001 the ZSNES project was GPL'ed and its source released to the public. It currently runs on Windows, Linux, FreeBSD, and DOS. Remember that this is a public beta so don't expect this to run on your machine. + +Note to 64-bit users: Since zsnes can't be compiled for 64-bit, a +"statified" 32-bit static binary is used. This allows running zsnes on +a pure 64-bit system, but *without* OpenGL support (meaning the maximum +window size is 640x480). If you use multilib, you can get OpenGL support +by building a 32-bit native zsnes package instead. diff --git a/games/zsnes/slack-desc b/games/zsnes/slack-desc index 0afb252ae8..0c4a74c255 100644 --- a/games/zsnes/slack-desc +++ b/games/zsnes/slack-desc @@ -6,7 +6,7 @@ # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| -zsnes: zsnes (SNES games emulator) +zsnes: zsnes (SNES emulator) zsnes: zsnes: ZSNES is a Super Nintendo emulator programmed by zsKnight and _Demo_. zsnes: On April 2, 2001 the ZSNES project was GPL'ed and its source released diff --git a/games/zsnes/zsnes.SlackBuild b/games/zsnes/zsnes.SlackBuild index 9e6f2dfad5..17bd115979 100644 --- a/games/zsnes/zsnes.SlackBuild +++ b/games/zsnes/zsnes.SlackBuild @@ -2,8 +2,9 @@ # Slackware build script for zsnes -# Copyright (c) 2008, Antonio Hernández Blas -# Copyright (c) 2010, 2012, Carlos Corbacho +# Copyright (c) 2008, Antonio Hernández Blas +# Copyright (c) 2010, 2012, Carlos Corbacho +# Copyright (c) 2018, B. Watson # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -22,9 +23,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20180123 bkw: Finally, 64-bit support! Sort-of. Using a dirty hack. +# Also, move binary to /usr/games and man page to section 6. + PRGNAM=zsnes VERSION=${VERSION:-1.51b} -BUILD=${BUILD:-3} +BUILD=${BUILD:-4} TAG=${TAG:-_SBo} ZSNESSRC="$(echo $VERSION | tr -d .)src" @@ -48,7 +52,9 @@ if [ "$ARCH" = "i586" ]; then elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then - printf "\n Error: $PRGNAM won't compile on $ARCH \n \n" + echo "=== $ARCH detected, using statified binary" +else + printf "\n Error: $PRGNAM won't compile on $ARCH\n\n" exit 1 fi @@ -71,38 +77,58 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; -# GCC 4.7 fixes from Debian -cat $CWD/0012-Fix-build-with-gcc-4.7.patch | patch -p2 --verbose - -# Fix for libpng16 (thanks to Arch Linux) -# https://projects.archlinux.org/svntogit/community.git/plain/trunk/zsnes-1.51-libpng15.patch?h=packages/zsnes -patch -p1 < $CWD/zsnes-1.51-libpng15.patch - -CFLAGS="$SLKCFLAGS" \ -CXXFLAGS="$SLKCFLAGS" \ -force_arch="$ARCH" \ -./configure \ - --prefix=/usr \ - --enable-release \ - --disable-cpucheck \ - --disable-debugger - -CFLAGS="$SLKCFLAGS" \ -CXXFLAGS="$SLKCFLAGS" \ -force_arch="$ARCH" \ -make -make install DESTDIR=$PKG - -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +if [ "$ARCH" = "x86_64" ]; then + # Can't compile, so use a statified binary. This was prepared + # by compiling zsnes with the same configure flags as below, + # plus --disable-opengl, then converting with: + # $ statifier \ + # --set=LD_PRELOAD=/usr/lib/libudev.so:/usr/lib/libaoss.so:/usr/lib/libasound.so \ + # zsnes zsnes.static + # Unfortunately this won't work with OpenGL because the shared libs + # are driver-specific: I could preload the nvidia driver, but the + # result would only work on systems that use nvidia (not AMD or intel, + # or even nouveau). + mkdir -p $PKG/usr/games $PKG/usr/doc/$PRGNAM-$VERSION $PKG/usr/man/man1 + xz -d < $CWD/$PRGNAM.static.xz > $PKG/usr/games/$PRGNAM + chmod 755 $PKG/usr/games/$PRGNAM + + # Docs and man page still come from the source. + cp -a docs/* $PKG/usr/doc/$PRGNAM-$VERSION + cp -a linux/$PRGNAM.1 $PKG/usr/man/man1 +else + # GCC 4.7 fixes from Debian + cat $CWD/0012-Fix-build-with-gcc-4.7.patch | patch -p2 --verbose + + # Fix for libpng16 (thanks to Arch Linux) + # https://projects.archlinux.org/svntogit/community.git/plain/trunk/zsnes-1.51-libpng15.patch?h=packages/zsnes + patch -p1 < $CWD/zsnes-1.51-libpng15.patch + + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + force_arch="$ARCH" \ + ./configure \ + --prefix=/usr \ + --enable-release \ + --disable-cpucheck \ + --disable-debugger + + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + force_arch="$ARCH" \ + make + make install DESTDIR=$PKG + mv $PKG/usr/bin $PKG/usr/games # configure ignores --bindir, grr! + strip $PKG/usr/games/$PRGNAM +fi -( cd $PKG/usr/man || exit 1 - find . -type f -exec gzip -9 {} \; - for i in $(find . -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done -) +# Man page belongs in section 6, since this is a game. +mkdir -p $PKG/usr/man/man6 +sed '/^\.TH/s,1$,6,' $PKG/usr/man/man1/$PRGNAM.1 | \ + gzip -9c > $PKG/usr/man/man6/$PRGNAM.6.gz +rm -rf $PKG/usr/man/man1 # Add a .desktop file and icon for good menu integration -mkdir -p $PKG/usr/share/{applications,pixmaps} +mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps install -m 0644 $CWD/zsnes.desktop $PKG/usr/share/applications/zsnes.desktop install -m 0644 $CWD/zsnes.png $PKG/usr/share/pixmaps/zsnes.png diff --git a/games/zsnes/zsnes.info b/games/zsnes/zsnes.info index d30e8e0dc1..ab7ebe77cb 100644 --- a/games/zsnes/zsnes.info +++ b/games/zsnes/zsnes.info @@ -3,8 +3,10 @@ VERSION="1.51b" HOMEPAGE="http://www.zsnes.com" DOWNLOAD="http://zsnes.sf.net/zsnes151bsrc.tar.bz2" MD5SUM="904ee432f378609176ed30c01cf6ea28" -DOWNLOAD_x86_64="UNSUPPORTED" -MD5SUM_x86_64="" +DOWNLOAD_x86_64="http://zsnes.sf.net/zsnes151bsrc.tar.bz2 \ + http://urchlay.naptime.net/~urchlay/src/zsnes.static.xz" +MD5SUM_x86_64="904ee432f378609176ed30c01cf6ea28 \ + c2289a3cbe04b62fda1f4b896c04b275" REQUIRES="" MAINTAINER="B. Watson" EMAIL="yalhcru@gmail.com" -- cgit v1.2.3