summaryrefslogtreecommitdiff
path: root/games/opendune
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2017-05-31 14:06:28 -0400
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-06-03 08:00:22 +0700
commit8421bc370053d833d438772a2d1ae31d7f2b9bbd (patch)
treec043786044564fa70e000463b9a5a1a327abd965 /games/opendune
parentf8f09fcf2da08a9f802ad2238ad442374935eb9d (diff)
downloadslackbuilds-8421bc370053d833d438772a2d1ae31d7f2b9bbd.tar.gz
games/opendune: Fix x86 build.
Signed-off-by: B. Watson <yalhcru@gmail.com>
Diffstat (limited to 'games/opendune')
-rw-r--r--games/opendune/README6
-rw-r--r--games/opendune/mmx_bodge.diff12
-rw-r--r--games/opendune/opendune.SlackBuild24
3 files changed, 41 insertions, 1 deletions
diff --git a/games/opendune/README b/games/opendune/README
index 6685da4e90..f49700599e 100644
--- a/games/opendune/README
+++ b/games/opendune/README
@@ -13,6 +13,12 @@ data files. Copy or symlink the .PAK files from the original game to
"/usr/share/games/opendune/data". The filenames can be uppercase or
lowercase.
+If you're building a package for a very old x86 system (that doesn't
+support MMX), on a newer system (that does support MMX), set MMX=no in
+the script's environment. If you're building on the same system you'll
+install the package on, you don't have to worry about this (MMX will
+be autodetected).
+
Optional dependencies:
If SDL2 and SDL2_image are installed, opendune will use them rather than
diff --git a/games/opendune/mmx_bodge.diff b/games/opendune/mmx_bodge.diff
new file mode 100644
index 0000000000..e735ed8db3
--- /dev/null
+++ b/games/opendune/mmx_bodge.diff
@@ -0,0 +1,12 @@
+diff -Naur OpenDUNE-0.8/src/video/video_sdl.c OpenDUNE-0.8.patched/src/video/video_sdl.c
+--- OpenDUNE-0.8/src/video/video_sdl.c 2016-06-26 17:46:42.000000000 -0400
++++ OpenDUNE-0.8.patched/src/video/video_sdl.c 2017-05-31 13:27:35.163259001 -0400
+@@ -362,7 +362,7 @@
+ *((__m128i *)gfx2) = mh;
+ gfx2 += 16;
+ }
+-#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
++#elif defined(__GNUC__) && defined(__MMX__)
+ /* MMX code */
+ for (x = SCREEN_WIDTH / 4; x > 0; x--) {
+ __m64 m;
diff --git a/games/opendune/opendune.SlackBuild b/games/opendune/opendune.SlackBuild
index 5273778340..6f11010a48 100644
--- a/games/opendune/opendune.SlackBuild
+++ b/games/opendune/opendune.SlackBuild
@@ -6,11 +6,12 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+# 20170531 bkw: BUILD=2, fix build on x86
# 20170302 bkw: use long-format github URL
PRGNAM=opendune
VERSION=${VERSION:-0.8}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -28,9 +29,11 @@ OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ MMX=${MMX:-maybe}
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ MMX=${MMX:-maybe}
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
@@ -57,6 +60,25 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+# 20170531 bkw: upstream uses #if defined(__i386__) to test for MMX,
+# which is wrong (should be checking __MMX__ instead). This only affects
+# x86 builds (not x86_64), and only if SDL 1 is used.
+patch -p1 < $CWD/mmx_bodge.diff
+
+if [ "$MMX" = "maybe" ]; then
+ if grep -q '\<mmx\>' /proc/cpuinfo; then
+ MMX="yes"
+ else
+ MMX="no"
+ fi
+ echo "=== autodected MMX: $MMX"
+fi
+
+if [ "$MMX" = "yes" ]; then
+ SLKCFLAGS="$SLKCFLAGS -mmmx"
+ echo "=== added -mmmx to SLKCFLAGS"
+fi
+
# Fix compile issue with /usr/include/alsa/pcm.h (uses inline)
sed -i 's,-ansi,,' config.lib