aboutsummaryrefslogtreecommitdiff
path: root/games/mame
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-11-15 12:51:46 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-12-04 10:08:55 +0700
commit9be4a33425f8f6952a45a8edfd7ddef1575ff071 (patch)
tree757b24da96f645f6e5471a26af48f0d8a39d8a46 /games/mame
parent2ed9033c395bf849c262074ff6f337a788e7df5b (diff)
games/mame: Updated for version 0.237.
Signed-off-by: B. Watson <yalhcru@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'games/mame')
-rw-r--r--games/mame/README16
-rw-r--r--games/mame/README_ccache.txt130
-rw-r--r--games/mame/README_gcc9.txt60
-rw-r--r--games/mame/README_groovy.txt96
-rw-r--r--games/mame/doinst.sh9
-rw-r--r--games/mame/gm0237sr002e.diff.xzbin0 -> 74192 bytes
-rw-r--r--games/mame/mame.SlackBuild212
-rw-r--r--games/mame/mame.info6
-rw-r--r--games/mame/mame.ini296
-rw-r--r--games/mame/mkgroovy.sh114
-rw-r--r--games/mame/slack-desc2
11 files changed, 701 insertions, 240 deletions
diff --git a/games/mame/README b/games/mame/README
index c836db4ad060f..01a4351281f41 100644
--- a/games/mame/README
+++ b/games/mame/README
@@ -1,11 +1,9 @@
-Note: I'm aware that this isn't the latest version of MAME. However,
-it's the latest version that will compile on stock Slackware 14.2. If
-you *really* need the latest version, see README_gcc9.txt.
+mame (Multiple Arcade Machine Emulator)
-MAME stands for Multiple Arcade Machine Emulator. When used in
+MAME stands for Multiple Arcade Machine Emulator. When used in
conjunction with images of the original arcade game's ROM and disk
data, MAME attempts to reproduce that game as faithfully as possible
-on a more modern general purpose computer. MAME can currently emulate
+on a more modern general purpose computer. MAME can currently emulate
several thousand different classic arcade video games from the late
1970s through the modern era.
@@ -20,10 +18,6 @@ separate MESS build or binary.
This build requires around 3.5GB of storage in /tmp (or whatever you
set TMP to in the environment).
-Optionally, MAME can be built with a debugger for emulated ROM
-code. You don't need this just to play the games; it's mainly useful
-for developing MAME itself. To build the debugger, first install qt5,
-then set QTDEBUG=yes in the environment before building mame.
-
-Optionally, MAME can be built with the GroovyMAME patch. See
+Optionally, MAME can be built with the GroovyMAME patch. Export
+GROOVY=yes in the script's environment. If it doesn't work, see
README_groovy.txt for details.
diff --git a/games/mame/README_ccache.txt b/games/mame/README_ccache.txt
new file mode 100644
index 0000000000000..e58f94b279470
--- /dev/null
+++ b/games/mame/README_ccache.txt
@@ -0,0 +1,130 @@
+Notes about building modern mame with ccache...
+
+TL;DR version: I had to use clang and clang++ (not gcc and g++) to get
+ccache to work with mame, and add timestamps to the GroovyMAME patch
+to make it work with ccache.
+
+mame uses a precompiled header (PCH), called emu.h.gch. It gets
+created by precompiling emu.h, which is just a list of #include
+directives that include every header in mame's emulation core.
+
+This speeds up the build approximately 50% (cuts the build time in
+half)... you can test this by passing PRECOMPILE=0 to mame's make
+command. On my test box, it takes approximately 1h45m to build with
+gcc using the precompiled headers, and about twice as long (3h30m)
+without. So far so good.
+
+If you build with ccache and PCH (aka without PRECOMPILE=0), either
+with "ccache g++" or via symlinks, the 2nd build takes just as long as
+the first. ccache wasn't able to save any time... why not?
+
+To get ccache to even *try* to work with precompiled headers, you
+have to 'export CCACHE_SLOPPINESS=time_macros'. However, it doesn't
+actually fix the problem if you're using gcc.
+
+One "fix" would be to disable use of emu.cgh (PRECOMPILE=0). But
+that makes the first build take 2x as long (though later builds would
+indeed benefit from ccache). But can we get the best of both worlds?
+
+When gcc compiles a header into a .gch file, it "bakes in" the address
+the kernel gave it when it allocated memory... Since Slackware's
+kernels (and pretty much all other distros) have ASLR (address space
+layout randomization) enabled, this means that given identical input,
+gcc will generate a slightly different .gch file as output. You
+can easily test this yourself:
+
+ echo 'extern int foo(int bar);' > a.h
+ g++ -o a.gch a.h
+ md5sum a.gch
+
+Now repeat the last 2 commands:
+ g++ -o a.gch a.h
+ md5sum a.gch
+
+The md5sum will be different... it's possible to disable ASLR on a
+running x86_64 kernel (echo 0 > /proc/sys/kernel/randomize_va_space),
+which will cause gcc to generate an identical .gch every time...
+but last I checked, this doesn't work on 32-bit x86. Plus, ASLR is
+there for a reason: it's a security mechanism.
+
+ccache dutifully caches the .gch file, indexed by its hash... but
+on the next attempt to build mame with ccache, the .gch file it
+generates (early in the build) will have different contents, thus
+ccache computes a different hash, and correctly finds no cache entry
+for that hash. So, every C++ source file that uses emu.gch (which is
+all of them) will be a cache miss and get recompiled. Whoops.
+
+So what to do? Well, it turns out that clang++ doesn't have this
+problem: given identical input, it produces the same .gch every time,
+regardless of whether ASLR is enabled or not. Note: "identical input"
+includes not only the contents of emu.h and the headers it includes,
+but the timestamps on those headers as well!
+
+Unfortunately, on my test box at least, clang/clang++ takes 10%
+longer to build mame than gcc/g++. I've seen various blog/forum posts
+claiming that clang builds mame faster than gcc, but these were all
+from a few years ago. To me, this 10% penalty is worth it: whenever
+there's a new mame release, I have to test any changes I made to the
+SlackBuild, which involves running it repeatedly. The first run will
+take about 2 hours, but the 2nd and later ones will take <10 minutes.
+
+There's a bit more to the story than just using clang++: I
+noticed that with the GroovyMAME patch applied, ccache would still
+fail... this turns out to be because, even with CCACHE_SLOPPINESS set
+to include_file_mtime, ccache still rejects the cached emu.gch. The
+is because emu.gch is made from emu.h, which contains a bunch of
+"#include <whatever>"... and the timestamps of those included files
+get baked into the .gch file that clang++ generates.
+
+Try another test:
+
+ echo '#include "b.h"' > a.h
+ echo 'extern int foo(int bar);' > b.h
+ clang++ -o a.gch a.h
+ md5sum a.gch
+
+Now repeat the last 2 commands:
+
+ clang++ -o a.gch a.h
+ md5sum a.gch
+
+Same md5sum, right? Now:
+
+ sleep 2
+ touch b.h
+ clang++ -o a.gch a.h
+ md5sum a.gch
+
+Different md5sum. clang++ produced a different a.gch because b.h's
+timestamp changed. Notice we aren't using ccache for the test code:
+this is a feature (or misfeature?) of clang++ itself.
+
+The reason this was a problem with mame + the groovy patch is that the
+groovy patch as sent to us by github.com's REST API doesn't include
+timestamps (normally they appear on the diff lines that begin with
+'--- filename' and '+++ filename'). This isn't github's fault: the
+regular 'git diff' command doesn't put timestamps in its diffs, and
+the API is just running that for us, remotely.
+
+So on every run of the SlackBuild, ccache runs clang++ to generate
+emu.gch, and the emu.gch contents include the timestamps of the
+patched includes... which are set to the time the patch happened to be
+applied! This means that any file that includes emu.gch (pretty much
+all of them!) would be a cache miss and have to be recompiled. So on
+every run, ccache would refuse to use *any* cached result from the
+previous run!
+
+CCACHE_SLOPPINESS=include_file_mtime seems like it should fix the
+problem, but it doesn't. It would have worked if we weren't using
+PCH...
+
+The solution was to add timestamps to the context headers in the .diff
+(which is done in mkgroovy.sh) and use "patch -f -Z" to force patch to
+apply the timestamps.
+
+If the diff had been made by the regular diff command, it would have
+had timestamps already, and ccache would have Just Worked.
+
+If mame didn't use precompiled headers, the lack of timestamps
+wouldn't have caused a problem (or if they had, CCACHE_SLOPPINESS
+could have worked around it).
diff --git a/games/mame/README_gcc9.txt b/games/mame/README_gcc9.txt
deleted file mode 100644
index f89329b1d277d..0000000000000
--- a/games/mame/README_gcc9.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-As of mame-0.215, it's no longer possible to compile mame with Slack
-14.2's gcc-5. mame-0.214 is the last version that can be built, so this
-SlackBuild is stuck at that version.
-
-However, if you're willing to go beyond stock Slackware, it's possible
-to build newer versions of mame. There are gcc-9.2.0 packages for 14.2
-here:
-
-http://slackware.uk/slackware/unsupported/gcc-9.2.0-for-Slackware-14.2/
-
-Make sure you read the README, then download the gcc-9.2.0 and
-gcc-g++-9.2.0 .txz packages for your architecture (you won't need the
-other languages such as fortran and go). Before installing them, remove
-your stock gcc and gcc-g++ packages with:
-
-# removepkg gcc gcc-g++
-
-(You don't have to remove the other languages such as gcc-fortran here)
-
-Install the gcc packages you just downloaded:
-
-# installpkg gcc-*9.2.0*.txz
-
-Then you can download the newer mame source from:
-
-https://github.com/mamedev/mame/releases/
-
-You want the source code (filename such as mame0217.tar.gz). Save the
-file in the same directory as the SlackBuild, cd into that directory,
-then build mame with a command such as:
-
-VERSION=0.217 ./mame.SlackBuild
-
-...where VERSION matches the mame source you just downloaded (with a
-dot after the 0, as shown above). If all goes well, you should have a
-shiny new mame package in /tmp, which you can install with installpkg
-or upgradepkg.
-
-After the build finishes, you should revert your gcc and g++ packages
-back to the standard Slackware ones. You can do this with:
-
-# removepkg gcc gcc-g++
-# slackpkg install 'gcc-*'
-
-Notes:
-
-- Do not ask for help with this via the SlackBuilds.org mailing list. If
- you run into problems, you can contact me (B. Watson, yalhcru@gmail.com)
- directly via email, or on Freenode IRC as user Urchlay.
-
-- I may not test every mame release with gcc-9.2.0. 0.217 definitely
- works, future releases *probably* will. When Slackware 15.0 is
- released, things should get back to normal.
-
-- The README for this build states that mame compiles require around
- 3.5GB in /tmp. For 0.217, this number is more like 4.5GB.
-
-- There is an llvm-8.0.1 in 14.2's /extra. Although the mame documentation
- claims that this version of llvm is supported, I can't get mame to
- compile with it.
diff --git a/games/mame/README_groovy.txt b/games/mame/README_groovy.txt
index e872b565ed257..a9ab5307b6c9d 100644
--- a/games/mame/README_groovy.txt
+++ b/games/mame/README_groovy.txt
@@ -1,38 +1,58 @@
-GroovyMAME, also known as GroovyUME, is a fork of MAME/UME with greater
-emphasis on CRT monitor support, in order to provide smoother gameplay
-with less input lag than using regular MAME on an LCD screen. GroovyMAME
-is provided as a patch against the standard MAME sources.
-
-GroovyMAME forum: http://forum.arcadecontrols.com/index.php?board=52.0
-
-GroovyMAME patches can be downloaded from:
-
-https://drive.google.com/drive/folders/0B5iMjDor3P__aEFpcVNkVW5jbEE
-
-Get the latest patch that matches the version of MAME. Example:
-
-0182_groovymame_017a.diff
-
-The "0182" is the MAME version, without the dots. The "017a" is the
-GroovyMAME version. You want the .diff file, not the .tar.bz2 or .7z!
-
-Download or copy the .diff file to the SlackBuild's directory and run the
-SlackBuild script. The script will find the .diff, apply it, and update
-the slack-desc to say "This package was patched with GroovyMAME 017a"
-(or whatever the version number really is). You *don't* have to do
-anything about the CRLF line endings, the script will handle that.
-
-If the script seems to be ignoring the .diff file, you probably have a
-.diff for a different version of MAME. Check the version number at the
-start of the filename. Don't try to rename the .diff file to force it
-to apply: the SlackBuild will fail because the patch will fail.
-
-If you have multiple .diff files that match the MAME version, the script
-will try to use the one with the highest GroovyMAME version number. If
-it picks the wrong one, remove the ones you don't want to use.
-
-If all else fails, please contact me by email (yalhcru@gmail.com) or on
-IRC (##slackware or #slackbuilds channel on FreeNode, user Urchlay). I
-won't necessarily be testing each MAME release against each version
-of the GroovyMAME patch for that release, so there might be problems I
-won't know about.
+GroovyMAME, also known as GroovyUME, is a fork of MAME/UME with
+greater emphasis on CRT monitor support, in order to provide smoother
+gameplay with less input lag than using regular MAME on an LCD screen.
+
+GroovyMAME has a discussion forum:
+http://forum.arcadecontrols.com/index.php?board=52.0
+
+GroovyMAME used to be provided as a patch against the standard MAME
+sources, until its author made it a proper fork on github. This
+SlackBuild supports patching the MAME sources with the GroovyMAME
+changes from github.
+
+To build with GroovyMAME, export GROOVY=yes in the environment. The
+resulting mame package will mention GroovyMAME in its slack-desc
+(which you will see when you install it).
+
+If you get an error that says there is no GroovyMAME patch for this
+version of MAME, that means that I updated mame.SlackBuild before the
+GroovyMAME author made a release based on that version of MAME (or,
+it means you're trying to build a newer MAME by setting VERSION in the
+environment). You can check for a release at:
+
+https://github.com/antonioginer/GroovyMAME/releases
+
+If there's no release matching your MAME version, you're out of luck.
+Wait until there is one.
+
+If there *is* a new release, you have two choices:
+
+1. Wait until I update the GroovyMAME patch. I can't guarantee that
+ I'll always do this in a timely manner. Please don't email and
+ bug me about this: I maintain over 700 SlackBuilds, and I try to
+ have a life outside of that, too.
+
+2. Run mame.SlackBuild with GROOVY=update in the environment. This
+ will attempt to create a GroovyMAME patch for the MAME version
+ you're building, if the GroovyMAME author has done a release. If
+ you get a "can't find GroovyMAME release" error, that means there
+ isn't one yet, so you'll have to wait a few days. If you know for
+ a fact that there *is* a release, it means there's probably a bug
+ in my mkgroovy.sh script (in which case, please do contact me by
+ email, so I can fix it).
+
+Note that GROOVY=update requires the SlackBuild to access the Internet
+(which SlackBuilds normally don't do). Specifically, it runs "curl"
+as the root user, and downloads a JSON file and the actual diff (if
+found) from https://api.github.com. If you don't trust this, you can
+instead run the mkgroovy.sh script (found in the same directory as the
+SlackBuild) as a non-root user, and copy the resulting .diff to the
+SlackBuild directory.
+
+If you have multiple gm*.diff files that match the MAME version, the
+script will try to use the one with the highest GroovyMAME version
+number. If it picks the wrong one, remove the ones you don't want
+to use.
+
+NOTE: I don't currently own any CRT monitors that work on a PC, so I
+can't actually test the GroovyMAME enhancements.
diff --git a/games/mame/doinst.sh b/games/mame/doinst.sh
index 787a7d4e51544..9f9769fd8ccf7 100644
--- a/games/mame/doinst.sh
+++ b/games/mame/doinst.sh
@@ -3,14 +3,11 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
- # If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
- # toss the redundant copy
rm $NEW
fi
- # Otherwise, we leave the .new copy for the admin to consider...
}
config etc/mame.ini.new
@@ -18,3 +15,9 @@ config etc/mame.ini.new
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications
fi
+
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+ if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
+ fi
+fi
diff --git a/games/mame/gm0237sr002e.diff.xz b/games/mame/gm0237sr002e.diff.xz
new file mode 100644
index 0000000000000..90aff26777738
--- /dev/null
+++ b/games/mame/gm0237sr002e.diff.xz
Binary files differ
diff --git a/games/mame/mame.SlackBuild b/games/mame/mame.SlackBuild
index 417c44ae37d2c..ebfeb78559e3c 100644
--- a/games/mame/mame.SlackBuild
+++ b/games/mame/mame.SlackBuild
@@ -9,6 +9,18 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+# 20211115 bkw:
+# - updated for v0.237 on -current aka 15.0rc1.
+# - new-style icons.
+# - update mame.ini (lots of new options, some old ones went away).
+# - include the new support stuff (hash, language, etc)
+# - rename mame's 'split' to 'mame-split' to avoid potential conflict
+# with coreutils (if someone has /usr/games before /usr/bin in $PATH).
+# - include ini/{examples,presets} in the package (in the doc dir).
+# - make ccache work! finally! see README_ccache.txt if you care.
+# - make GroovyMAME support work again (upstream switched to github).
+# - remove gcc9 stuff. it was specific to Slackware 14.2.
+
# 20191208 bkw: Updated for v0.214, after long hiatus. This isn't
# actually the latest version, but it's the latest version that will
# compile with any of the compilers available in Slackware 14.2:
@@ -29,7 +41,7 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=mame
-VERSION=${VERSION:-0.214}
+VERSION=${VERSION:-0.237}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -42,9 +54,6 @@ if [ -z "$ARCH" ]; then
esac
fi
-# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
-# the name of the created package would be, and then exit. This information
-# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@@ -90,6 +99,15 @@ if [ -n "$MISSING" ]; then
exit 1
fi
+# 20211112 bkw: GroovyMAME support has changed, see README_groovy.txt.
+# This part of it has to run in $CWD.
+GROOVY="${GROOVY:-no}"
+
+if [ "$GROOVY" = "update" ]; then
+ sh mkgroovy.sh $VERSION
+ GROOVY=yes
+fi
+
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
@@ -104,9 +122,17 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
# OK, building modern mame is a bit of a PITA. It uses genie (written
# in lua, a fork of premake), but you don't get to run genie directly,
-# you got a main makefile that builds lua, then builds genie, then runs
-# genie with arguments based on the options in the main makefile. Also,
-# it uses python to convert XML layout files to C++ code.
+# you got a main makefile that builds lua, then builds genie,
+# then runs genie with arguments based on the options in the main
+# makefile... and genie generates a bunch of makefiles, then runs make
+# on those. Also, it uses python3 to convert XML layout files to
+# C++ code.
+
+# During the Slackware 14.2 cycle, I used to do this:
+# LDOPTS="-fuse-ld=gold -static-libstdc++ -static-libgcc" \
+# This allowed installing Pat's unsupported gcc9 package,
+# building mame with it, then restoring the original gcc
+# version and mame would still run.
# Where possible, use system libraries instead of building the ones
# bundled with the mame source. However, SBo's lua is (still!) too old
@@ -122,15 +148,6 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
# JDK! In case you're wondering, only the C code in the bundled portmidi
# is built (no Java needed).
-# The OVERRIDE_CC and OVERRIDE_CXX are there because mame's build
-# ignores $PATH when searching for gcc/g++, and won't find my ccache
-# symlinks in /usr/local/bin. On a normal (non-ccache-using) system,
-# these options do nothing (they use the compilers in /usr/bin, which
-# is the default anyway) and you can forget about them... or, if you use
-# distcc, this will allow it to actually work. (Mini-rant: PATH has been
-# a standard mechanism on both Unix and DOS/Windows systems for what,
-# 30 or 40 years now? Come on people...)
-
# Version-specific patches & sed fixes. We do it this way to keep this
# script compatible with older versions.
PATCHES=""
@@ -164,32 +181,41 @@ sed -i 's,\.;ini,/etc,' src/osd/sdl/sdlmain.cpp
# stuff above.
#SDL_INI_PATH='$$HOME/.mame;/etc' \
-# Previous versions of mame used qt4 for the debugger GUI. Now it's
-# qt5, so I've made it optional (Slackware 14.2 still only has qt4).
-if [ "${QTDEBUG:-no}" = "yes" ]; then
+# 20211110 bkw: undocumented option. keep this Just In Case.
+if [ "${QTDEBUG:-yes}" = "yes" ]; then
QTOPT=1
- WITHQT="with"
else
QTOPT=0
- WITHQT="without"
fi
-# Now, let's check for GroovyMAME. All the user has to do is place
-# the .diff in the SlackBuild's directory. The filename always starts
-# with the MAME version number, minus its dots. If we find multiple
-# files matching this, sort them lexically and use the last (hopefully
-# this is the one with the highest version number).
-GROOVYDIFF="$( ls $CWD/${VERSION/./}_groovymame_*.diff 2>/dev/null | tail -1 )"
-if [ -e "$GROOVYDIFF" ]; then
- GROOVYVER="$( basename $GROOVYDIFF .diff | cut -d_ -f3- | sed 's,-,_,g' )"
-
- # .diffs are shipped with CRLF endings, fix:
- sed 's,\r,,g' "$GROOVYDIFF" > groovy.diff
-
- patch -p0 < groovy.diff
-
- echo "GROOVYDIFF $GROOVYDIFF"
- echo "GROOVYVER $GROOVYVER"
+# 20211112 bkw: the rest of the GroovyMAME stuff.
+# The diffs look to be close to half a meg, so they're compressed.
+if [ "$GROOVY" = "yes" ]; then
+ GROOVYDIFF="$( /bin/ls $CWD/gm${VERSION/./}*.diff.xz 2>/dev/null | tail -1 )"
+ if [ -e "$GROOVYDIFF" ]; then
+ GROOVYVER="$( basename $GROOVYDIFF .diff.xz )"
+ echo "=== GROOVYDIFF $GROOVYDIFF"
+ echo "=== GROOVYVER $GROOVYVER"
+
+ # The "-f -Z" is necessary to make sure the patched files end up
+ # with the same timestamp every time the script is run. ccache
+ # needs this because the include_file_mtime doesn't seem to
+ # play nice with precompiled headers, even though it's supposed to.
+ # When the patch is generated, we have to add timestamps to make
+ # this work (see mkgroovy.sh for details).
+
+ xzcat "$GROOVYDIFF" | patch -p1 -f -Z
+ else
+ cat <<EOF
+***
+GroovyMAME support was requested, but I don't have a GroovyMAME patch
+for MAME $VERSION. Try running this script with GROOVY=update in the
+environment, or wait a few days for the GroovyMAME author to release
+an update. See README_groovy.txt for more information.
+***
+EOF
+ exit 1
+ fi
fi
# Build option notes:
@@ -198,31 +224,53 @@ fi
# Using ld.gold is *much* faster, and I see no disadvantage to it.
-# The static libstdc++ and libgcc args allow building a version of mame
-# that requires gcc9 (README_gcc9.txt), then running it on a system that
-# doesn't have gcc9 installed. This does make the binary slightly larger,
-# but it's already around 250MB so it's not going to matter much.
-
# The point of the OVERRIDE_CC and friends is to make the build use $PATH
# to find gcc (so ccache will be found if it's using the symlink method).
+# 20211109 bkw: N.B. upstream requires python 3, but they default to
+# /usr/bin/python as the executable, so I still have to override it.
+# The -S means the same thing in python3 as it did it 2: disable use
+# of site packages. We needed it with py2 because otherwise the build
+# would fail if PyXML happened to be installed. Probably don't need it
+# with py3, but it won't hurt anything either.
+
+# 20211111 bkw: make ccache handle precompiled headers
+export CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime,include_file_ctime
+
+# 20211111 bkw: undocumented option, build a mame that only supports
+# pac-man and its clones. used for testing only.
+if [ "${PACONLY:-no}" = "yes" ]; then
+ PACOPT="SOURCES=src/mame/drivers/pacman.cpp"
+fi
+
+# 20211111 bkw: build with ccache by default, now that it works.
+if [ "${USE_CCACHE:-yes}" = "yes" ]; then
+ CC="/usr/bin/ccache /usr/bin/clang"
+ CXX="/usr/bin/ccache /usr/bin/clang++"
+else
+ CC="${CC:-$( which gcc )}"
+ CXX="${CXX:-$( which g++ )}"
+fi
+
make USE_QTDEBUG=$QTOPT \
USE_SYSTEM_LIB_EXPAT=1 \
USE_SYSTEM_LIB_ZLIB=1 \
USE_SYSTEM_LIB_JPEG=1 \
USE_SYSTEM_LIB_FLAC=1 \
- PYTHON_EXECUTABLE="/usr/bin/python -S" \
+ PYTHON_EXECUTABLE="/usr/bin/python3 -S" \
OPT_FLAGS="$SLKCFLAGS" \
- LDOPTS="-fuse-ld=gold -static-libstdc++ -static-libgcc" \
- OVERRIDE_CC="$( which gcc )" \
- OVERRIDE_CXX="$( which g++ )" \
- CC="$( which gcc )" \
- CXX="$( which g++ )" \
+ LDOPTS="-fuse-ld=gold" \
+ OVERRIDE_CC="$CC" \
+ OVERRIDE_CXX="$CXX" \
+ CC="$CC" \
+ CXX="$CXX" \
ARCH="" \
+ PRECOMPILE=1 \
VERBOSE=1 \
NOWERROR=1 \
TOOLS=1 \
TARGET=$PRGNAM \
+ $PACOPT \
SUBTARGET=$PRGNAM
# No 'make install' target, do it manually.
@@ -230,21 +278,42 @@ mkdir -p $PKG/usr/games $PKG/etc $PKG/usr/man/man6 $PKG/usr/man/man1 \
$PKG/usr/share/applications $PKG/usr/share/pixmaps
# Deal with upstream's executable-naming silliness.
-[ -e ${PRGNAM}64 ] && mv ${PRGNAM}64 $PRGNAM
-[ -e ${PRGNAM}32 ] && mv ${PRGNAM}32 $PRGNAM
+for i in tiny 32 64; do
+ [ -e ${PRGNAM}$i ] && mv ${PRGNAM}$i $PRGNAM
+done
# .desktop borrowed from Ludovic Lechapt's Debian package.
-# Icon extracted from src/mame/osd/windows/mame/mame.ico with icotool.
cat $CWD/desktop/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
-cat $CWD/desktop/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
+
+# Icon extracted from src/mame/osd/windows/mame/mame.ico with icotool.
+for px in 16 32 48 64 128; do
+ size=${px}x${px}
+ dir=$PKG/usr/share/icons/hicolor/$size/apps
+ mkdir -p $dir
+ convert -resize $size $CWD/desktop/$PRGNAM.png $dir/$PRGNAM.png
+done
+
+ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
+
cat $CWD/$PRGNAM.ini > $PKG/etc/$PRGNAM.ini.new
-# Install the binaries:
-install -s -m0755 -oroot -groot \
- $PRGNAM castool chdman floptool imgtool jedutil \
- ldresample ldverify nltool nlwav pngcmp regrep \
- romcmp split src2html srcclean unidasm \
- $PKG/usr/games/
+# This one *must* exist.
+install -s -m0755 -oroot -groot $PRGNAM $PKG/usr/games/
+
+# 20211110 bkw: removed src2html (no longer exists) and renamed split
+# to mame-split since we have a split command in coreutils already.
+# Also, in case upstream drops another of these utilities, check for
+# existence before trying to install (because it takes hours to
+# compile).
+# Install the tools:
+for i in castool chdman floptool imgtool jedutil \
+ ldresample ldverify nltool nlwav pngcmp \
+ regrep romcmp srcclean unidasm
+do
+ [ -e $i ] && install -s -m0755 -oroot -groot $i $PKG/usr/games/
+done
+
+[ -e split ] && install -s -m0755 -oroot -groot $i $PKG/usr/games/$PRGNAM-split
ln -s $PRGNAM $PKG/usr/games/mess
@@ -255,24 +324,31 @@ install -m0644 -oroot -groot docs/man/*.6 $PKG/usr/man/man6
gzip -9 $PKG/usr/man/man?/*.?
# Create empty dirs for the user to populate with ROMs and such.
-for i in roms samples ctrlr font cheat; do
- mkdir -p $PKG/usr/share/games/$PRGNAM/$i
-done
+SHAREDIR=$PKG/usr/share/games/$PRGNAM
+mkdir -p $SHAREDIR/{roms,font,cheat}
+
+# Install the support stuff.
+cp -a artwork bgfx plugins samples hash ctrlr $SHAREDIR
-# Install the artwork and bgfx stuff (needed for 'video bgfx' in mame.ini).
-cp -a artwork bgfx $PKG/usr/share/games/$PRGNAM
+# 20211110 bkw: also the translations (but not the .po files, those are
+# the sources for the .mo files, which are what mame actually needs).
+cp -p --parents language/*/*.mo $SHAREDIR
# CONTRIBUTING.md is a 1-byte placeholder, and we don't need a shell script.
rm -f docs/CONTRIBUTING.md docs/update.sh
-mkdir -p $PKG/usr/doc/${PRGNAM}-$VERSION
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
# can't just "cp docs/* ..." because man/ is a dir, set -e kills the script
-cp docs/L* docs/*.* $PKG/usr/doc/${PRGNAM}-$VERSION
-cp -a docs/swlist $PKG/usr/doc/${PRGNAM}-$VERSION
-cat $CWD/${PRGNAM}.SlackBuild > $PKG/usr/doc/${PRGNAM}-$VERSION/${PRGNAM}.SlackBuild
+cp docs/L* docs/*.* $PKGDOC
+cp -a docs/swlist docs/legal $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+# in case someone finds these useful...
+cp -a ini/examples ini/presets $PKGDOC
mkdir -p $PKG/install
-sed "s,@WITHQT@,$WITHQT," $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/slack-desc > $PKG/install/slack-desc
[ -n "$GROOVYVER" ] && \
sed -i "19s,\$, This package was patched with GroovyMAME $GROOVYVER.," \
diff --git a/games/mame/mame.info b/games/mame/mame.info
index 036e368391e66..22780397d862e 100644
--- a/games/mame/mame.info
+++ b/games/mame/mame.info
@@ -1,8 +1,8 @@
PRGNAM="mame"
-VERSION="0.214"
+VERSION="0.237"
HOMEPAGE="http://mamedev.org/"
-DOWNLOAD="https://github.com/mamedev/mame/archive/mame0214/mame-mame0214.tar.gz"
-MD5SUM="cfe6428ae8a9e969e2a1f942ff37ffe8"
+DOWNLOAD="https://github.com/mamedev/mame/archive/mame0237/mame-mame0237.tar.gz"
+MD5SUM="44574c90777d0593839bb13bfff677f4"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/games/mame/mame.ini b/games/mame/mame.ini
index 4d083c291aa08..2eb24ee5f4592 100644
--- a/games/mame/mame.ini
+++ b/games/mame/mame.ini
@@ -1,57 +1,75 @@
# Config file for mame, SlackBuilds.org version
-# Modified from the default mame.ini:
+# Modified from the mame-0.237's defaults (mame -showconfig):
-# - Search paths set for ~/.mame then systemwide ROM/artwork/etc
+# - Search paths set for ~/.mame, then systemwide ROM/artwork/etc
# - Output paths set for per-user configs in ~/.mame
# - joystick and mouse enabled by default
# - video set to opengl by default
+# - disable Lua plugin support by default (plugins 0)
+
+# Caveat interretiarius: mame only reads one mame.ini at startup. It
+# looks for ~/.mame/mame.ini first, then /etc/mame.ini. If it finds
+# ~/.mame/mame.ini, it reads that and *doesn't* read /etc/mame.ini. So
+# you can't just override one or two options in your home dir, you
+# have to have the whole config file.
+# So do this first: cp /etc/mame.ini ~/.mame/mame.ini
#
# CORE CONFIGURATION OPTIONS
#
readconfig 1
+writeconfig 0
#
# CORE SEARCH PATH OPTIONS
#
+homepath $HOME/.mame/plugins/homepath
rompath $HOME/.mame/roms;/usr/share/games/mame/roms
+hashpath $HOME/.mame/hash;/usr/share/games/mame/hash
samplepath $HOME/.mame/samples;/usr/share/games/mame/samples
artpath $HOME/.mame/artwork;/usr/share/games/mame/artwork
ctrlrpath $HOME/.mame/ctrlr;/usr/share/games/mame/ctrlr
inipath $HOME/.mame;/etc
-fontpath $HOME/.mame;/usr/share/games/mame/font
+fontpath $HOME/.mame/font;/usr/share/games/mame/font
cheatpath $HOME/.mame/cheat;/usr/share/games/mame/cheat
-
-# This one doesn't support $HOME
-#bgfx_path $HOME/.mame/bgfx;/usr/share/games/mame/bgfx
-bgfx_path /usr/share/games/mame/bgfx
+crosshairpath $HOME/.mame/crosshair;/usr/share/games/mame/crosshair
+pluginspath $HOME/.mame/plugins;/usr/share/games/mame/plugins
+languagepath $HOME/.mame/language;/usr/share/games/mame/language
+swpath $HOME/.mame/software;/usr/share/games/mame/software
#
# CORE OUTPUT DIRECTORY OPTIONS
#
cfg_directory $HOME/.mame/cfg
nvram_directory $HOME/.mame/nvram
-memcard_directory $HOME/.mame/memcard
input_directory $HOME/.mame/inp
state_directory $HOME/.mame/sta
snapshot_directory $HOME/.mame/snap
diff_directory $HOME/.mame/diff
comment_directory $HOME/.mame/comments
+share_directory $HOME/.mame/share
#
# CORE STATE/PLAYBACK OPTIONS
#
state
autosave 0
+rewind 0
+rewind_capacity 100
playback
record
+record_timecode 0
+exit_after_playback 0
mngwrite
aviwrite
wavwrite
snapname %g/%i
snapsize auto
snapview internal
+snapbilinear 1
+statename %g
+burnin 0
#
# CORE PERFORMANCE OPTIONS
@@ -63,6 +81,19 @@ throttle 1
sleep 1
speed 1.0
refreshspeed 0
+lowlatency 0
+
+#
+# CORE RENDER OPTIONS
+#
+keepaspect 1
+unevenstretch 1
+unevenstretchx 0
+unevenstretchy 0
+autostretchxy 0
+intoverscan 0
+intscalex 0
+intscaley 0
#
# CORE ROTATION OPTIONS
@@ -79,9 +110,8 @@ flipy 0
# CORE ARTWORK OPTIONS
#
artwork_crop 0
-use_backdrops 1
-use_overlays 1
-use_bezels 1
+fallback_artwork
+override_artwork
#
# CORE SCREEN OPTIONS
@@ -90,21 +120,25 @@ brightness 1.0
contrast 1.0
gamma 1.0
pause_brightness 0.65
+effect none
#
# CORE VECTOR OPTIONS
#
-antialias 1
-beam 1.0
+beam_width_min 1.0
+beam_width_max 1.0
+beam_dot_size 1.0
+beam_intensity_weight 0
flicker 0
#
# CORE SOUND OPTIONS
#
-sound sdl
samplerate 48000
samples 1
volume 0
+compressor 1
+speaker_report 0
#
# CORE INPUT OPTIONS
@@ -117,10 +151,14 @@ lightgun 0
multikeyboard 0
multimouse 0
steadykey 0
+ui_active 0
offscreen_reload 0
joystick_map auto
joystick_deadzone 0.3
joystick_saturation 0.85
+natural 0
+joystick_contradictory 0
+coin_impulse 0
#
# CORE INPUT AUTOMATIC ENABLE OPTIONS
@@ -137,50 +175,146 @@ mouse_device mouse
#
# CORE DEBUGGING OPTIONS
#
-log 0
verbose 0
-update_in_pause 0
+log 0
+oslog 0
debug 0
+update_in_pause 0
debugscript
+debuglog 0
+
+#
+# CORE COMM OPTIONS
+#
+comm_localhost 0.0.0.0
+comm_localport 15112
+comm_remotehost 127.0.0.1
+comm_remoteport 15112
+comm_framesync 0
#
# CORE MISC OPTIONS
#
+drc 1
+drc_use_c 0
+drc_log_uml 0
+drc_log_native 0
bios
cheat 0
skip_gameinfo 0
+uifont default
+ui cabinet
+ramsize
+confirm_quit 0
+ui_mouse 1
+language English
+nvram_save 1
#
-# DEBUGGING OPTIONS
+# SCRIPTING OPTIONS
#
-oslog 0
+autoboot_command
+autoboot_delay 0
+autoboot_script
+console 0
+plugins 0
+plugin
+noplugin
#
-# PERFORMANCE OPTIONS
+# HTTP SERVER OPTIONS
#
-multithreading 0
-sdlvideofps 0
+http 0
+http_port 8080
+http_root web
+
+#
+# OSD KEYBOARD MAPPING OPTIONS
+#
+uimodekey SCRLOCK
+
+#
+# OSD FONT OPTIONS
+#
+uifontprovider auto
+
+#
+# OSD OUTPUT OPTIONS
+#
+output auto
+
+#
+# OSD INPUT OPTIONS
+#
+keyboardprovider auto
+mouseprovider auto
+lightgunprovider auto
+joystickprovider auto
#
-# VIDEO OPTIONS
+# OSD DEBUGGING OPTIONS
+#
+debugger auto
+debugger_port 23946
+debugger_font auto
+debugger_font_size 0
+watchdog 0
+
+#
+# OSD PERFORMANCE OPTIONS
+#
+numprocessors auto
+bench 0
+
+#
+# OSD VIDEO OPTIONS
#
video opengl
numscreens 1
window 0
maximize 1
-keepaspect 1
-unevenstretch 1
-effect none
-centerh 1
-centerv 1
waitvsync 0
-scalemode none
+syncrefresh 0
+monitorprovider auto
#
-# OpenGL-SPECIFIC OPTIONS
+# OSD PER-WINDOW VIDEO OPTIONS
+#
+screen auto
+aspect auto
+resolution auto
+view auto
+screen0 auto
+aspect0 auto
+resolution0 auto
+view0 auto
+screen1 auto
+aspect1 auto
+resolution1 auto
+view1 auto
+screen2 auto
+aspect2 auto
+resolution2 auto
+view2 auto
+screen3 auto
+aspect3 auto
+resolution3 auto
+view3 auto
+
+#
+# OSD FULL SCREEN OPTIONS
+#
+switchres 0
+
+#
+# OSD ACCELERATED VIDEO OPTIONS
#
filter 1
prescale 1
+
+#
+# OpenGL-SPECIFIC OPTIONS
+#
gl_forcepow2texture 0
gl_notexturerect 0
gl_vbo 1
@@ -207,41 +341,48 @@ glsl_shader_screen6 none
glsl_shader_screen7 none
glsl_shader_screen8 none
glsl_shader_screen9 none
-gl_glsl_vid_attr 1
#
-# PER-WINDOW VIDEO OPTIONS
+# OSD SOUND OPTIONS
#
-screen auto
-aspect auto
-resolution auto
-view auto
-screen0 auto
-aspect0 auto
-resolution0 auto
-view0 auto
-screen1 auto
-aspect1 auto
-resolution1 auto
-view1 auto
-screen2 auto
-aspect2 auto
-resolution2 auto
-view2 auto
-screen3 auto
-aspect3 auto
-resolution3 auto
-view3 auto
+sound sdl
+audio_latency 3
#
-# FULL SCREEN OPTIONS
+# PORTAUDIO OPTIONS
#
-switchres 0
+pa_api none
+pa_device none
+pa_latency 0
#
-# SOUND OPTIONS
+# BGFX POST-PROCESSING OPTIONS
#
-audio_latency 3
+bgfx_path /usr/share/games/mame/bgfx
+bgfx_backend auto
+bgfx_debug 0
+bgfx_screen_chains default
+bgfx_shadow_mask slot-mask.png
+bgfx_lut
+bgfx_avi_name auto
+
+#
+# SDL PERFORMANCE OPTIONS
+#
+sdlvideofps 0
+
+#
+# SDL VIDEO OPTIONS
+#
+centerh 1
+centerv 1
+scalemode none
+
+#
+# SDL FULL SCREEN OPTIONS
+#
+useallheads 0
+attach_window
#
# SDL KEYBOARD MAPPING
@@ -263,8 +404,51 @@ joy_idx8 auto
sixaxis 0
#
-# SDL LOWLEVEL DRIVER OPTIONS
+# SDL LIGHTGUN MAPPING
+#
+lightgun_index1 auto
+lightgun_index2 auto
+lightgun_index3 auto
+lightgun_index4 auto
+lightgun_index5 auto
+lightgun_index6 auto
+lightgun_index7 auto
+lightgun_index8 auto
+
+#
+# SDL MOUSE MAPPING
+#
+mouse_index1 auto
+mouse_index2 auto
+mouse_index3 auto
+mouse_index4 auto
+mouse_index5 auto
+mouse_index6 auto
+mouse_index7 auto
+mouse_index8 auto
+
+#
+# SDL KEYBOARD MAPPING
+#
+keyb_idx1 auto
+keyb_idx2 auto
+keyb_idx3 auto
+keyb_idx4 auto
+keyb_idx5 auto
+keyb_idx6 auto
+keyb_idx7 auto
+keyb_idx8 auto
+
+#
+# SDL LOW-LEVEL DRIVER OPTIONS
#
videodriver auto
+renderdriver auto
audiodriver auto
gl_lib auto
+
+#
+# FRONTEND COMMAND OPTIONS
+#
+dtd 1
+
diff --git a/games/mame/mkgroovy.sh b/games/mame/mkgroovy.sh
new file mode 100644
index 0000000000000..c2524b6622c8f
--- /dev/null
+++ b/games/mame/mkgroovy.sh
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+# mkgroovy.sh - create a groovymame diff, if possible.
+
+# Since the groovymame author switched to github, there are no more
+# groovymame diffs to download (the ones that used to be hosted on
+# google drive). This rather ugly script just uses the github API to
+# get a diff we can apply.
+
+# Note: in my testing, requesting the same diff repeatedly from
+# the API results in identical files, but I'm not sure this is
+# guaranteed. It only matters if you're repeatedly test-running
+# this script, really.
+
+# The github 'compare' API is basically just a wrapper for the git
+# command, run on a remote repo. We can use it to download a diff
+# between 2 tags, without having to clone the repo (save a ton of
+# time and bandwidth).
+
+# To understand this, see the github API docs: https://docs.github.com/en/rest/
+
+# to see info on the repo:
+# curl -H "Accept: application/vnd.github.v3+json" 'https://api.github.com/users/antonioginer/repos'
+
+# to get a list of releases:
+# curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/antonioginer/GroovyMAME/releases
+# looks like these are in chronological order, newest first.
+
+# DIFFURL should end up looking like this:
+# curl -H "Accept: application/vnd.github.v3.diff" 'https://api.github.com/repos/antonioginer/GroovyMAME/compare/{mame0237}...{gm0237sr002e}'
+
+# Note: 'git diff' doesn't include timestamps in its output,
+# and there's no way to make the gh API include them. To
+# get ccache to play nice, I have to add the timestamps to
+# the context headers in the diff myself. AFAICT, that's the
+# only way to get ccache to play nice with this patch. Even with
+# CCACHE_SLOPPINESS=include_file_mtime, it complains that the headers
+# have a different modification time than what was expected, on the
+# 2nd (cached) build. I'm pretty sure this only happens because mame
+# uses a precompiled header, and ccache's precompiled header support
+# isn't quite perfect yet. The timestamps I put in the patch are just
+# the release date of the tag. They're not quite in the same format
+# 'diff' produces, but 'patch' accepts them just fine.
+
+if [ -n "$1" ]; then
+ MAMEVER="$1"
+else
+ if [ -e mame.info ]; then
+ source ./mame.info
+ MAMEVER="$VERSION"
+ else
+ echo "No MAME version argument and no mame.info in current dir."
+ fi
+fi
+
+MAMEVER=${MAMEVER/./}
+
+RELEASEURL="https://api.github.com/repos/antonioginer/GroovyMAME/releases"
+CMPURL="https://api.github.com/repos/antonioginer/GroovyMAME/compare/"
+JSONHDR="Accept: application/vnd.github.v3+json"
+DIFFHDR="Accept: application/vnd.github.v3.diff"
+
+JSON="$( mktemp -t mkgroovy.XXXXXXXXXX.json )"
+curl -sS -H "$HEADER" "$RELEASEURL" >> "$JSON"
+
+GMTAG="$(
+ grep '"tag_name.*"'".*$MAMEVER" "$JSON" \
+ | head -1 \
+ | sed 's,.*"\(gm'"$MAMEVER"'[^"]*\)".*,\1,'\
+ )"
+
+GMDATE="$(
+ grep '"created_at"' "$JSON" \
+ | head -1 \
+ | cut -d'"' -f4
+ )"
+
+rm "$JSON"
+
+case "$GMTAG" in
+ gm$MAMEVER*) ;; # OK
+ "") cat <<EOF
+!!! Can't find a GroovyMAME release for MAME $MAMEVER, try again tomorrow?
+EOF
+ exit 1 ;;
+ *) cat <<EOF
+!!! GMTAG is "$GMTAG", which doesn't look right. Investigate.
+EOF
+ exit 1 ;;
+esac
+
+MAMETAG="mame$MAMEVER"
+DIFFURL="$CMPURL{$MAMETAG}...{$GMTAG}"
+
+echo "=== GMTAG='$GMTAG' MAMETAG='$MAMETAG'"
+echo "=== DIFFURL='$DIFFURL'"
+
+OUTPUT="$GMTAG.diff"
+if [ -e "$OUTPUT" -o -e "$OUTPUT.xz" ]; then
+ echo "=== $OUTPUT(.xz)? already exists and is the latest version for mame $MAMEVER, nothing to do."
+ exit 0 # not an error!
+fi
+
+echo "=== Downloading diff."
+curl -sS -H "$DIFFHDR" "$DIFFURL" > "$OUTPUT"
+
+echo "=== Fudging timestamps to $GMDATE"
+sed -i '/^\(+++\|---\)/s,$,\t'"$GMDATE," "$OUTPUT"
+
+echo -n "=== Output is '$OUTPUT', type "
+file -b --mime "$OUTPUT"
+
+xz -9 "$OUTPUT"
+echo "=== Compressed to $OUTPUT.xz"
diff --git a/games/mame/slack-desc b/games/mame/slack-desc
index a5b32741b8e53..eed7462c68a98 100644
--- a/games/mame/slack-desc
+++ b/games/mame/slack-desc
@@ -15,5 +15,5 @@ mame: on a more modern general-purpose computer. MAME can currently emulate
mame: several thousand different classic arcade video games from the late
mame: 1970s through the modern era.
mame:
-mame: This package was built @WITHQT@ the qt5 ROM debugger.
+mame:
mame: