From 8757d35dc25785d1d9bb6f66e8d8e9d596265ee2 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 24 Jun 2015 17:03:10 +0200 Subject: - site_config remains local, not exposed - added field 'target_cpu' to `cfg` and config file environments --- src/luarocks/cfg.lua | 31 ++++++++++++++++++++----------- 1 file 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 site_config = {} end -cfg.site_config = site_config - cfg.program_version = "scm" cfg.program_series = "2.2" 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 elseif proc:match("Power Macintosh") then proc = "powerpc" end +cfg.target_cpu = proc if system == "FreeBSD" then detected.unix = true @@ -151,7 +150,8 @@ env_for_config_file = { home = cfg.home, lua_version = cfg.lua_version, platform = util.make_shallow_copy(detected), - processor = proc, + processor = cfg.target_cpu, -- remains for compat reasons + target_cpu = cfg.target_cpu, -- replaces `processor` os_getenv = os.getenv, dump_env = function() -- debug function, calling it from a config file will show all @@ -323,7 +323,7 @@ if detected.windows then home_config_file = home_config_file and home_config_file:gsub("\\","/") defaults.fs_use_modules = false - defaults.arch = "win32-"..proc + defaults.arch = "win32-"..cfg.target_cpu defaults.platforms = {"win32", "windows" } defaults.lib_extension = "dll" defaults.external_lib_extension = "dll" @@ -441,7 +441,7 @@ end if detected.cygwin then defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds - defaults.arch = "cygwin-"..proc + defaults.arch = "cygwin-"..cfg.target_cpu defaults.platforms = {"unix", "cygwin"} defaults.cmake_generator = "Unix Makefiles" defaults.variables.CC = "echo -llua | xargs gcc" @@ -457,7 +457,7 @@ end if detected.macosx then defaults.variables.MAKE = "make" defaults.external_lib_extension = "dylib" - defaults.arch = "macosx-"..proc + defaults.arch = "macosx-"..cfg.target_cpu defaults.platforms = {"unix", "bsd", "macosx"} defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" defaults.variables.STAT = "/usr/bin/stat" @@ -477,12 +477,12 @@ if detected.macosx then end if detected.linux then - defaults.arch = "linux-"..proc + defaults.arch = "linux-"..cfg.target_cpu defaults.platforms = {"unix", "linux"} end if detected.freebsd then - defaults.arch = "freebsd-"..proc + defaults.arch = "freebsd-"..cfg.target_cpu defaults.platforms = {"unix", "bsd", "freebsd"} defaults.gcc_rpath = false defaults.variables.CC = "cc" @@ -490,17 +490,17 @@ if detected.freebsd then end if detected.openbsd then - defaults.arch = "openbsd-"..proc + defaults.arch = "openbsd-"..cfg.target_cpu defaults.platforms = {"unix", "bsd", "openbsd"} end if detected.netbsd then - defaults.arch = "netbsd-"..proc + defaults.arch = "netbsd-"..cfg.target_cpu defaults.platforms = {"unix", "bsd", "netbsd"} end if detected.solaris then - defaults.arch = "solaris-"..proc + defaults.arch = "solaris-"..cfg.target_cpu defaults.platforms = {"unix", "solaris"} defaults.variables.MAKE = "gmake" end @@ -630,4 +630,13 @@ function cfg.is_platform(query) end end +--[[ +function cfg.dump() + for k,v in pairs(defaults) do + if cfg[k] then end -- nothing todo, just touch it and the __index will make a local copy in `cfg` + end + print(util.show_table(cfg, "Dump of `cfg` table:")) +end +cfg.dump() --]] + return cfg -- cgit v1.2.3-55-g6feb From 26167e826f7be938e9ac5186e54b0cd8b8115427 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 24 Jun 2015 19:11:54 +0200 Subject: oops... remove debug stuff --- src/luarocks/cfg.lua | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index ab7bc4ed..b9a7b31a 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -630,13 +630,4 @@ function cfg.is_platform(query) end end ---[[ -function cfg.dump() - for k,v in pairs(defaults) do - if cfg[k] then end -- nothing todo, just touch it and the __index will make a local copy in `cfg` - end - print(util.show_table(cfg, "Dump of `cfg` table:")) -end -cfg.dump() --]] - return cfg -- cgit v1.2.3-55-g6feb