diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2015-06-24 17:03:10 +0200 |
---|---|---|
committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2015-06-24 17:03:10 +0200 |
commit | 8757d35dc25785d1d9bb6f66e8d8e9d596265ee2 (patch) | |
tree | 5a5a78fa63a27ec777e75539c3bdd145b4c9ccb1 | |
parent | a0315b7bc2432ea517bb90ce39df0cc8b1cd2f65 (diff) | |
download | luarocks-8757d35dc25785d1d9bb6f66e8d8e9d596265ee2.tar.gz luarocks-8757d35dc25785d1d9bb6f66e8d8e9d596265ee2.tar.bz2 luarocks-8757d35dc25785d1d9bb6f66e8d8e9d596265ee2.zip |
- site_config remains local, not exposed
- added field 'target_cpu' to `cfg` and config file environments
-rw-r--r-- | src/luarocks/cfg.lua | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 48623765..ab7bc4ed 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -32,8 +32,6 @@ if not ok then | |||
32 | site_config = {} | 32 | site_config = {} |
33 | end | 33 | end |
34 | 34 | ||
35 | cfg.site_config = site_config | ||
36 | |||
37 | cfg.program_version = "scm" | 35 | cfg.program_version = "scm" |
38 | cfg.program_series = "2.2" | 36 | cfg.program_series = "2.2" |
39 | cfg.major_version = (cfg.program_version:match("([^.]%.[^.])")) or cfg.program_series | 37 | cfg.major_version = (cfg.program_version:match("([^.]%.[^.])")) or cfg.program_series |
@@ -87,6 +85,7 @@ elseif proc:match("amd64") or proc:match("x86_64") then | |||
87 | elseif proc:match("Power Macintosh") then | 85 | elseif proc:match("Power Macintosh") then |
88 | proc = "powerpc" | 86 | proc = "powerpc" |
89 | end | 87 | end |
88 | cfg.target_cpu = proc | ||
90 | 89 | ||
91 | if system == "FreeBSD" then | 90 | if system == "FreeBSD" then |
92 | detected.unix = true | 91 | detected.unix = true |
@@ -151,7 +150,8 @@ env_for_config_file = { | |||
151 | home = cfg.home, | 150 | home = cfg.home, |
152 | lua_version = cfg.lua_version, | 151 | lua_version = cfg.lua_version, |
153 | platform = util.make_shallow_copy(detected), | 152 | platform = util.make_shallow_copy(detected), |
154 | processor = proc, | 153 | processor = cfg.target_cpu, -- remains for compat reasons |
154 | target_cpu = cfg.target_cpu, -- replaces `processor` | ||
155 | os_getenv = os.getenv, | 155 | os_getenv = os.getenv, |
156 | dump_env = function() | 156 | dump_env = function() |
157 | -- debug function, calling it from a config file will show all | 157 | -- debug function, calling it from a config file will show all |
@@ -323,7 +323,7 @@ if detected.windows then | |||
323 | 323 | ||
324 | home_config_file = home_config_file and home_config_file:gsub("\\","/") | 324 | home_config_file = home_config_file and home_config_file:gsub("\\","/") |
325 | defaults.fs_use_modules = false | 325 | defaults.fs_use_modules = false |
326 | defaults.arch = "win32-"..proc | 326 | defaults.arch = "win32-"..cfg.target_cpu |
327 | defaults.platforms = {"win32", "windows" } | 327 | defaults.platforms = {"win32", "windows" } |
328 | defaults.lib_extension = "dll" | 328 | defaults.lib_extension = "dll" |
329 | defaults.external_lib_extension = "dll" | 329 | defaults.external_lib_extension = "dll" |
@@ -441,7 +441,7 @@ end | |||
441 | 441 | ||
442 | if detected.cygwin then | 442 | if detected.cygwin then |
443 | defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds | 443 | defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds |
444 | defaults.arch = "cygwin-"..proc | 444 | defaults.arch = "cygwin-"..cfg.target_cpu |
445 | defaults.platforms = {"unix", "cygwin"} | 445 | defaults.platforms = {"unix", "cygwin"} |
446 | defaults.cmake_generator = "Unix Makefiles" | 446 | defaults.cmake_generator = "Unix Makefiles" |
447 | defaults.variables.CC = "echo -llua | xargs gcc" | 447 | defaults.variables.CC = "echo -llua | xargs gcc" |
@@ -457,7 +457,7 @@ end | |||
457 | if detected.macosx then | 457 | if detected.macosx then |
458 | defaults.variables.MAKE = "make" | 458 | defaults.variables.MAKE = "make" |
459 | defaults.external_lib_extension = "dylib" | 459 | defaults.external_lib_extension = "dylib" |
460 | defaults.arch = "macosx-"..proc | 460 | defaults.arch = "macosx-"..cfg.target_cpu |
461 | defaults.platforms = {"unix", "bsd", "macosx"} | 461 | defaults.platforms = {"unix", "bsd", "macosx"} |
462 | defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" | 462 | defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" |
463 | defaults.variables.STAT = "/usr/bin/stat" | 463 | defaults.variables.STAT = "/usr/bin/stat" |
@@ -477,12 +477,12 @@ if detected.macosx then | |||
477 | end | 477 | end |
478 | 478 | ||
479 | if detected.linux then | 479 | if detected.linux then |
480 | defaults.arch = "linux-"..proc | 480 | defaults.arch = "linux-"..cfg.target_cpu |
481 | defaults.platforms = {"unix", "linux"} | 481 | defaults.platforms = {"unix", "linux"} |
482 | end | 482 | end |
483 | 483 | ||
484 | if detected.freebsd then | 484 | if detected.freebsd then |
485 | defaults.arch = "freebsd-"..proc | 485 | defaults.arch = "freebsd-"..cfg.target_cpu |
486 | defaults.platforms = {"unix", "bsd", "freebsd"} | 486 | defaults.platforms = {"unix", "bsd", "freebsd"} |
487 | defaults.gcc_rpath = false | 487 | defaults.gcc_rpath = false |
488 | defaults.variables.CC = "cc" | 488 | defaults.variables.CC = "cc" |
@@ -490,17 +490,17 @@ if detected.freebsd then | |||
490 | end | 490 | end |
491 | 491 | ||
492 | if detected.openbsd then | 492 | if detected.openbsd then |
493 | defaults.arch = "openbsd-"..proc | 493 | defaults.arch = "openbsd-"..cfg.target_cpu |
494 | defaults.platforms = {"unix", "bsd", "openbsd"} | 494 | defaults.platforms = {"unix", "bsd", "openbsd"} |
495 | end | 495 | end |
496 | 496 | ||
497 | if detected.netbsd then | 497 | if detected.netbsd then |
498 | defaults.arch = "netbsd-"..proc | 498 | defaults.arch = "netbsd-"..cfg.target_cpu |
499 | defaults.platforms = {"unix", "bsd", "netbsd"} | 499 | defaults.platforms = {"unix", "bsd", "netbsd"} |
500 | end | 500 | end |
501 | 501 | ||
502 | if detected.solaris then | 502 | if detected.solaris then |
503 | defaults.arch = "solaris-"..proc | 503 | defaults.arch = "solaris-"..cfg.target_cpu |
504 | defaults.platforms = {"unix", "solaris"} | 504 | defaults.platforms = {"unix", "solaris"} |
505 | defaults.variables.MAKE = "gmake" | 505 | defaults.variables.MAKE = "gmake" |
506 | end | 506 | end |
@@ -630,4 +630,13 @@ function cfg.is_platform(query) | |||
630 | end | 630 | end |
631 | end | 631 | end |
632 | 632 | ||
633 | --[[ | ||
634 | function cfg.dump() | ||
635 | for k,v in pairs(defaults) do | ||
636 | if cfg[k] then end -- nothing todo, just touch it and the __index will make a local copy in `cfg` | ||
637 | end | ||
638 | print(util.show_table(cfg, "Dump of `cfg` table:")) | ||
639 | end | ||
640 | cfg.dump() --]] | ||
641 | |||
633 | return cfg | 642 | return cfg |