From ece77e77f3baa96a645724a31ff00e2540be86ac Mon Sep 17 00:00:00 2001
From: "B. Watson" <yalhcru@gmail.com>
Date: Wed, 21 Jun 2017 03:31:44 -0400
Subject: games/zoom: Fix build for -current.

Signed-off-by: B. Watson <yalhcru@gmail.com>
---
 games/zoom/no_inline.diff   | 120 ++++++++++++++++++++++++++++++++++++++++++++
 games/zoom/remove_rice.diff |  91 +++++++++++++++++++++++++++++++++
 games/zoom/zoom.SlackBuild  |   8 +++
 3 files changed, 219 insertions(+)
 create mode 100644 games/zoom/no_inline.diff
 create mode 100644 games/zoom/remove_rice.diff

diff --git a/games/zoom/no_inline.diff b/games/zoom/no_inline.diff
new file mode 100644
index 0000000000000..d7ff771e8180c
--- /dev/null
+++ b/games/zoom/no_inline.diff
@@ -0,0 +1,120 @@
+diff -Naur zoom-1.1.5/src/interp.c zoom-1.1.5.patched/src/interp.c
+--- zoom-1.1.5/src/interp.c	2011-11-05 07:40:53.000000000 -0400
++++ zoom-1.1.5.patched/src/interp.c	2017-06-21 03:26:42.543594700 -0400
+@@ -101,7 +101,7 @@
+ 	} \
+      }
+ 
+-static inline void push(ZStack* stack, const ZWord word)
++static void push(ZStack* stack, const ZWord word)
+ {
+   *(stack->stack_top++) = word;
+   stack->stack_size--;
+@@ -131,7 +131,7 @@
+ #endif
+ }
+ 
+-inline ZWord pop(ZStack* stack)
++ZWord pop(ZStack* stack)
+ {
+   stack->stack_size++;
+ 
+@@ -159,7 +159,7 @@
+   return *(--stack->stack_top);
+ }
+ 
+-inline ZWord top(ZStack* stack)
++ZWord top(ZStack* stack)
+ {
+     if (stack->current_frame)
+     {
+@@ -232,7 +232,7 @@
+   return newframe;
+ }
+ 
+-inline void store(ZStack* stack, int var, ZWord value)
++void store(ZStack* stack, int var, ZWord value)
+ {
+ #ifdef DEBUG
+   printf_debug("Storing %i in Variable #%x\n", value, var);
+@@ -253,7 +253,7 @@
+     }
+ }
+ 
+-inline void store_nopush(ZStack* stack, int var, ZWord value)
++void store_nopush(ZStack* stack, int var, ZWord value)
+ {
+ #ifdef DEBUG
+     printf_debug("Storing %i in Variable #%x\n", value, var);
+@@ -313,7 +313,7 @@
+   int    isdefault;
+ };
+ 
+-static inline struct prop* get_object_prop_3(ZUWord object, ZWord property)
++static struct prop* get_object_prop_3(ZUWord object, ZWord property)
+ {
+   ZByte* obj;
+   ZByte* prop;
+@@ -364,7 +364,7 @@
+   int header;
+ };
+ 
+-static inline struct propinfo* get_object_propinfo_4(ZByte* prop)
++static struct propinfo* get_object_propinfo_4(ZByte* prop)
+ {
+   static struct propinfo pinfo;
+   
+@@ -387,7 +387,7 @@
+   return &pinfo;
+ }
+ 
+-static inline struct prop* get_object_prop_4(ZUWord object, ZWord property)
++static struct prop* get_object_prop_4(ZUWord object, ZWord property)
+ {
+   ZByte* obj;
+   ZByte* prop;
+@@ -539,7 +539,7 @@
+ }
+ #endif
+ 
+-inline static int true_colour(int col)
++static int true_colour(int col)
+ {
+   switch (col)
+     {
+@@ -575,7 +575,7 @@
+     }
+ }
+ 
+-inline static int convert_colour(int col)
++static int convert_colour(int col)
+ {
+   switch (col)
+     {
+@@ -1473,7 +1473,7 @@
+   return -1;
+ }
+ 
+-static inline void zcode_setup_window(int window)
++static void zcode_setup_window(int window)
+ {
+   v6_set_window(window);
+   v6_define_window(window,
+@@ -1497,7 +1497,7 @@
+ #endif
+ }
+ 
+-static inline int zcode_v6_push_stack(ZStack* stack,
++static int zcode_v6_push_stack(ZStack* stack,
+ 				      ZUWord  stk,
+ 				      ZUWord  value)
+ {
+@@ -1528,7 +1528,7 @@
+   return 1;
+ }
+ 
+-static inline int v6_window(int win)
++static int v6_window(int win)
+ {
+   if (win > 7)
+     zmachine_fatal("No such window: %i", win);
diff --git a/games/zoom/remove_rice.diff b/games/zoom/remove_rice.diff
new file mode 100644
index 0000000000000..1a9e3b7f2fbde
--- /dev/null
+++ b/games/zoom/remove_rice.diff
@@ -0,0 +1,91 @@
+diff -Naur zoom-1.1.5/configure zoom-1.1.5.patched/configure
+--- zoom-1.1.5/configure	2011-11-05 10:29:03.000000000 -0400
++++ zoom-1.1.5.patched/configure	2017-06-21 03:19:11.223593935 -0400
+@@ -4630,87 +4630,6 @@
+     conftest$ac_exeext conftest.$ac_ext
+ 
+ 
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler ($CC) supports -finline-functions" >&5
+-$as_echo_n "checking if the C compiler ($CC) supports -finline-functions... " >&6; }
+-    ac_OLD_CFLAGS="$CFLAGS"
+-    CFLAGS="$CFLAGS -finline-functions"
+-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+- { int x; x = 1; }
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+-else
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-      CFLAGS="$ac_OLD_CFLAGS"
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
+-
+-
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler ($CC) supports -funroll-loops" >&5
+-$as_echo_n "checking if the C compiler ($CC) supports -funroll-loops... " >&6; }
+-    ac_OLD_CFLAGS="$CFLAGS"
+-    CFLAGS="$CFLAGS -funroll-loops"
+-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+- { int x; x = 1; }
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+-else
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-      CFLAGS="$ac_OLD_CFLAGS"
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
+-
+-
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler ($CC) supports -fomit-frame-pointer" >&5
+-$as_echo_n "checking if the C compiler ($CC) supports -fomit-frame-pointer... " >&6; }
+-    ac_OLD_CFLAGS="$CFLAGS"
+-    CFLAGS="$CFLAGS -fomit-frame-pointer"
+-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+- { int x; x = 1; }
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+-else
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-      CFLAGS="$ac_OLD_CFLAGS"
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
+-
+-
+ # Check whether --enable-new-terp was given.
+ if test "${enable_new_terp+set}" = set; then :
+   enableval=$enable_new_terp;
diff --git a/games/zoom/zoom.SlackBuild b/games/zoom/zoom.SlackBuild
index 081e25e65d927..61e35e2e9387a 100644
--- a/games/zoom/zoom.SlackBuild
+++ b/games/zoom/zoom.SlackBuild
@@ -6,6 +6,8 @@
 
 # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
 
+# 20170621 bkw: fix build for -current
+
 PRGNAM=zoom
 VERSION=${VERSION:-1.1.5}
 BUILD=${BUILD:-1}
@@ -49,6 +51,12 @@ find -L . \
  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  -exec chmod 644 {} \;
 
+# gcc7 hates all the inline functions in interp.c.
+patch -p1 < $CWD/no_inline.diff
+
+# We don't need -funroll-loops and friends. They break the build on -current.
+patch -p1 < $CWD/remove_rice.diff
+
 # Modern Xft doesn't ship a xft-config script, hack the configure script
 # to use pkg-config.
 patch -p1 < $CWD/config_xft.diff
-- 
cgit v1.2.3