From e6d0f9c0446be7d9eef11f0836ee9c4ba51a66a8 Mon Sep 17 00:00:00 2001 From: B. Watson Date: Tue, 7 Jan 2020 14:15:26 -0500 Subject: games/mame: Allow builds with unsupported gcc9. Signed-off-by: B. Watson --- games/mame/README | 6 ++--- games/mame/README_gcc9.txt | 60 ++++++++++++++++++++++++++++++++++++++++++++++ games/mame/mame.SlackBuild | 40 ++++++++++++++++++++++++------- 3 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 games/mame/README_gcc9.txt 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 +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/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). +MISSING="" +for i in sdl2 SDL2_ttf; do + pkg-config --exists $i || MISSING="$MISSING $i" +done +if [ -n "$MISSING" ]; then + echo "*** Missing required dependencies:$MISSING" 1>&2 + exit 1 +fi + 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 ' src/mame/video/xavix.cpp ;; - *) ;; -esac - # 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 ' \ src/devices/cpu/mips/ps2vif1.cpp \ src/devices/cpu/mips/mips3.cpp - ;; + ;; + 0.204) + sed -i '1i#include ' src/mame/video/xavix.cpp + ;; *) ;; esac @@ -172,10 +182,20 @@ if [ -e "$GROOVYDIFF" ]; then echo "GROOVYVER $GROOVYVER" fi +# Build option notes: # Having ARCH set in the env will break the build, hence ARCH="". + # 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). + make USE_QTDEBUG=$QTOPT \ USE_SYSTEM_LIB_EXPAT=1 \ USE_SYSTEM_LIB_ZLIB=1 \ @@ -183,9 +203,11 @@ make USE_QTDEBUG=$QTOPT \ USE_SYSTEM_LIB_FLAC=1 \ PYTHON_EXECUTABLE="/usr/bin/python -S" \ OPT_FLAGS="$SLKCFLAGS" \ - 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="" \ VERBOSE=1 \ NOWERROR=1 \ -- cgit v1.2.3