aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/build/builtin.lua4
-rw-r--r--src/luarocks/cfg.lua12
2 files changed, 13 insertions, 3 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua
index fc4c2c04..485ff370 100644
--- a/src/luarocks/build/builtin.lua
+++ b/src/luarocks/build/builtin.lua
@@ -143,7 +143,9 @@ function run(rockspec)
143 compile_library = function (library, objects, libraries, libdirs) 143 compile_library = function (library, objects, libraries, libdirs)
144 local extras = { unpack(objects) } 144 local extras = { unpack(objects) }
145 add_flags(extras, "-L%s", libdirs) 145 add_flags(extras, "-L%s", libdirs)
146 add_flags(extras, "-Wl,-rpath,%s:", libdirs) 146 if cfg.gcc_rpath then
147 add_flags(extras, "-Wl,-rpath,%s:", libdirs)
148 end
147 add_flags(extras, "-l%s", libraries) 149 add_flags(extras, "-l%s", libraries)
148 if cfg.is_platform("cygwin") then 150 if cfg.is_platform("cygwin") then
149 add_flags(extras, "-l%s", {"lua"}) 151 add_flags(extras, "-l%s", {"lua"})
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 263af063..e0b4060a 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -324,6 +324,7 @@ if detected.unix then
324 defaults.platforms = { "unix" } 324 defaults.platforms = { "unix" }
325 defaults.variables.CC = "gcc" 325 defaults.variables.CC = "gcc"
326 defaults.variables.LD = "gcc" 326 defaults.variables.LD = "gcc"
327 defaults.gcc_rpath = true
327 defaults.variables.LIBFLAG = "-shared" 328 defaults.variables.LIBFLAG = "-shared"
328 defaults.external_deps_patterns = { 329 defaults.external_deps_patterns = {
329 bin = { "?" }, 330 bin = { "?" },
@@ -362,10 +363,17 @@ if detected.macosx then
362 defaults.external_lib_extension = "dylib" 363 defaults.external_lib_extension = "dylib"
363 defaults.arch = "macosx-"..proc 364 defaults.arch = "macosx-"..proc
364 defaults.platforms = {"unix", "bsd", "macosx"} 365 defaults.platforms = {"unix", "bsd", "macosx"}
365 defaults.variables.CC = "export MACOSX_DEPLOYMENT_TARGET=10.3; gcc"
366 defaults.variables.LD = "export MACOSX_DEPLOYMENT_TARGET=10.3; gcc"
367 defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" 366 defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load"
368 defaults.variables.STATFLAG = "-f '%A'" 367 defaults.variables.STATFLAG = "-f '%A'"
368 local version = io.popen("sw_vers -productVersion"):read("*l")
369 version = tonumber(version and version:match("^[^.]+%.([^.]+)")) or 3
370 if version >= 5 then
371 version = 5
372 else
373 defaults.gcc_rpath = false
374 end
375 defaults.variables.CC = "export MACOSX_DEPLOYMENT_TARGET=10."..version.."; gcc"
376 defaults.variables.LD = "export MACOSX_DEPLOYMENT_TARGET=10."..version.."; gcc"
369end 377end
370 378
371if detected.linux then 379if detected.linux then