diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build/builtin.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/core/cfg.lua | 28 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 0e8c3151..e7c0ae38 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -158,7 +158,7 @@ function builtin.run(rockspec, no_install) | |||
| 158 | local checked_lua_h = false | 158 | local checked_lua_h = false |
| 159 | 159 | ||
| 160 | for _, var in ipairs{ "CC", "CFLAGS", "LDFLAGS" } do | 160 | for _, var in ipairs{ "CC", "CFLAGS", "LDFLAGS" } do |
| 161 | variables[var] = os.getenv(var) or variables[var] or "" | 161 | variables[var] = variables[var] or os.getenv(var) or "" |
| 162 | end | 162 | end |
| 163 | 163 | ||
| 164 | local function add_flags(extras, flag, flags) | 164 | local function add_flags(extras, flag, flags) |
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index 1f055b41..6a2518c0 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
| @@ -45,6 +45,7 @@ local platform_order = { | |||
| 45 | -- Windows | 45 | -- Windows |
| 46 | "windows", | 46 | "windows", |
| 47 | "win32", | 47 | "win32", |
| 48 | "mingw", | ||
| 48 | "mingw32", | 49 | "mingw32", |
| 49 | "msys2_mingw_w64", | 50 | "msys2_mingw_w64", |
| 50 | } | 51 | } |
| @@ -293,7 +294,8 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
| 293 | defaults.variables.MT = "mt" | 294 | defaults.variables.MT = "mt" |
| 294 | defaults.variables.AR = "lib" | 295 | defaults.variables.AR = "lib" |
| 295 | defaults.variables.LUALIB = "lua"..lua_version..".lib" | 296 | defaults.variables.LUALIB = "lua"..lua_version..".lib" |
| 296 | defaults.variables.CFLAGS = "/nologo /MD /O2" | 297 | defaults.variables.CFLAGS = os.getenv("CFLAGS") or "/nologo /MD /O2" |
| 298 | defaults.variables.LDFLAGS = os.getenv("LDFLAGS") | ||
| 297 | defaults.variables.LIBFLAG = "/nologo /dll" | 299 | defaults.variables.LIBFLAG = "/nologo /dll" |
| 298 | 300 | ||
| 299 | defaults.external_deps_patterns = { | 301 | defaults.external_deps_patterns = { |
| @@ -334,7 +336,8 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
| 334 | defaults.variables.LD = "mingw32-gcc" | 336 | defaults.variables.LD = "mingw32-gcc" |
| 335 | defaults.variables.AR = "ar" | 337 | defaults.variables.AR = "ar" |
| 336 | defaults.variables.RANLIB = "ranlib" | 338 | defaults.variables.RANLIB = "ranlib" |
| 337 | defaults.variables.CFLAGS = "-O2" | 339 | defaults.variables.CFLAGS = os.getenv("CFLAGS") or "-O2" |
| 340 | defaults.variables.LDFLAGS = os.getenv("LDFLAGS") | ||
| 338 | defaults.variables.LIBFLAG = "-shared" | 341 | defaults.variables.LIBFLAG = "-shared" |
| 339 | defaults.makefile = "Makefile" | 342 | defaults.makefile = "Makefile" |
| 340 | defaults.external_deps_patterns = { | 343 | defaults.external_deps_patterns = { |
| @@ -358,7 +361,16 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
| 358 | defaults.external_lib_extension = "so" | 361 | defaults.external_lib_extension = "so" |
| 359 | defaults.obj_extension = "o" | 362 | defaults.obj_extension = "o" |
| 360 | defaults.external_deps_dirs = { "/usr/local", "/usr", "/" } | 363 | defaults.external_deps_dirs = { "/usr/local", "/usr", "/" } |
| 361 | defaults.variables.CFLAGS = "-O2" | 364 | |
| 365 | defaults.variables.CFLAGS = os.getenv("CFLAGS") or "-O2" | ||
| 366 | -- we pass -fPIC via CFLAGS because of old Makefile-based Lua projects | ||
| 367 | -- which didn't have -fPIC in their Makefiles but which honor CFLAGS | ||
| 368 | if not defaults.variables.CFLAGS:match("-fPIC") then | ||
| 369 | defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC" | ||
| 370 | end | ||
| 371 | |||
| 372 | defaults.variables.LDFLAGS = os.getenv("LDFLAGS") | ||
| 373 | |||
| 362 | defaults.cmake_generator = "Unix Makefiles" | 374 | defaults.cmake_generator = "Unix Makefiles" |
| 363 | defaults.variables.CC = "gcc" | 375 | defaults.variables.CC = "gcc" |
| 364 | defaults.variables.LD = "gcc" | 376 | defaults.variables.LD = "gcc" |
| @@ -380,9 +392,6 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
| 380 | defaults.wrapper_suffix = "" | 392 | defaults.wrapper_suffix = "" |
| 381 | local xdg_cache_home = os.getenv("XDG_CACHE_HOME") or home.."/.cache" | 393 | local xdg_cache_home = os.getenv("XDG_CACHE_HOME") or home.."/.cache" |
| 382 | defaults.local_cache = xdg_cache_home.."/luarocks" | 394 | defaults.local_cache = xdg_cache_home.."/luarocks" |
| 383 | if not defaults.variables.CFLAGS:match("-fPIC") then | ||
| 384 | defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC" | ||
| 385 | end | ||
| 386 | defaults.web_browser = "xdg-open" | 395 | defaults.web_browser = "xdg-open" |
| 387 | end | 396 | end |
| 388 | 397 | ||
| @@ -430,7 +439,12 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
| 430 | defaults.variables.AR = "ar" | 439 | defaults.variables.AR = "ar" |
| 431 | defaults.variables.RANLIB = "ranlib" | 440 | defaults.variables.RANLIB = "ranlib" |
| 432 | defaults.variables.LUALIB = "liblua"..lua_version..".dll.a" | 441 | defaults.variables.LUALIB = "liblua"..lua_version..".dll.a" |
| 433 | defaults.variables.CFLAGS = "-O2 -fPIC" | 442 | |
| 443 | defaults.variables.CFLAGS = os.getenv("CFLAGS") or "-O2 -fPIC" | ||
| 444 | if not defaults.variables.CFLAGS:match("-fPIC") then | ||
| 445 | defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC" | ||
| 446 | end | ||
| 447 | |||
| 434 | defaults.variables.LIBFLAG = "-shared" | 448 | defaults.variables.LIBFLAG = "-shared" |
| 435 | end | 449 | end |
| 436 | end | 450 | end |
