From f2915fb2e8757b639f49a14499b7cf2a474968b7 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Wed, 30 Sep 2026 07:27:04 +0200 Subject: [PATCH] Fix lua-compat compilation --- recipes/dev/lua54/recipe.toml | 3 +++ recipes/dev/lua54/redox.patch | 12 ++++++++++++ recipes/libs/lua-compat-53/recipe.toml | 8 ++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 recipes/dev/lua54/redox.patch diff --git a/recipes/dev/lua54/recipe.toml b/recipes/dev/lua54/recipe.toml index 9b4f228d9..c72ddf89f 100644 --- a/recipes/dev/lua54/recipe.toml +++ b/recipes/dev/lua54/recipe.toml @@ -1,6 +1,9 @@ [source] tar = "https://lua.org/ftp/lua-5.4.7.tar.gz" blake3 = "e51c2f347e3185479d5ff95cae8ac77511db486853269443c56bedaa0a6ae629" +patches = [ + "redox.patch" +] [build] template = "custom" diff --git a/recipes/dev/lua54/redox.patch b/recipes/dev/lua54/redox.patch new file mode 100644 index 000000000..f034f573b --- /dev/null +++ b/recipes/dev/lua54/redox.patch @@ -0,0 +1,12 @@ +diff -ruwN source/src/ldo.c source-new/src/ldo.c +--- source/src/ldo.c 2024-06-13 22:15:09.000000000 +0000 ++++ source-new/src/ldo.c 2026-09-30 05:11:35.697677914 +0000 +@@ -60,7 +60,7 @@ + try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } + #define luai_jmpbuf int /* dummy variable */ + +-#elif defined(LUA_USE_POSIX) /* }{ */ ++#elif defined(LUA_USE_POSIX) && !defined(__redox__) /* }{ */ + + /* in POSIX, try _longjmp/_setjmp (more efficient) */ + #define LUAI_THROW(L,c) _longjmp((c)->b, 1) diff --git a/recipes/libs/lua-compat-53/recipe.toml b/recipes/libs/lua-compat-53/recipe.toml index edbca1c43..9704c34fe 100644 --- a/recipes/libs/lua-compat-53/recipe.toml +++ b/recipes/libs/lua-compat-53/recipe.toml @@ -6,6 +6,10 @@ dependencies = [ "lua54" ] script = """ -mkdir -pv "${COOKBOOK_STAGE}/include" -cp -r "$COOKBOOK_SOURCE/c-api/." "${COOKBOOK_STAGE}/include" +${CC} -O2 -fPIC ${CPPFLAGS} -c "${COOKBOOK_SOURCE}/c-api/compat-5.3.c" -o compat-5.3.o +${AR} rcs libcompat53.a compat-5.3.o + +mkdir -p "${COOKBOOK_STAGE}/usr/lib" "${COOKBOOK_STAGE}/usr/include" +cp libcompat53.a "${COOKBOOK_STAGE}/usr/lib/" +cp "${COOKBOOK_SOURCE}/c-api/compat-5.3.h" "${COOKBOOK_STAGE}/usr/include/" """