From 00608506faad008cbb77c15d66e2927dcb906f03 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Sat, 9 Sep 2023 20:04:21 -0600
Subject: [PATCH] Fix neverball recipe

---
 recipes/neverball/recipe.sh   |  9 +++++++--
 recipes/neverball/redox.patch | 18 +++++++++++++++---
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/recipes/neverball/recipe.sh b/recipes/neverball/recipe.sh
index ebe767a67..4ba9d47db 100644
--- a/recipes/neverball/recipe.sh
+++ b/recipes/neverball/recipe.sh
@@ -8,13 +8,18 @@ function recipe_version {
 }
 
 function recipe_build {
-    env -i PATH=/usr/bin:/bin PKG_CONFIG=pkg-config \
+    set -x
+    env -i \
+        LDFLAGS="-static" \
+        PATH="/usr/bin:/bin" \
+        PKG_CONFIG="pkg-config" \
     "$REDOX_MAKE" -j"$($NPROC)" ENABLE_FS=stdio mapc sols
     sysroot="$(realpath ../sysroot)"
     export CPPFLAGS="-I$sysroot/include"
-	export LDFLAGS="-L$sysroot/lib -static"
+	export LDFLAGS="-L$sysroot/lib -static -z noexecstack"
     "$REDOX_MAKE" -j"$($NPROC)" ENABLE_FS=stdio ENABLE_NLS=0 clean-src
     "$REDOX_MAKE" -j"$($NPROC)" ENABLE_FS=stdio ENABLE_NLS=0 neverball neverputt
+    set +x
     skip=1
 }
 
diff --git a/recipes/neverball/redox.patch b/recipes/neverball/redox.patch
index 376893ef1..6bc6dd4b0 100644
--- a/recipes/neverball/redox.patch
+++ b/recipes/neverball/redox.patch
@@ -1,6 +1,6 @@
-diff -ruwN source/Makefile source-new/Makefile
---- source/Makefile	2019-08-07 22:16:07.630185664 -0600
-+++ source-new/Makefile	2019-08-09 21:41:20.296942596 -0600
+diff -ruwN neverball-1.6.0/Makefile source/Makefile
+--- neverball-1.6.0/Makefile	2014-05-21 07:21:43.000000000 -0600
++++ source/Makefile	2023-09-09 20:03:22.113348963 -0600
 @@ -38,11 +38,11 @@
  ifeq ($(DEBUG),1)
  	CFLAGS   := -g
@@ -73,3 +73,15 @@ diff -ruwN source/Makefile source-new/Makefile
  
  $(BALL_TARG) : $(BALL_OBJS)
  	$(LINK) -o $(BALL_TARG) $(BALL_OBJS) $(LDFLAGS) $(ALL_LIBS)
+diff -ruwN neverball-1.6.0/share/text.h source/share/text.h
+--- neverball-1.6.0/share/text.h	2014-05-21 07:21:43.000000000 -0600
++++ source/share/text.h	2023-09-09 20:02:10.117248865 -0600
+@@ -15,7 +15,7 @@
+ 
+ /*---------------------------------------------------------------------------*/
+ 
+-char text_input[MAXSTR];
++extern char text_input[MAXSTR];
+ 
+ void text_input_start(void (*cb)(int typing));
+ void text_input_stop(void);
-- 
GitLab