games/zsnes: Partial 64-bit support.

Signed-off-by: B. Watson <yalhcru@gmail.com>
This commit is contained in:
B. Watson 2018-01-23 03:03:14 -05:00 committed by Willy Sudiarto Raharjo
parent f06c9cfe6b
commit 35cd467569
4 changed files with 68 additions and 32 deletions

View file

@ -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.

View file

@ -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

View file

@ -2,8 +2,9 @@
# Slackware build script for zsnes
# Copyright (c) 2008, Antonio Hernández Blas <hba.nihilismus@gmail.com>
# Copyright (c) 2010, 2012, Carlos Corbacho <carlos@strangeworlds.co.uk>
# Copyright (c) 2008, Antonio Hernández Blas <email removed>
# Copyright (c) 2010, 2012, Carlos Corbacho <email removed>
# Copyright (c) 2018, B. Watson <yalhcru@gmail.com>
# 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
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
# 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
# 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
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
force_arch="$ARCH" \
./configure \
--prefix=/usr \
--enable-release \
--disable-cpucheck \
--disable-debugger
# 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" \
make
make install DESTDIR=$PKG
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
force_arch="$ARCH" \
./configure \
--prefix=/usr \
--enable-release \
--disable-cpucheck \
--disable-debugger
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
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

View file

@ -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"