diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-02 19:27:48 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-02 19:27:48 -0300 |
| commit | 8dd1e1460282f5fc992d838ec2411f4d1bc7b2b7 (patch) | |
| tree | 5b6e88d37869bad4a23cfd52424e91fa34d34176 /binary | |
| parent | 672b4f191ac5723ee460e469d58fff2ca2cb386b (diff) | |
| download | luarocks-8dd1e1460282f5fc992d838ec2411f4d1bc7b2b7.tar.gz luarocks-8dd1e1460282f5fc992d838ec2411f4d1bc7b2b7.tar.bz2 luarocks-8dd1e1460282f5fc992d838ec2411f4d1bc7b2b7.zip | |
Experimental Windows cross-compiled binary build
This commit consolidates the work that has been ongoing over the
last few weeks in producing the single-binary builds of LuaRocks
based on the new distribution model described in
https://github.com/luarocks/luarocks/wiki/Project:-LuaRocks-new-distribution-model
The single-binary build is in a good shape for Linux,
it's a work-in-progress for Windows (binaries do build,
but some work on the dependencies is still necessary),
and is untested in macOS.
Diffstat (limited to 'binary')
| -rw-r--r-- | binary/Makefile.windows | 59 | ||||
| -rwxr-xr-x | binary/all_in_one | 145 | ||||
| -rw-r--r-- | binary/lua-zlib-1.2-0.rockspec | 39 | ||||
| -rw-r--r-- | binary/luasec-0.7alpha-2.rockspec | 9 | ||||
| -rwxr-xr-x | binary/static-gcc | 25 |
5 files changed, 221 insertions, 56 deletions
diff --git a/binary/Makefile.windows b/binary/Makefile.windows new file mode 100644 index 00000000..ea8f0a60 --- /dev/null +++ b/binary/Makefile.windows | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | |||
| 2 | # "i686-w64-mingw32" or "x86_64-w64-mingw32" | ||
| 3 | MINGW_PREFIX=i686-w64-mingw32 | ||
| 4 | # sysroot of your mingw-w64 installation | ||
| 5 | MINGW_SYSROOT=/usr/lib/mingw-w64-sysroot/$(MINGW_PREFIX) | ||
| 6 | # "mingw" or "mingw64" | ||
| 7 | OPENSSL_PLATFORM=mingw | ||
| 8 | # Versions of dependencies | ||
| 9 | LIBLUA_VERSION=5.3.4 | ||
| 10 | OPENSSL_VERSION=1.0.2o | ||
| 11 | ZLIB_VERSION=1.2.11 | ||
| 12 | |||
| 13 | windows-binary: windows-deps/lib/liblua.a windows-deps/lib/libssl.a windows-deps/lib/libz.a | ||
| 14 | STATIC_GCC_AR=$(MINGW_PREFIX)-ar \ | ||
| 15 | STATIC_GCC_RANLIB=$(MINGW_PREFIX)-ranlib \ | ||
| 16 | STATIC_GCC_CC=$(MINGW_PREFIX)-gcc \ | ||
| 17 | STATIC_GCC_LIBDIR=$(MINGW_SYSROOT)/lib \ | ||
| 18 | LUAROCKS_CROSS_COMPILING=1 \ | ||
| 19 | make binary LUA_DIR=$(PWD)/windows-deps BINARY_CC=$(MINGW_PREFIX)-gcc BINARY_NM=$(MINGW_PREFIX)-nm BINARY_PLATFORM=windows BINARY_TARGET=build-windows-binary BINARY_SYSROOT=$(MINGW_SYSROOT) | ||
| 20 | |||
| 21 | build-windows-deps/lua-$(LIBLUA_VERSION).tar.gz: | ||
| 22 | mkdir -p build-windows-deps | ||
| 23 | cd build-windows-deps && curl -OL https://www.lua.org/ftp/lua-$(LIBLUA_VERSION).tar.gz | ||
| 24 | build-windows-deps/lua-$(LIBLUA_VERSION): build-windows-deps/lua-$(LIBLUA_VERSION).tar.gz | ||
| 25 | cd build-windows-deps && tar zxvpf lua-$(LIBLUA_VERSION).tar.gz | ||
| 26 | windows-deps/lib/liblua.a: build-windows-deps/lua-$(LIBLUA_VERSION) | ||
| 27 | cd build-windows-deps/lua-$(LIBLUA_VERSION)/src && make LUA_A=liblua.a CC=$(MINGW_PREFIX)-gcc AR="$(MINGW_PREFIX)-ar rcu" RANLIB=$(MINGW_PREFIX)-ranlib SYSCFLAGS= SYSLIBS= SYSLDFLAGS= liblua.a | ||
| 28 | mkdir -p windows-deps/include | ||
| 29 | cd build-windows-deps/lua-$(LIBLUA_VERSION)/src && cp lauxlib.h lua.h lua.hpp luaconf.h lualib.h ../../../windows-deps/include | ||
| 30 | mkdir -p windows-deps/lib | ||
| 31 | cd build-windows-deps/lua-$(LIBLUA_VERSION)/src && cp liblua.a ../../../windows-deps/lib | ||
| 32 | |||
| 33 | build-windows-deps/openssl-$(OPENSSL_VERSION).tar.gz: | ||
| 34 | mkdir -p build-windows-deps | ||
| 35 | cd build-windows-deps && curl -OL https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz | ||
| 36 | build-windows-deps/openssl-$(OPENSSL_VERSION): build-windows-deps/openssl-$(OPENSSL_VERSION).tar.gz | ||
| 37 | cd build-windows-deps && tar zxvpf openssl-$(OPENSSL_VERSION).tar.gz | ||
| 38 | windows-deps/lib/libssl.a: build-windows-deps/openssl-$(OPENSSL_VERSION) | ||
| 39 | cd build-windows-deps/openssl-$(OPENSSL_VERSION) && ./Configure --prefix=$(PWD)/windows-deps --cross-compile-prefix=$(MINGW_PREFIX)- $(OPENSSL_PLATFORM) | ||
| 40 | cd build-windows-deps/openssl-$(OPENSSL_VERSION) && make install_sw | ||
| 41 | |||
| 42 | build-windows-deps/zlib-$(ZLIB_VERSION).tar.gz: | ||
| 43 | mkdir -p build-windows-deps | ||
| 44 | cd build-windows-deps && curl -OL https://www.zlib.net/zlib-$(ZLIB_VERSION).tar.gz | ||
| 45 | build-windows-deps/zlib-$(ZLIB_VERSION): build-windows-deps/zlib-$(ZLIB_VERSION).tar.gz | ||
| 46 | cd build-windows-deps && tar zxvpf zlib-$(ZLIB_VERSION).tar.gz | ||
| 47 | windows-deps/lib/libz.a: build-windows-deps/zlib-$(ZLIB_VERSION) | ||
| 48 | cd build-windows-deps/zlib-$(ZLIB_VERSION) && sed -ie "s,dllwrap,$(MINGW_PREFIX)-dllwrap," win32/Makefile.gcc | ||
| 49 | cd build-windows-deps/zlib-$(ZLIB_VERSION) && ./configure --prefix=$(PWD)/windows-deps --static | ||
| 50 | cd build-windows-deps/zlib-$(ZLIB_VERSION) && make -f win32/Makefile.gcc CC=$(MINGW_PREFIX)-gcc AR=$(MINGW_PREFIX)-ar RC=$(MINGW_PREFIX)-windres STRIP=$(MINGW_PREFIX)-strip IMPLIB=libz.dll.a | ||
| 51 | mkdir -p windows-deps/include | ||
| 52 | cd build-windows-deps/zlib-$(ZLIB_VERSION) && cp zlib.h zconf.h ../../windows-deps/include | ||
| 53 | cd build-windows-deps/zlib-$(ZLIB_VERSION) && $(MINGW_PREFIX)-strip -g libz.a | ||
| 54 | mkdir -p windows-deps/lib | ||
| 55 | cd build-windows-deps/zlib-$(ZLIB_VERSION) && cp libz.a ../../windows-deps/lib | ||
| 56 | |||
| 57 | windows-clean: | ||
| 58 | rm -rf windows-deps | ||
| 59 | rm -rf build-windows-binary | ||
diff --git a/binary/all_in_one b/binary/all_in_one index de545d04..9c7a690c 100755 --- a/binary/all_in_one +++ b/binary/all_in_one | |||
| @@ -30,6 +30,10 @@ 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 "binary-build" | 32 | local TARGET = arg[5] or "binary-build" |
| 33 | local MY_PLATFORM = arg[6] or "unix" | ||
| 34 | local CC = arg[7] or "gcc" | ||
| 35 | local NM = arg[8] or "nm" | ||
| 36 | local CROSSCOMPILER_SYSROOT = arg[9] or "/usr/lib/mingw-w64-sysroot/i686-w64-mingw32" | ||
| 33 | 37 | ||
| 34 | local LUA_MODULES = TARGET .. "/lua_modules" | 38 | local LUA_MODULES = TARGET .. "/lua_modules" |
| 35 | local CONFIG_DIR = TARGET .. "/.luarocks" | 39 | local CONFIG_DIR = TARGET .. "/.luarocks" |
| @@ -48,6 +52,12 @@ local persist = require("luarocks.persist") | |||
| 48 | 52 | ||
| 49 | -------------------------------------------------------------------------------- | 53 | -------------------------------------------------------------------------------- |
| 50 | 54 | ||
| 55 | local function if_platform(plat, val) | ||
| 56 | if MY_PLATFORM == plat then | ||
| 57 | return val | ||
| 58 | end | ||
| 59 | end | ||
| 60 | |||
| 51 | local function reindent_c(input) | 61 | local function reindent_c(input) |
| 52 | local out = {} | 62 | local out = {} |
| 53 | local indent = 0 | 63 | local indent = 0 |
| @@ -110,10 +120,18 @@ local c_preamble = [[ | |||
| 110 | 120 | ||
| 111 | static int registry_key; | 121 | static int registry_key; |
| 112 | 122 | ||
| 123 | /* fatal error, from srlua */ | ||
| 124 | static void fatal(const char* message) { | ||
| 125 | alert(message); | ||
| 126 | exit(EXIT_FAILURE); | ||
| 127 | } | ||
| 128 | |||
| 113 | ]] | 129 | ]] |
| 114 | 130 | ||
| 115 | local function bin2c_file(out, filename) | 131 | local function bin2c_file(out, filename) |
| 116 | local content = string.dump(assert(loadfile(filename))) | 132 | local fd = io.open(filename, "rb") |
| 133 | local content = fd:read("*a"):gsub("^#![^\n]+\n", "") | ||
| 134 | fd:close() | ||
| 117 | table.insert(out, ("static const unsigned char code[] = {")) | 135 | table.insert(out, ("static const unsigned char code[] = {")) |
| 118 | table.insert(out, hexdump(content)) | 136 | table.insert(out, hexdump(content)) |
| 119 | table.insert(out, ("};")) | 137 | table.insert(out, ("};")) |
| @@ -121,24 +139,32 @@ end | |||
| 121 | 139 | ||
| 122 | local function write_hardcoded_module(dir) | 140 | local function write_hardcoded_module(dir) |
| 123 | 141 | ||
| 124 | local system = util.popen_read("uname -s") | 142 | local system = if_platform("windows", "MINGW") |
| 125 | local processor = util.popen_read("uname -m") | 143 | local processor = if_platform("windows", "x86") |
| 126 | 144 | ||
| 127 | if processor:match("i[%d]86") then | 145 | if not system then |
| 128 | processor = "x86" | 146 | system = util.popen_read("uname -s") |
| 129 | elseif processor:match("amd64") or processor:match("x86_64") then | 147 | processor = util.popen_read("uname -m") |
| 130 | processor = "x86_64" | 148 | |
| 131 | elseif processor:match("Power Macintosh") then | 149 | if processor:match("i[%d]86") then |
| 132 | processor = "powerpc" | 150 | processor = "x86" |
| 151 | elseif processor:match("amd64") or processor:match("x86_64") then | ||
| 152 | processor = "x86_64" | ||
| 153 | elseif processor:match("Power Macintosh") then | ||
| 154 | processor = "powerpc" | ||
| 155 | end | ||
| 133 | end | 156 | end |
| 134 | 157 | ||
| 135 | local hardcoded = { | 158 | local hardcoded = { |
| 136 | SYSTEM = system, | 159 | SYSTEM = system, |
| 137 | PROCESSOR = processor, | 160 | PROCESSOR = processor, |
| 138 | SYSCONFDIR = SYSCONFDIR, | 161 | |
| 139 | LUA_DIR = cfg.variables.LUA_DIR, | 162 | SYSCONFDIR = if_platform("unix", SYSCONFDIR), |
| 140 | LUA_BINDIR = cfg.variables.LUA_BINDIR, | 163 | |
| 141 | LUA_INTERPRETER = cfg.lua_interpreter, | 164 | LUA_DIR = if_platform("unix", cfg.variables.LUA_DIR), |
| 165 | LUA_BINDIR = if_platform("unix", cfg.variables.LUA_BINDIR) | ||
| 166 | or if_platform("windows", "."), | ||
| 167 | LUA_INTERPRETER = if_platform("unix", cfg.lua_interpreter), | ||
| 142 | } | 168 | } |
| 143 | 169 | ||
| 144 | local name = dir .. "/luarocks/core/hardcoded.lua" | 170 | local name = dir .. "/luarocks/core/hardcoded.lua" |
| @@ -187,7 +213,7 @@ local function declare_modules(out, dirs, skip) | |||
| 187 | end | 213 | end |
| 188 | 214 | ||
| 189 | local function nm(filename) | 215 | local function nm(filename) |
| 190 | local pd = io.popen("nm " .. filename) | 216 | local pd = io.popen(NM .. " " .. filename) |
| 191 | local out = pd:read("*a") | 217 | local out = pd:read("*a") |
| 192 | pd:close() | 218 | pd:close() |
| 193 | return out | 219 | return out |
| @@ -244,7 +270,9 @@ end | |||
| 244 | local function load_main(out, main_program, program_name) | 270 | local function load_main(out, main_program, program_name) |
| 245 | table.insert(out, [[static void load_main(lua_State* L) {]]) | 271 | table.insert(out, [[static void load_main(lua_State* L) {]]) |
| 246 | bin2c_file(out, main_program) | 272 | bin2c_file(out, main_program) |
| 247 | table.insert(out, ("luaL_loadbuffer(L, code, sizeof(code), %q);"):format(program_name)) | 273 | table.insert(out, ("if(luaL_loadbuffer(L, code, sizeof(code), %q) != LUA_OK) {"):format(program_name)) |
| 274 | table.insert(out, (" fatal(lua_tostring(L, -1));")) | ||
| 275 | table.insert(out, ("}")) | ||
| 248 | table.insert(out, [[}]]) | 276 | table.insert(out, [[}]]) |
| 249 | table.insert(out, [[]]) | 277 | table.insert(out, [[]]) |
| 250 | end | 278 | end |
| @@ -262,7 +290,7 @@ static int pkg_loader(lua_State* L) { | |||
| 262 | lua_pop(L, 1); /* modname ? modules */ | 290 | lua_pop(L, 1); /* modname ? modules */ |
| 263 | lua_pushvalue(L, 1); /* modname ? modules modname */ | 291 | lua_pushvalue(L, 1); /* modname ? modules modname */ |
| 264 | lua_pushliteral(L, ".init"); /* modname ? modules modname ".init" */ | 292 | lua_pushliteral(L, ".init"); /* modname ? modules modname ".init" */ |
| 265 | lua_concat(L, 2); /* modname ? modules modname .. ".init" */ | 293 | lua_concat(L, 2); /* modname ? modules modname..".init" */ |
| 266 | lua_gettable(L, -2); /* modname ? mod */ | 294 | lua_gettable(L, -2); /* modname ? mod */ |
| 267 | } | 295 | } |
| 268 | return 1; | 296 | return 1; |
| @@ -306,12 +334,6 @@ static int pmain(lua_State *L) { | |||
| 306 | return 0; | 334 | return 0; |
| 307 | } | 335 | } |
| 308 | 336 | ||
| 309 | /* fatal error, from srlua */ | ||
| 310 | static void fatal(const char* message) { | ||
| 311 | alert(message); | ||
| 312 | exit(EXIT_FAILURE); | ||
| 313 | } | ||
| 314 | |||
| 315 | /* error handler, from luac */ | 337 | /* error handler, from luac */ |
| 316 | static int msghandler (lua_State *L) { | 338 | static int msghandler (lua_State *L) { |
| 317 | /* is error object not a string? */ | 339 | /* is error object not a string? */ |
| @@ -358,14 +380,25 @@ int main(int argc, char** argv) { | |||
| 358 | 380 | ||
| 359 | ]] | 381 | ]] |
| 360 | 382 | ||
| 383 | local function filter_in(f, xs) | ||
| 384 | for i = #xs, 1, -1 do | ||
| 385 | if not f(xs[i]) then | ||
| 386 | table.remove(xs, i) | ||
| 387 | end | ||
| 388 | end | ||
| 389 | return xs | ||
| 390 | end | ||
| 391 | |||
| 392 | local function nonnull(x) return x ~= nil end | ||
| 393 | |||
| 361 | local function generate(main_program, dir, skip) | 394 | local function generate(main_program, dir, skip) |
| 362 | local program_name = main_program:gsub(".*/", "") | 395 | local program_name = main_program:gsub(".*/", "") |
| 363 | 396 | ||
| 364 | local hardcoded = write_hardcoded_module(dir) | 397 | local hardcoded = write_hardcoded_module(dir) |
| 365 | 398 | ||
| 366 | local out = {} | 399 | local out = {} |
| 367 | table.insert(out, c_preamble) | ||
| 368 | table.insert(out, ([[static const char* progname = %q;]]):format(program_name)) | 400 | table.insert(out, ([[static const char* progname = %q;]]):format(program_name)) |
| 401 | table.insert(out, c_preamble) | ||
| 369 | load_main(out, main_program, program_name) | 402 | load_main(out, main_program, program_name) |
| 370 | local lua_modules = LUA_MODULES .. "/share/lua/" .. cfg.lua_version | 403 | local lua_modules = LUA_MODULES .. "/share/lua/" .. cfg.lua_version |
| 371 | declare_modules(out, { dir, lua_modules }, skip) | 404 | declare_modules(out, { dir, lua_modules }, skip) |
| @@ -378,17 +411,23 @@ local function generate(main_program, dir, skip) | |||
| 378 | local fd = io.open(c_filename, "w") | 411 | local fd = io.open(c_filename, "w") |
| 379 | fd:write(reindent_c(table.concat(out, "\n"))) | 412 | fd:write(reindent_c(table.concat(out, "\n"))) |
| 380 | fd:close() | 413 | fd:close() |
| 414 | |||
| 415 | deps.check_lua(cfg.variables) | ||
| 381 | 416 | ||
| 382 | cmd = table.concat({ | 417 | cmd = table.concat(filter_in(nonnull, { |
| 383 | "gcc", "-o", TARGET .. "/" .. program_name .. ".exe", | 418 | CC, "-o", TARGET .. "/" .. program_name .. ".exe", |
| 384 | "-I", cfg.variables.LUA_INCDIR, | 419 | "-I", cfg.variables.LUA_INCDIR, |
| 385 | "-rdynamic", | 420 | if_platform("unix", "-rdynamic"), |
| 386 | "-Os", | 421 | "-Os", |
| 387 | c_filename, | 422 | c_filename, |
| 388 | "-L", cfg.variables.LUA_LIBDIR, | 423 | "-L", cfg.variables.LUA_LIBDIR, |
| 389 | table.concat(a_files, " "), | 424 | table.concat(a_files, " "), |
| 425 | --if_platform("unix", cfg.variables.LUA_LIBDIR .. "/" .. cfg.variables.LUALIB:gsub("%.so.*$", ".a")), | ||
| 426 | --if_platform("windows", "mingw/liblua.a"), -- FIXME | ||
| 390 | cfg.variables.LUA_LIBDIR .. "/" .. cfg.variables.LUALIB:gsub("%.so.*$", ".a"), | 427 | cfg.variables.LUA_LIBDIR .. "/" .. cfg.variables.LUALIB:gsub("%.so.*$", ".a"), |
| 391 | "-ldl", "-lm"}, " ") | 428 | if_platform("unix", "-ldl"), |
| 429 | "-lm" | ||
| 430 | }), " ") | ||
| 392 | print(cmd) | 431 | print(cmd) |
| 393 | os.execute(cmd) | 432 | os.execute(cmd) |
| 394 | end | 433 | end |
| @@ -397,46 +436,56 @@ end | |||
| 397 | 436 | ||
| 398 | local function main() | 437 | local function main() |
| 399 | 438 | ||
| 400 | cfg.init(cmd.find_lua(LUA_DIR)) | 439 | os.remove("src/luarocks/core/hardcoded.lua") |
| 440 | cfg.init() | ||
| 441 | cfg.variables.LUA_DIR = LUA_DIR | ||
| 442 | cfg.variables.LUA_INCDIR = nil -- let it autodetect later | ||
| 443 | cfg.variables.LUA_LIBDIR = nil -- let it autodetect later | ||
| 401 | fs.init() | 444 | fs.init() |
| 402 | deps.check_lua(cfg.variables) | ||
| 403 | path.use_tree("./" .. LUA_MODULES) | 445 | path.use_tree("./" .. LUA_MODULES) |
| 404 | 446 | ||
| 405 | local CONFIG_FILE = CONFIG_DIR .. "/config-" .. cfg.lua_version .. ".lua" | 447 | local CONFIG_FILE = CONFIG_DIR .. "/config-" .. cfg.lua_version .. ".lua" |
| 406 | 448 | ||
| 407 | fs.make_dir(CONFIG_DIR) | 449 | fs.make_dir(CONFIG_DIR) |
| 408 | local fd = io.open(CONFIG_FILE, "w") | 450 | |
| 409 | fd:write([[ | 451 | persist.save_from_table(CONFIG_FILE, { |
| 410 | lib_extension = "a" | 452 | lib_extension = "a", |
| 411 | external_lib_extension = "a" | 453 | external_lib_extension = "a", |
| 412 | variables = { | 454 | variables = { |
| 413 | CC = "]] .. fs.current_dir() .. [[/static-gcc", | 455 | CC = fs.current_dir() .. "/binary/static-gcc", |
| 414 | LD = "]] .. fs.current_dir() .. [[/static-gcc", | 456 | LD = fs.current_dir() .. "/binary/static-gcc", |
| 415 | LIB_EXTENSION = "a", | 457 | LIB_EXTENSION = "a", |
| 416 | LIBFLAG = "-static", | 458 | LIBFLAG = "-static", |
| 417 | } | 459 | }, |
| 418 | ]]) | 460 | platforms = if_platform("windows", { "windows", "win32", "mingw32" }), |
| 419 | fd:close() | 461 | external_deps_dirs = if_platform("windows", { CROSSCOMPILER_SYSROOT, fs.current_dir().."/windows-deps" }), |
| 462 | }) | ||
| 420 | 463 | ||
| 421 | local dependencies = { | 464 | local dependencies = { |
| 422 | md5 = "md5", | 465 | md5 = "md5", |
| 423 | luazip = "luazip", | 466 | luazip = if_platform("unix", "luazip"), |
| 424 | luasec = "./luasec-0.7alpha-2.rockspec", | 467 | luasec = "./binary/luasec-0.7alpha-2.rockspec", |
| 425 | luaposix = "./luaposix-34.0.4-1.rockspec", | 468 | luaposix = if_platform("unix", "./binary/luaposix-34.0.4-1.rockspec"), |
| 426 | luasocket = "luasocket", | 469 | luasocket = "luasocket", |
| 427 | ["lua-zlib"] = "lua-zlib", | 470 | ["lua-zlib"] = "./binary/lua-zlib-1.2-0.rockspec", |
| 428 | luafilesystem = "luafilesystem", | 471 | luafilesystem = "luafilesystem", |
| 429 | } | 472 | } |
| 430 | 473 | ||
| 431 | fs.make_dir(LUA_MODULES) | 474 | fs.make_dir(LUA_MODULES) |
| 432 | for name, arg in pairs(dependencies) do | 475 | for name, arg in pairs(dependencies) do |
| 476 | print("----------------------------------------------------------------") | ||
| 477 | print(name) | ||
| 478 | print("----------------------------------------------------------------") | ||
| 433 | local vers = manif.get_versions(queries.from_dep_string(name), "one") | 479 | local vers = manif.get_versions(queries.from_dep_string(name), "one") |
| 434 | if not next(vers) then | 480 | if not next(vers) then |
| 435 | os.execute("LUAROCKS_CONFIG='" .. CONFIG_FILE .. "' ./luarocks install '--tree=" .. LUA_MODULES .. "' " .. arg) | 481 | local ok = os.execute("LUAROCKS_CONFIG='" .. CONFIG_FILE .. "' ./luarocks install '--tree=" .. LUA_MODULES .. "' " .. arg) |
| 482 | if ok ~= 0 and ok ~= true then | ||
| 483 | error("Failed building dependency: " .. name) | ||
| 484 | end | ||
| 436 | end | 485 | end |
| 437 | end | 486 | end |
| 438 | 487 | ||
| 439 | generate(MAIN_PROGRAM, "src", { EXCLUDE, "^bin/?" }) | 488 | generate(MAIN_PROGRAM, "src", { EXCLUDE, "core/site_config", "^bin/?" }) |
| 440 | end | 489 | end |
| 441 | 490 | ||
| 442 | main() | 491 | main() |
diff --git a/binary/lua-zlib-1.2-0.rockspec b/binary/lua-zlib-1.2-0.rockspec new file mode 100644 index 00000000..dd0c4a15 --- /dev/null +++ b/binary/lua-zlib-1.2-0.rockspec | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | package = "lua-zlib" | ||
| 2 | version = "1.2-0" | ||
| 3 | source = { | ||
| 4 | url = "git://github.com/brimworks/lua-zlib.git", | ||
| 5 | tag = "v1.2", | ||
| 6 | } | ||
| 7 | description = { | ||
| 8 | summary = "Simple streaming interface to zlib for Lua.", | ||
| 9 | detailed = [[ | ||
| 10 | Simple streaming interface to zlib for Lua. | ||
| 11 | Consists of two functions: inflate and deflate. | ||
| 12 | Both functions return "stream functions" (takes a buffer of input and returns a buffer of output). | ||
| 13 | This project is hosted on github. | ||
| 14 | ]], | ||
| 15 | homepage = "https://github.com/brimworks/lua-zlib", | ||
| 16 | license = "MIT" | ||
| 17 | } | ||
| 18 | dependencies = { | ||
| 19 | "lua >= 5.1, <= 5.3" | ||
| 20 | } | ||
| 21 | external_dependencies = { | ||
| 22 | ZLIB = { | ||
| 23 | header = "zlib.h", | ||
| 24 | library = "z", | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | build = { | ||
| 29 | type = "builtin", | ||
| 30 | modules = { | ||
| 31 | zlib = { | ||
| 32 | sources = { "lua_zlib.c" }, | ||
| 33 | libraries = { "z" }, | ||
| 34 | defines = { "LZLIB_COMPAT" }, | ||
| 35 | incdirs = { "$(ZLIB_INCDIR)" }, | ||
| 36 | libdirs = { "$(ZLIB_LIBDIR)" }, | ||
| 37 | } | ||
| 38 | }, | ||
| 39 | } | ||
diff --git a/binary/luasec-0.7alpha-2.rockspec b/binary/luasec-0.7alpha-2.rockspec index 2736ca15..89d516b5 100644 --- a/binary/luasec-0.7alpha-2.rockspec +++ b/binary/luasec-0.7alpha-2.rockspec | |||
| @@ -26,6 +26,11 @@ external_dependencies = { | |||
| 26 | header = "openssl/ssl.h", | 26 | header = "openssl/ssl.h", |
| 27 | } | 27 | } |
| 28 | }, | 28 | }, |
| 29 | mingw32 = { | ||
| 30 | OPENSSL = { | ||
| 31 | library = "ssl", | ||
| 32 | } | ||
| 33 | }, | ||
| 29 | } | 34 | } |
| 30 | } | 35 | } |
| 31 | build = { | 36 | build = { |
| @@ -60,11 +65,11 @@ build = { | |||
| 60 | } | 65 | } |
| 61 | } | 66 | } |
| 62 | }, | 67 | }, |
| 63 | mingw = { | 68 | mingw32 = { |
| 64 | modules = { | 69 | modules = { |
| 65 | ssl = { | 70 | ssl = { |
| 66 | libraries = { | 71 | libraries = { |
| 67 | "ssl", "crypto", | 72 | "ssl", "crypto", "ws2_32", "gdi32" |
| 68 | } | 73 | } |
| 69 | } | 74 | } |
| 70 | } | 75 | } |
diff --git a/binary/static-gcc b/binary/static-gcc index a4d865d5..c08f24b2 100755 --- a/binary/static-gcc +++ b/binary/static-gcc | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
| 2 | 2 | ||
| 3 | STATIC_GCC_AR=${STATIC_GCC_AR:-ar} | ||
| 4 | STATIC_GCC_RANLIB=${STATIC_GCC_RANLIB:-ranlib} | ||
| 5 | STATIC_GCC_CC=${STATIC_GCC_CC:-gcc} | ||
| 6 | STATIC_GCC_LIBDIR=${STATIC_GCC_LIBDIR:-/usr/lib} | ||
| 7 | |||
| 3 | DIR="$( cd "$( dirname "$0" )" && pwd )" | 8 | DIR="$( cd "$( dirname "$0" )" && pwd )" |
| 4 | 9 | ||
| 5 | function log() { echo -- "$@" >> $DIR/log.txt; } | 10 | function log() { echo -- "$@" >> $DIR/log.txt; } |
| @@ -13,7 +18,7 @@ allargs=() | |||
| 13 | sources=() | 18 | sources=() |
| 14 | objects=() | 19 | objects=() |
| 15 | etc=() | 20 | etc=() |
| 16 | libdirs=("/usr/lib") | 21 | libdirs=("$STATIC_GCC_LIBDIR") |
| 17 | incdirs=() | 22 | incdirs=() |
| 18 | 23 | ||
| 19 | linking=0 | 24 | linking=0 |
| @@ -94,15 +99,22 @@ done | |||
| 94 | staticlibs=() | 99 | staticlibs=() |
| 95 | for lib in "${libs[@]}" | 100 | for lib in "${libs[@]}" |
| 96 | do | 101 | do |
| 102 | found=0 | ||
| 97 | for libdir in "${libdirs[@]}" | 103 | for libdir in "${libdirs[@]}" |
| 98 | do | 104 | do |
| 99 | staticlib="$libdir/lib$lib.a" | 105 | staticlib="$libdir/lib$lib.a" |
| 100 | if [ -e "$staticlib" ] | 106 | if [ -e "$staticlib" ] |
| 101 | then | 107 | then |
| 102 | staticlibs+=("$staticlib") | 108 | staticlibs+=("$staticlib") |
| 109 | found=1 | ||
| 103 | break | 110 | break |
| 104 | fi | 111 | fi |
| 105 | done | 112 | done |
| 113 | if [ "$found" = 0 ] | ||
| 114 | then | ||
| 115 | log "STATICLIB not found for $lib" | ||
| 116 | runlog exit 1 | ||
| 117 | fi | ||
| 106 | done | 118 | done |
| 107 | 119 | ||
| 108 | oflag=() | 120 | oflag=() |
| @@ -119,7 +131,7 @@ then | |||
| 119 | for source in "${sources[@]}" | 131 | for source in "${sources[@]}" |
| 120 | do | 132 | do |
| 121 | object="${source%.c}.o" | 133 | object="${source%.c}.o" |
| 122 | runlog gcc "${incdirs[@]}" "${etc[@]}" -c -o "$object" "$source" | 134 | runlog $STATIC_GCC_CC "${incdirs[@]}" "${etc[@]}" -c -o "$object" "$source" |
| 123 | [ "$?" = 0 ] || runlog exit $? | 135 | [ "$?" = 0 ] || runlog exit $? |
| 124 | objects+=("$object") | 136 | objects+=("$object") |
| 125 | done | 137 | done |
| @@ -137,22 +149,23 @@ then | |||
| 137 | done | 149 | done |
| 138 | echo "SAVE" >> ar.script | 150 | echo "SAVE" >> ar.script |
| 139 | echo "END" >> ar.script | 151 | echo "END" >> ar.script |
| 140 | cat ar.script | ar -M | 152 | cat ar.script >> "$DIR/log.txt" |
| 153 | cat ar.script | $STATIC_GCC_AR -M | ||
| 141 | [ "$?" = 0 ] || runlog exit $? | 154 | [ "$?" = 0 ] || runlog exit $? |
| 142 | 155 | ||
| 143 | [ -e "$output" ] || { | 156 | [ -e "$output" ] || { |
| 144 | exit 1 | 157 | exit 1 |
| 145 | } | 158 | } |
| 146 | 159 | ||
| 147 | runlog ranlib "$output" | 160 | runlog $STATIC_GCC_RANLIB "$output" |
| 148 | runlog exit $? | 161 | runlog exit $? |
| 149 | elif [ "$object" = 1 ] | 162 | elif [ "$object" = 1 ] |
| 150 | then | 163 | then |
| 151 | log OBJECT | 164 | log OBJECT |
| 152 | runlog gcc "${oflag[@]}" "${incdirs[@]}" "${etc[@]}" "${sources[@]}" | 165 | runlog $STATIC_GCC_CC "${oflag[@]}" "${incdirs[@]}" "${etc[@]}" "${sources[@]}" |
| 153 | runlog exit $? | 166 | runlog exit $? |
| 154 | else | 167 | else |
| 155 | log EXECUTABLE | 168 | log EXECUTABLE |
| 156 | runlog gcc "${allargs[@]}" | 169 | runlog $STATIC_GCC_CC "${allargs[@]}" |
| 157 | runlog exit $? | 170 | runlog exit $? |
| 158 | fi | 171 | fi |
