From cbd88cf79dd21911003efde5b9c9c3d476b5af8c Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Mon, 23 Sep 2024 15:31:19 -0500 Subject: Add a patch for luarocks.exe.c --- all_in_one.patch | 2 +- init | 9 ++++++--- luarocks.exe.c.patch | 47 +++++++++++++++++++++++++++++++++++++++++++++++ meta.lua | 1 - 4 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 luarocks.exe.c.patch diff --git a/all_in_one.patch b/all_in_one.patch index 234bcb7..adc49b9 100644 --- a/all_in_one.patch +++ b/all_in_one.patch @@ -1,4 +1,4 @@ ---- "binary/all_in_one.orig" 2024-09-23 13:31:16.489277700 -0500 +--- "binary/all_in_one" 2024-09-23 13:31:16.489277700 -0500 +++ "binary/all_in_one" 2024-09-23 13:31:14.032152500 -0500 @@ -406,27 +406,6 @@ fd:write(reindent_c(table.concat(out, "\n"))) diff --git a/init b/init index 37e5393..05bc396 100755 --- a/init +++ b/init @@ -3,13 +3,16 @@ if [ -e libluajit.a ]; then mv libluajit.a liblua.a fi +mkdir lua tar -xvzf lua-*.tar.gz --directory="lua" --strip-components=1 -mv hardcoded.lua luarocks/src/core/hardcoded.lua +mv luarocks-packaging/hardcoded.lua luarocks/src/luarocks/core/hardcoded.lua cd luarocks mkdir build-binary -patch -p1 -i /root/luarocks-packaging/all_in_one.patch +patch -i /root/luarocks-packaging/all_in_one.patch binary/all_in_one LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one - +patch -i /root/luarocks-packaging/luarocks.exe.c.patch build-binary/luarocks.exe.c +gcc -o build-binary/luarocks.exe -Oz build-binary/luarocks.exe.c -I/root/lua/src /root/libbz2.a /root/libssl.a /root/libz.a /root/liblua.a -mconsole -mwindows -lm +cp build-binary/luarocks.exe /root #cd luarocks/binary # mkdir -p build-windows-deps-cicd/lib # cd build-windows-deps-cicd/lib diff --git a/luarocks.exe.c.patch b/luarocks.exe.c.patch new file mode 100644 index 0000000..5410bfc --- /dev/null +++ b/luarocks.exe.c.patch @@ -0,0 +1,47 @@ +--- luarocks.exe.c 2024-09-23 15:27:52.663551300 -0500 ++++ luarocks.exe.c.orig 2024-09-23 15:25:00.870448000 -0500 +@@ -17,33 +17,6 @@ + #define getprogname() + #endif + +-/* LUA_OK defined in lua 5.2+ */ +-#ifndef LUA_OK +-#define LUA_OK 0 +-#endif +- +-/* luaL_traceback() introduced in lua 5.2 */ +-#ifndef luaL_traceback +-static inline void +-luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level){ +- lua_getfield(L, LUA_GLOBALSINDEX, "debug"); +- if(!lua_istable(L,-1)){ +- lua_pop(L,1); +- return; +- } +- lua_getfield(L, -1, "traceback"); +- if(!lua_isfunction(L,-1)){ +- lua_pop(L,2); +- return; +- } +- lua_pushthread(L1); +- lua_pushstring(L,msg); +- lua_pushnumber(L,level); +- lua_call(L,3,1); +- return; +-} +-#endif +- + static int registry_key; + + /* fatal error, from srlua */ +@@ -38309,9 +38282,7 @@ + lua_pop(L, 1); + lua_getfield(L, -1, "loaders"); /* table table.insert package package.loaders */ + } +- /* lua_copy introduced in lua 5.2 */ +- lua_replace(L,3); +- //lua_copy(L, 4, 3); /* table table.insert package.searchers */ ++ lua_copy(L, 4, 3); /* table table.insert package.searchers */ + lua_settop(L, 3); /* table table.insert package.searchers */ + lua_pushnumber(L, 1); /* table table.insert package.searchers 1 */ + lua_pushcfunction(L, pkg_loader); /* table table.insert package.searchers 1 pkg_loader */ diff --git a/meta.lua b/meta.lua index 60f7f2d..bd26c71 100644 --- a/meta.lua +++ b/meta.lua @@ -48,7 +48,6 @@ for version_k, version_v, opti_k, opti_v, debug_k, debug_v, comp_k, comp_v in ca }, produces = { ["luarocks.exe"] = true, - ["luarocks-admin.exe"] = true, }, env = { CFLAGS=" " .. opti_v .. " " .. debug_v, -- cgit v1.2.3-55-g6feb