aboutsummaryrefslogtreecommitdiff
path: root/init
blob: 26b342850c16075ce2eec2a00c634328bd49f2c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh -ex

if [ -e libluajit.a ]; then
	mv libluajit.a liblua.a
fi
cd luarocks/binary
mkdir -p build-windows-deps-cicd/lib
cd build-windows-deps-cicd/lib
cp /root/liblua.a .
cp /root/libssl.a .
cp /root/libz.a .
cp /root/libbz2.a .
cd ..
mkdir bin
cd bin
cp /root/*.exe .

mkdir -p windows-deps-cicd/lib

cd ../../..
LUA_BINDIR=binary/build-windows-deps-cicd/bin
./configure --disable-incdir-check --with-lua=binary/build-windows-deps-cicd/bin --with-lua-lib=binary/build-windows-deps/lib
make -f binary/Makefile.windows BUILD_WINDOWS_DEPS_DIR=
LUAROCKS_CROSS_COMPILING=1 make binary LUA_DIR=binary/build-windows-deps-cicd/bin CC=gcc NM=nm BINARY_PLATFORM=windows
# all_in_one generates a series of files:
# dir .. "/luarocks/core/hardcoded.lua"
#
# SYSTEM = "windows"
# PROCESSOR = "x86" | "i686"
# FORCE_CONFIG = true
# IS_BINARY = true
#
# ---------------------
# Ok this file is actually pretty involved
# I think the strategy is to modify all_in_one to not call main(), and instead
# call generate() directly. This will output, among other things, luarocks.exe.c,
# (and compile it), but we can re-compile with different cflags if we want.
# We probably also need a bunch of precompiled windows .a to get it to compile.
# TARGET_DIR .. "/" .. program_name .. ".exe.c"
#
# [[static const char* progname = "<program_name>";]]
# <c_preamble>
# [[static void load_main(lua_State* L) {]]
# <bin2c src/bin/luarocks>
# [[if(luaL_loadbuffer(L, code, sizeof(code), "<program_name>") != LUA_OK) {]]
# [[ 	fatal(lua_tostring(L, -1));]]
# [[}]]
# [[}]]
#
# ----------------------
# Lets modify all_in_one: delete the last line that calls main() and replace it
# with:
cfg.init()
cfg.variables.LUA_INCDIR_OK = true
cfg.variables.LUA_LIBDIR_OK = true
fs.init()
generate(MAIN_PROGRAM, "src", {EXCLUDE, "^bin/?"})

# Make the output directory
mkdir build-binary
# Then call it like:
LUAROCKS_CROSS_COMPILING=1 lua5.4 binary/all_in_one