diff options
Diffstat (limited to 'init')
-rwxr-xr-x | init | 94 |
1 files changed, 69 insertions, 25 deletions
@@ -3,25 +3,32 @@ | |||
3 | if [ -e libluajit.a ]; then | 3 | if [ -e libluajit.a ]; then |
4 | mv libluajit.a liblua.a | 4 | mv libluajit.a liblua.a |
5 | fi | 5 | fi |
6 | cd luarocks/binary | 6 | tar -xvzf lua-*.tar.gz --directory="lua" --strip-components=1 |
7 | mkdir -p build-windows-deps-cicd/lib | 7 | mv hardcoded.lua luarocks/src/core/hardcoded.lua |
8 | cd build-windows-deps-cicd/lib | 8 | cd luarocks |
9 | cp /root/liblua.a . | 9 | mkdir build-binary |
10 | cp /root/libssl.a . | 10 | patch -p1 -i /root/luarocks-packaging/all_in_one.patch |
11 | cp /root/libz.a . | 11 | LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one |
12 | cp /root/libbz2.a . | ||
13 | cd .. | ||
14 | mkdir bin | ||
15 | cd bin | ||
16 | cp /root/*.exe . | ||
17 | |||
18 | mkdir -p windows-deps-cicd/lib | ||
19 | 12 | ||
20 | cd ../../.. | 13 | #cd luarocks/binary |
21 | LUA_BINDIR=binary/build-windows-deps-cicd/bin | 14 | # mkdir -p build-windows-deps-cicd/lib |
22 | ./configure --disable-incdir-check --with-lua=binary/build-windows-deps-cicd/bin --with-lua-lib=binary/build-windows-deps/lib | 15 | # cd build-windows-deps-cicd/lib |
23 | make -f binary/Makefile.windows BUILD_WINDOWS_DEPS_DIR= | 16 | # cp /root/liblua.a . |
24 | LUAROCKS_CROSS_COMPILING=1 make binary LUA_DIR=binary/build-windows-deps-cicd/bin CC=gcc NM=nm BINARY_PLATFORM=windows | 17 | # cp /root/libssl.a . |
18 | # cp /root/libz.a . | ||
19 | # cp /root/libbz2.a . | ||
20 | # cd .. | ||
21 | # mkdir bin | ||
22 | # cd bin | ||
23 | # cp /root/*.exe . | ||
24 | # | ||
25 | # mkdir -p windows-deps-cicd/lib | ||
26 | # | ||
27 | # cd ../../.. | ||
28 | #LUA_BINDIR=binary/build-windows-deps-cicd/bin | ||
29 | #./configure --disable-incdir-check --with-lua=binary/build-windows-deps-cicd/bin --with-lua-lib=binary/build-windows-deps/lib | ||
30 | #make -f binary/Makefile.windows BUILD_WINDOWS_DEPS_DIR= | ||
31 | #LUAROCKS_CROSS_COMPILING=1 make binary LUA_DIR=binary/build-windows-deps-cicd/bin CC=gcc NM=nm BINARY_PLATFORM=windows | ||
25 | # all_in_one generates a series of files: | 32 | # all_in_one generates a series of files: |
26 | # dir .. "/luarocks/core/hardcoded.lua" | 33 | # dir .. "/luarocks/core/hardcoded.lua" |
27 | # | 34 | # |
@@ -50,13 +57,50 @@ LUAROCKS_CROSS_COMPILING=1 make binary LUA_DIR=binary/build-windows-deps-cicd/bi | |||
50 | # ---------------------- | 57 | # ---------------------- |
51 | # Lets modify all_in_one: delete the last line that calls main() and replace it | 58 | # Lets modify all_in_one: delete the last line that calls main() and replace it |
52 | # with: | 59 | # with: |
53 | cfg.init() | 60 | # cfg.init() |
54 | cfg.variables.LUA_INCDIR_OK = true | 61 | # cfg.variables.LUA_INCDIR_OK = true |
55 | cfg.variables.LUA_LIBDIR_OK = true | 62 | # cfg.variables.LUA_LIBDIR_OK = true |
56 | fs.init() | 63 | # fs.init() |
57 | generate(MAIN_PROGRAM, "src", {EXCLUDE, "^bin/?"}) | 64 | # generate(MAIN_PROGRAM, "src", {EXCLUDE, "^bin/?"}) |
58 | 65 | ||
59 | # Make the output directory | 66 | # Make the output directory |
60 | mkdir build-binary | 67 | # mkdir build-binary |
61 | # Then call it like: | 68 | # Then call it like: |
62 | LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one | 69 | # LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one |
70 | |||
71 | # Patches to make all_in_one work with lua 5.1: | ||
72 | # Lua 5.1 never defined LUA_OK, which all_in_one uses to check luaL_loadbuffer(), | ||
73 | # define it in the preamble if it doesn't already exist. | ||
74 | |||
75 | #ifndef LUA_OK | ||
76 | #define LUA_OK 0 | ||
77 | #endif | ||
78 | |||
79 | # Lua 5.1 doesn't define lua_copy or luaL_traceback, | ||
80 | # for lua_copy, we can rewrite with lua_replace() since we're moving the top element. | ||
81 | # line 137: lua_replace(L,3); | ||
82 | # | ||
83 | # Lua 5.1 doesn't define luaL_traceback(), here's what it looks like in 5.1 lua.c: | ||
84 | #ifndef luaL_traceback | ||
85 | # static inline void | ||
86 | # luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level){ | ||
87 | # lua_getfield(L, LUA_GLOBALSINDEX, "debug"); | ||
88 | # if(!lua_istable(L,-1)){ | ||
89 | # lua_pop(L,1); | ||
90 | # return; | ||
91 | # } | ||
92 | # lua_getfield(L, -1, "traceback"); | ||
93 | # if(!lua_isfunction(L,-1)){ | ||
94 | # lua_pop(L,2); | ||
95 | # return; | ||
96 | # } | ||
97 | # lua_pushthread(L1); | ||
98 | # lua_pushstring(L,msg); | ||
99 | # lua_pushnumber(L,level); | ||
100 | # lua_call(L,3,1); | ||
101 | # return; | ||
102 | # } | ||
103 | #endif | ||
104 | |||
105 | # Finally, use gcc to build: | ||
106 | #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 | ||