diff options
author | Alexander M Pickering <alex@cogarr.net> | 2024-09-25 17:16:56 -0500 |
---|---|---|
committer | Alexander M Pickering <alex@cogarr.net> | 2024-09-25 17:16:56 -0500 |
commit | e78ecdba666ffea5f476a206795fcec062a497a1 (patch) | |
tree | eb92f7e9e770c14ff76ab2e2b67a479bd5087907 | |
parent | acf0eb539f8f6e52bd12a948f98c09d2268803af (diff) | |
download | luarocks-packaging-e78ecdba666ffea5f476a206795fcec062a497a1.tar.gz luarocks-packaging-e78ecdba666ffea5f476a206795fcec062a497a1.tar.bz2 luarocks-packaging-e78ecdba666ffea5f476a206795fcec062a497a1.zip |
Remove extra debugging
-rwxr-xr-x | init | 95 |
1 files changed, 0 insertions, 95 deletions
@@ -10,101 +10,6 @@ mkdir build-binary | |||
10 | sed -i 's/local program_version = "dev"/local program_version = "lua4.win"/g' /root/luarocks/src/luarocks/core/cfg.lua | 10 | sed -i 's/local program_version = "dev"/local program_version = "lua4.win"/g' /root/luarocks/src/luarocks/core/cfg.lua |
11 | patch -i /root/luarocks-packaging/all_in_one.patch binary/all_in_one | 11 | patch -i /root/luarocks-packaging/all_in_one.patch binary/all_in_one |
12 | LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one "src/bin/luarocks" "" "^src/luarocks/admin/" "/config" "build-binary" "yes" "windows" | 12 | LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one "src/bin/luarocks" "" "^src/luarocks/admin/" "/config" "build-binary" "yes" "windows" |
13 | cat src/luarocks/core/hardcoded.lua | ||
14 | patch -i /root/luarocks-packaging/luarocks.exe.c.patch build-binary/luarocks.exe.c | 13 | patch -i /root/luarocks-packaging/luarocks.exe.c.patch build-binary/luarocks.exe.c |
15 | 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 | 14 | 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 |
16 | cp build-binary/luarocks.exe /root | 15 | cp build-binary/luarocks.exe /root |
17 | #cd luarocks/binary | ||
18 | # mkdir -p build-windows-deps-cicd/lib | ||
19 | # cd build-windows-deps-cicd/lib | ||
20 | # cp /root/liblua.a . | ||
21 | # cp /root/libssl.a . | ||
22 | # cp /root/libz.a . | ||
23 | # cp /root/libbz2.a . | ||
24 | # cd .. | ||
25 | # mkdir bin | ||
26 | # cd bin | ||
27 | # cp /root/*.exe . | ||
28 | # | ||
29 | # mkdir -p windows-deps-cicd/lib | ||
30 | # | ||
31 | # cd ../../.. | ||
32 | #LUA_BINDIR=binary/build-windows-deps-cicd/bin | ||
33 | #./configure --disable-incdir-check --with-lua=binary/build-windows-deps-cicd/bin --with-lua-lib=binary/build-windows-deps/lib | ||
34 | #make -f binary/Makefile.windows BUILD_WINDOWS_DEPS_DIR= | ||
35 | #LUAROCKS_CROSS_COMPILING=1 make binary LUA_DIR=binary/build-windows-deps-cicd/bin CC=gcc NM=nm BINARY_PLATFORM=windows | ||
36 | # all_in_one generates a series of files: | ||
37 | # dir .. "/luarocks/core/hardcoded.lua" | ||
38 | # | ||
39 | # SYSTEM = "windows" | ||
40 | # PROCESSOR = "x86" | "i686" | ||
41 | # FORCE_CONFIG = true | ||
42 | # IS_BINARY = true | ||
43 | # | ||
44 | # --------------------- | ||
45 | # Ok this file is actually pretty involved | ||
46 | # I think the strategy is to modify all_in_one to not call main(), and instead | ||
47 | # call generate() directly. This will output, among other things, luarocks.exe.c, | ||
48 | # (and compile it), but we can re-compile with different cflags if we want. | ||
49 | # We probably also need a bunch of precompiled windows .a to get it to compile. | ||
50 | # TARGET_DIR .. "/" .. program_name .. ".exe.c" | ||
51 | # | ||
52 | # [[static const char* progname = "<program_name>";]] | ||
53 | # <c_preamble> | ||
54 | # [[static void load_main(lua_State* L) {]] | ||
55 | # <bin2c src/bin/luarocks> | ||
56 | # [[if(luaL_loadbuffer(L, code, sizeof(code), "<program_name>") != LUA_OK) {]] | ||
57 | # [[ fatal(lua_tostring(L, -1));]] | ||
58 | # [[}]] | ||
59 | # [[}]] | ||
60 | # | ||
61 | # ---------------------- | ||
62 | # Lets modify all_in_one: delete the last line that calls main() and replace it | ||
63 | # with: | ||
64 | # cfg.init() | ||
65 | # cfg.variables.LUA_INCDIR_OK = true | ||
66 | # cfg.variables.LUA_LIBDIR_OK = true | ||
67 | # fs.init() | ||
68 | # generate(MAIN_PROGRAM, "src", {EXCLUDE, "^bin/?"}) | ||
69 | |||
70 | # Make the output directory | ||
71 | # mkdir build-binary | ||
72 | # Then call it like: | ||
73 | # LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one | ||
74 | |||
75 | # Patches to make all_in_one work with lua 5.1: | ||
76 | # Lua 5.1 never defined LUA_OK, which all_in_one uses to check luaL_loadbuffer(), | ||
77 | # define it in the preamble if it doesn't already exist. | ||
78 | |||
79 | #ifndef LUA_OK | ||
80 | #define LUA_OK 0 | ||
81 | #endif | ||
82 | |||
83 | # Lua 5.1 doesn't define lua_copy or luaL_traceback, | ||
84 | # for lua_copy, we can rewrite with lua_replace() since we're moving the top element. | ||
85 | # line 137: lua_replace(L,3); | ||
86 | # | ||
87 | # Lua 5.1 doesn't define luaL_traceback(), here's what it looks like in 5.1 lua.c: | ||
88 | #ifndef luaL_traceback | ||
89 | # static inline void | ||
90 | # luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level){ | ||
91 | # lua_getfield(L, LUA_GLOBALSINDEX, "debug"); | ||
92 | # if(!lua_istable(L,-1)){ | ||
93 | # lua_pop(L,1); | ||
94 | # return; | ||
95 | # } | ||
96 | # lua_getfield(L, -1, "traceback"); | ||
97 | # if(!lua_isfunction(L,-1)){ | ||
98 | # lua_pop(L,2); | ||
99 | # return; | ||
100 | # } | ||
101 | # lua_pushthread(L1); | ||
102 | # lua_pushstring(L,msg); | ||
103 | # lua_pushnumber(L,level); | ||
104 | # lua_call(L,3,1); | ||
105 | # return; | ||
106 | # } | ||
107 | #endif | ||
108 | |||
109 | # Finally, use gcc to build: | ||
110 | #gcc -o build-binary/luarocks.exe -Os build-binary/luarocks.exe.c -I/root/lua/src /root/libz2.a /root/libssl.a /root/libz.a /root/liblua.a -mconsole -mwindows -lm | ||