aboutsummaryrefslogtreecommitdiff
path: root/binary/all_in_one
diff options
context:
space:
mode:
Diffstat (limited to 'binary/all_in_one')
-rwxr-xr-xbinary/all_in_one26
1 files changed, 14 insertions, 12 deletions
diff --git a/binary/all_in_one b/binary/all_in_one
index bfe9c974..34b84a2c 100755
--- a/binary/all_in_one
+++ b/binary/all_in_one
@@ -164,7 +164,7 @@ local function write_hardcoded_module(dir)
164 LUA_BINDIR = if_platform("unix", cfg.variables.LUA_BINDIR), 164 LUA_BINDIR = if_platform("unix", cfg.variables.LUA_BINDIR),
165 LUA_INTERPRETER = if_platform("unix", cfg.lua_interpreter), 165 LUA_INTERPRETER = if_platform("unix", cfg.lua_interpreter),
166 } 166 }
167 167
168 local name = dir .. "/luarocks/core/hardcoded.lua" 168 local name = dir .. "/luarocks/core/hardcoded.lua"
169 persist.save_as_module(name, hardcoded) 169 persist.save_as_module(name, hardcoded)
170 return name 170 return name
@@ -335,7 +335,7 @@ static int pmain(lua_State *L) {
335/* error handler, from luac */ 335/* error handler, from luac */
336static int msghandler (lua_State *L) { 336static int msghandler (lua_State *L) {
337 /* is error object not a string? */ 337 /* is error object not a string? */
338 const char *msg = lua_tostring(L, 1); 338 const char *msg = lua_tostring(L, 1);
339 if (msg == NULL) { 339 if (msg == NULL) {
340 /* does it have a metamethod that produces a string */ 340 /* does it have a metamethod that produces a string */
341 if (luaL_callmeta(L, 1, "__tostring") && lua_type(L, -1) == LUA_TSTRING) { 341 if (luaL_callmeta(L, 1, "__tostring") && lua_type(L, -1) == LUA_TSTRING) {
@@ -393,7 +393,7 @@ local function generate(main_program, dir, skip)
393 local program_name = main_program:gsub(".*/", "") 393 local program_name = main_program:gsub(".*/", "")
394 394
395 local hardcoded = write_hardcoded_module(dir) 395 local hardcoded = write_hardcoded_module(dir)
396 396
397 local out = {} 397 local out = {}
398 table.insert(out, ([[static const char* progname = %q;]]):format(program_name)) 398 table.insert(out, ([[static const char* progname = %q;]]):format(program_name))
399 table.insert(out, c_preamble) 399 table.insert(out, c_preamble)
@@ -404,7 +404,7 @@ local function generate(main_program, dir, skip)
404 table.insert(out, c_main) 404 table.insert(out, c_main)
405 405
406 os.remove(hardcoded) 406 os.remove(hardcoded)
407 407
408 local c_filename = TARGET_DIR .. "/" .. program_name .. ".exe.c" 408 local c_filename = TARGET_DIR .. "/" .. program_name .. ".exe.c"
409 local fd = io.open(c_filename, "w") 409 local fd = io.open(c_filename, "w")
410 fd:write(reindent_c(table.concat(out, "\n"))) 410 fd:write(reindent_c(table.concat(out, "\n")))
@@ -412,7 +412,7 @@ local function generate(main_program, dir, skip)
412 412
413 deps.check_lua_incdir(cfg.variables) 413 deps.check_lua_incdir(cfg.variables)
414 deps.check_lua_libdir(cfg.variables) 414 deps.check_lua_libdir(cfg.variables)
415 415
416 cmd = table.concat(filter_in(nonnull, { 416 cmd = table.concat(filter_in(nonnull, {
417 CC, "-o", TARGET_DIR .. "/" .. program_name .. ".exe", 417 CC, "-o", TARGET_DIR .. "/" .. program_name .. ".exe",
418 "-I", cfg.variables.LUA_INCDIR, 418 "-I", cfg.variables.LUA_INCDIR,
@@ -426,6 +426,7 @@ local function generate(main_program, dir, skip)
426 cfg.variables.LUA_LIBDIR .. "/" .. cfg.variables.LUALIB:gsub("%.so.*$", ".a"), 426 cfg.variables.LUA_LIBDIR .. "/" .. cfg.variables.LUALIB:gsub("%.so.*$", ".a"),
427 if_platform("unix", "-ldl"), 427 if_platform("unix", "-ldl"),
428 if_platform("unix", "-lpthread"), 428 if_platform("unix", "-lpthread"),
429 if_platform("windows", "-mwindows"),
429 "-lm" 430 "-lm"
430 }), " ") 431 }), " ")
431 print(cmd) 432 print(cmd)
@@ -445,7 +446,7 @@ local function main()
445 path.use_tree(LUA_MODULES) 446 path.use_tree(LUA_MODULES)
446 447
447 local CONFIG_FILE = CONFIG_DIR .. "/config-" .. cfg.lua_version .. ".lua" 448 local CONFIG_FILE = CONFIG_DIR .. "/config-" .. cfg.lua_version .. ".lua"
448 449
449 fs.make_dir(CONFIG_DIR) 450 fs.make_dir(CONFIG_DIR)
450 451
451 persist.save_from_table(CONFIG_FILE, { 452 persist.save_from_table(CONFIG_FILE, {
@@ -456,22 +457,23 @@ local function main()
456 LD = fs.current_dir() .. "/binary/static-gcc", 457 LD = fs.current_dir() .. "/binary/static-gcc",
457 LIB_EXTENSION = "a", 458 LIB_EXTENSION = "a",
458 LIBFLAG = "-static", 459 LIBFLAG = "-static",
460 PWD = "pwd",
459 }, 461 },
460 platforms = if_platform("windows", { "windows", "win32", "mingw32" }), 462 platforms = if_platform("windows", { "windows", "win32", "mingw32" }),
461 external_deps_dirs = if_platform("windows", { CROSSCOMPILER_SYSROOT, fs.current_dir() .. "/windows-deps-" .. TRIPLET }), 463 external_deps_dirs = if_platform("windows", { CROSSCOMPILER_SYSROOT, fs.current_dir() .. "/windows-deps-" .. TRIPLET }),
462 }) 464 })
463 465
464 local dependencies = { 466 local dependencies = {
465 md5 = "md5", 467 md5 = "md5",
466 luasec = "./binary/luasec-0.8.1-2.rockspec", 468 luasec = "./binary/luasec-1.0.2-1.rockspec",
467 luaposix = if_platform("unix", "./binary/luaposix-34.0.4-1.rockspec"),
468 luasocket = "luasocket",
469 ["lua-zlib"] = "./binary/lua-zlib-1.2-0.rockspec", 469 ["lua-zlib"] = "./binary/lua-zlib-1.2-0.rockspec",
470 ["lua-bz2"] = "./binary/lua-bz2-0.1.0-1.rockspec", 470 ["lua-bz2"] = "./binary/lua-bz2-0.2.1-1.rockspec",
471 luaposix = if_platform("unix", "./binary/luaposix-35.1-1.rockspec"),
472 luasocket = "luasocket",
471 luafilesystem = "luafilesystem", 473 luafilesystem = "luafilesystem",
472 dkjson = "dkjson", 474 dkjson = "dkjson",
473 } 475 }
474 476
475 fs.make_dir(LUA_MODULES) 477 fs.make_dir(LUA_MODULES)
476 for name, arg in pairs(dependencies) do 478 for name, arg in pairs(dependencies) do
477 print("----------------------------------------------------------------") 479 print("----------------------------------------------------------------")