Fix lua-compat compilation

This commit is contained in:
Wildan M 2026-09-30 07:27:04 +02:00
parent d8759f33dd
commit f2915fb2e8
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
3 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,9 @@
[source]
tar = "https://lua.org/ftp/lua-5.4.7.tar.gz"
blake3 = "e51c2f347e3185479d5ff95cae8ac77511db486853269443c56bedaa0a6ae629"
patches = [
"redox.patch"
]
[build]
template = "custom"

View File

@ -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)

View File

@ -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/"
"""