From acb4296d3cdd3b5017c3c39e04ecc12c55e49ed5 Mon Sep 17 00:00:00 2001 From: Fabio Mascarenhas Date: Fri, 22 Jan 2010 14:57:23 -0200 Subject: mingw as build system --- src/luarocks/build/builtin.lua | 9 ++++----- src/luarocks/cfg.lua | 14 +++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index dacaad0a..b6f42eab 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua @@ -86,10 +86,9 @@ function run(rockspec) compile_library = function(library, objects, libraries, libdirs, name) local extras = { unpack(objects) } add_flags(extras, "-L%s", libdirs) - add_flags(extras, "-l%s", libraries) - extras[#extras+1] = "-L" .. variables.LUA_LIBDIR - extras[#extras+1] = "-llua51" - extras[#extras+1] = "-lmsvcrt" + add_flags(extras, "%s.lib", libraries) + extras[#extras+1] = dir.path(variables.LUA_LIBDIR, "lua5.1.lib") + extras[#extras+1] = "-l" .. (variables.MSVCRT or "msvcr80") local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) return ok end @@ -103,7 +102,7 @@ function run(rockspec) local ok = execute(variables.RC, "-o", resname, rcname) if not ok then return ok end ok = execute(variables.LD, "-o", wrapname, resname, variables.WRAPPER, - "-L"..variables.LUA_LIBDIR, "-llua51", "-lmsvcrt", "-luser32") + dir.path(variables.LUA_LIBDIR, "lua5.1.lib"), "-l" .. (variables.MSVCRT or "msvcr80"), "-luser32") return ok, wrapname end elseif is_platform("win32") then diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 5ec87bf5..ae07f905 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -176,12 +176,12 @@ if detected.windows then defaults.variables.LIBFLAG = "/dll" defaults.external_deps_patterns = { bin = { "?.exe", "?.bat" }, - lib = { "?.lib", "?.dll" }, + lib = { "?.lib", "?.dll", "lib?.dll" }, include = { "?.h" } } defaults.runtime_external_deps_patterns = { bin = { "?.exe", "?.bat" }, - lib = { "?.dll" }, + lib = { "?.dll", "lib?.dll" }, include = { "?.h" } } defaults.local_cache = home.."/cache/luarocks" @@ -189,7 +189,7 @@ end if detected.mingw32 then home_config_file = home_config_file:gsub("\\","/") - defaults.arch = "mingw32-"..proc + defaults.arch = "win32-"..proc defaults.platforms = { "win32", "mingw32" } defaults.lib_extension = "dll" defaults.external_lib_extension = "dll" @@ -201,15 +201,15 @@ if detected.mingw32 then defaults.cmake_generator = "MinGW Makefiles" defaults.make = "mingw32-make" -- TODO: Split Windows flavors between mingw and msvc defaults.makefile = "Makefile.win" - defaults.variables.CC = "gcc" + defaults.variables.CC = "mingw32-gcc" defaults.variables.RC = "windres" defaults.variables.WRAPPER = config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.o" - defaults.variables.LD = "gcc" + defaults.variables.LD = "mingw32-gcc" defaults.variables.CFLAGS = "-O2" - defaults.variables.LIBFLAG = "-shared --dll --export-all-symbols" + defaults.variables.LIBFLAG = "-shared" defaults.external_deps_patterns = { bin = { "?.exe", "?.bat" }, - lib = { "lib?.a", "?.dll", "lib?.dll" }, + lib = { "?.lib", "?.dll", "lib?.dll" }, include = { "?.h" } } defaults.runtime_external_deps_patterns = { -- cgit v1.2.3-55-g6feb