diff options
Diffstat (limited to 'binary/all_in_one')
-rwxr-xr-x | binary/all_in_one | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/binary/all_in_one b/binary/all_in_one index 4fa0ba76..82ea578c 100755 --- a/binary/all_in_one +++ b/binary/all_in_one | |||
@@ -29,15 +29,20 @@ local MAIN_PROGRAM = arg[1] or "src/bin/luarocks" | |||
29 | local LUA_DIR = arg[2] or "/usr" | 29 | local LUA_DIR = arg[2] or "/usr" |
30 | local EXCLUDE = arg[3] or "^src/luarocks/admin/" | 30 | local EXCLUDE = arg[3] or "^src/luarocks/admin/" |
31 | local SYSCONFDIR = arg[4] or "/etc/luarocks" | 31 | local SYSCONFDIR = arg[4] or "/etc/luarocks" |
32 | local TARGET = arg[5] or "build-binary" | 32 | local TARGET_DIR = arg[5] or "build-binary" |
33 | local FORCE_CONFIG = (arg[6] == "yes") | 33 | local FORCE_CONFIG = (arg[6] == "yes") |
34 | local MY_PLATFORM = arg[7] or "unix" | 34 | local MY_PLATFORM = arg[7] or "unix" |
35 | local CC = arg[8] or "gcc" | 35 | local CC = arg[8] or "gcc" |
36 | local NM = arg[9] or "nm" | 36 | local NM = arg[9] or "nm" |
37 | local CROSSCOMPILER_SYSROOT = arg[10] or "/usr/lib/mingw-w64-sysroot/i686-w64-mingw32" | 37 | local CROSSCOMPILER_SYSROOT = arg[10] or "/usr/lib/mingw-w64-sysroot/i686-w64-mingw32" |
38 | local TRIPLET = arg[11] or CROSSCOMPILER_SYSROOT:gsub(".*/", "") | ||
39 | local PROCESSOR = arg[12] or TRIPLET:gsub("%-.*", "") | ||
40 | if PROCESSOR == "i686" then | ||
41 | PROCESSOR = "x86" | ||
42 | end | ||
38 | 43 | ||
39 | local LUA_MODULES = TARGET .. "/lua_modules" | 44 | local LUA_MODULES = TARGET_DIR .. "/lua_modules" |
40 | local CONFIG_DIR = TARGET .. "/.luarocks" | 45 | local CONFIG_DIR = TARGET_DIR .. "/.luarocks" |
41 | 46 | ||
42 | package.path = "./src/?.lua;" .. package.path | 47 | package.path = "./src/?.lua;" .. package.path |
43 | 48 | ||
@@ -144,7 +149,7 @@ local function write_hardcoded_module(dir) | |||
144 | if if_platform("unix", true) then | 149 | if if_platform("unix", true) then |
145 | system, processor = sysdetect.detect() | 150 | system, processor = sysdetect.detect() |
146 | else | 151 | else |
147 | system, processor = "windows", "x86" | 152 | system, processor = "windows", PROCESSOR |
148 | end | 153 | end |
149 | 154 | ||
150 | local hardcoded = { | 155 | local hardcoded = { |
@@ -400,7 +405,7 @@ local function generate(main_program, dir, skip) | |||
400 | 405 | ||
401 | os.remove(hardcoded) | 406 | os.remove(hardcoded) |
402 | 407 | ||
403 | local c_filename = TARGET .. "/" .. program_name .. ".exe.c" | 408 | local c_filename = TARGET_DIR .. "/" .. program_name .. ".exe.c" |
404 | local fd = io.open(c_filename, "w") | 409 | local fd = io.open(c_filename, "w") |
405 | fd:write(reindent_c(table.concat(out, "\n"))) | 410 | fd:write(reindent_c(table.concat(out, "\n"))) |
406 | fd:close() | 411 | fd:close() |
@@ -409,7 +414,7 @@ local function generate(main_program, dir, skip) | |||
409 | deps.check_lua_libdir(cfg.variables) | 414 | deps.check_lua_libdir(cfg.variables) |
410 | 415 | ||
411 | cmd = table.concat(filter_in(nonnull, { | 416 | cmd = table.concat(filter_in(nonnull, { |
412 | CC, "-o", TARGET .. "/" .. program_name .. ".exe", | 417 | CC, "-o", TARGET_DIR .. "/" .. program_name .. ".exe", |
413 | "-I", cfg.variables.LUA_INCDIR, | 418 | "-I", cfg.variables.LUA_INCDIR, |
414 | if_platform("unix", "-rdynamic"), | 419 | if_platform("unix", "-rdynamic"), |
415 | "-Os", | 420 | "-Os", |
@@ -453,7 +458,7 @@ local function main() | |||
453 | LIBFLAG = "-static", | 458 | LIBFLAG = "-static", |
454 | }, | 459 | }, |
455 | platforms = if_platform("windows", { "windows", "win32", "mingw32" }), | 460 | platforms = if_platform("windows", { "windows", "win32", "mingw32" }), |
456 | external_deps_dirs = if_platform("windows", { CROSSCOMPILER_SYSROOT, fs.current_dir().."/windows-deps" }), | 461 | external_deps_dirs = if_platform("windows", { CROSSCOMPILER_SYSROOT, fs.current_dir() .. "/windows-deps-" .. TRIPLET }), |
457 | }) | 462 | }) |
458 | 463 | ||
459 | local dependencies = { | 464 | local dependencies = { |