diff options
author B. Watson2020-01-07 20:15:26 +0100
committer Willy Sudiarto Raharjo2020-01-12 02:47:47 +0100
commite6d0f9c0446be7d9eef11f0836ee9c4ba51a66a8 (patch)
parenta6ac33d453d7bc3ba5f9b9b5e8f199013e1d8db6 (diff)
games/mame: Allow builds with unsupported gcc9.
Signed-off-by: B. Watson <>
3 files changed, 94 insertions, 12 deletions
diff --git a/games/mame/README b/games/mame/README
index 5f2b1c78c5..ea0cd5dccb 100644
--- a/games/mame/README
+++ b/games/mame/README
@@ -1,6 +1,6 @@
Note: I'm aware that this isn't the latest version of MAME. However,
-it's the latest version that will compile with Slackware 14.2's gcc or
-llvm (even llvm-8.0.1 from /extra).
+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 stands for Multiple Arcade Machine Emulator. When used in conjunction
with images of the original arcade game's ROM and disk data, MAME attempts
@@ -15,7 +15,7 @@ video game consoles, and calculators, as MAME does for arcade games.
Modern versions of MAME now include MESS, so there's no need for a
separate MESS build or binary.
-This build requires around 2GB of storage in /tmp (or whatever you set
+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
diff --git a/games/mame/README_gcc9.txt b/games/mame/README_gcc9.txt
new file mode 100644
index 0000000000..f89329b1d2
--- /dev/null
+++ b/games/mame/README_gcc9.txt
@@ -0,0 +1,60 @@
+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
+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:
+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-*'
+- Do not ask for help with this via the mailing list. If
+ you run into problems, you can contact me (B. Watson,
+ 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/mame.SlackBuild b/games/mame/mame.SlackBuild
index aaaf66140b..3a34db79df 100644
--- a/games/mame/mame.SlackBuild
+++ b/games/mame/mame.SlackBuild
@@ -66,6 +66,20 @@ DIRNAME=$PRGNAM-$SHORTNAME
set -e
+# 20200108 bkw: before doing ANYTHING else, check to make sure
+# our required deps are installed. This is helpful because if
+# they are missing, the mame compile will still start and run
+# for an hour or more before it errors out, wasting a lot of
+# time (some of which was mine).
+for i in sdl2 SDL2_ttf; do
+ pkg-config --exists $i || MISSING="$MISSING $i"
+if [ -n "$MISSING" ]; then
+ echo "*** Missing required dependencies:$MISSING" 1>&2
+ exit 1
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
@@ -78,13 +92,6 @@ 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 {} \+
-# 20181130 bkw: the new xavix code in 0.204 is missing this include.
-# Add future versions to the first case, as needed.
-case "$VERSION" in
- 0.204) sed -i '1i#include <cmath>' src/mame/video/xavix.cpp ;;
- *) ;;
# 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
@@ -122,7 +129,10 @@ case "$VERSION" in
sed -i '1i#include <cmath>' \
src/devices/cpu/mips/ps2vif1.cpp \
- ;;
+ ;;
+ 0.204)
+ sed -i '1i#include <cmath>' src/mame/video/xavix.cpp
+ ;;
*) ;;
@@ -172,10 +182,20 @@ if [ -e "$GROOVYDIFF" ]; then
+# Build option notes:
# Having ARCH set in the env will break the build, hence ARCH="".
# Using 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).
@@ -183,9 +203,11 @@ make USE_QTDEBUG=$QTOPT \
PYTHON_EXECUTABLE="/usr/bin/python -S" \
- LDOPTS="-fuse-ld=gold" \
+ LDOPTS="-fuse-ld=gold -static-libstdc++ -static-libgcc" \
OVERRIDE_CC="$( which gcc )" \
OVERRIDE_CXX="$( which g++ )" \
+ CC="$( which gcc )" \
+ CXX="$( which g++ )" \
ARCH="" \