diff options
| author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2015-06-30 12:44:41 +0200 |
|---|---|---|
| committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2015-06-30 12:44:41 +0200 |
| commit | 02eff158f095ed95cf3c889fb0e9c2efd06beeb9 (patch) | |
| tree | b8fba416c00288556f82d22996b4e19c12934a03 /src | |
| parent | 066e1c6bd90d2e0e4fcdbc116bd857c62779b4cd (diff) | |
| download | luarocks-02eff158f095ed95cf3c889fb0e9c2efd06beeb9.tar.gz luarocks-02eff158f095ed95cf3c889fb0e9c2efd06beeb9.tar.bz2 luarocks-02eff158f095ed95cf3c889fb0e9c2efd06beeb9.zip | |
prefer versioned config files and directories over non-versioned ones
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cfg.lua | 230 |
1 files changed, 133 insertions, 97 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 8321e9b9..31b3211a 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
| @@ -35,6 +35,9 @@ end | |||
| 35 | cfg.program_version = "scm" | 35 | cfg.program_version = "scm" |
| 36 | cfg.program_series = "2.2" | 36 | cfg.program_series = "2.2" |
| 37 | cfg.major_version = (cfg.program_version:match("([^.]%.[^.])")) or cfg.program_series | 37 | cfg.major_version = (cfg.program_version:match("([^.]%.[^.])")) or cfg.program_series |
| 38 | cfg.variables = {} | ||
| 39 | cfg.rocks_trees = {} | ||
| 40 | cfg.platforms = {} | ||
| 38 | 41 | ||
| 39 | local persist = require("luarocks.persist") | 42 | local persist = require("luarocks.persist") |
| 40 | 43 | ||
| @@ -68,68 +71,86 @@ end | |||
| 68 | 71 | ||
| 69 | -- System detection: | 72 | -- System detection: |
| 70 | 73 | ||
| 71 | local detected = {} | ||
| 72 | local system,proc | ||
| 73 | |||
| 74 | -- A proper installation of LuaRocks will hardcode the system | 74 | -- A proper installation of LuaRocks will hardcode the system |
| 75 | -- and proc values with site_config.LUAROCKS_UNAME_S and site_config.LUAROCKS_UNAME_M, | 75 | -- and proc values with site_config.LUAROCKS_UNAME_S and site_config.LUAROCKS_UNAME_M, |
| 76 | -- so that this detection does not run every time. When it is | 76 | -- so that this detection does not run every time. When it is |
| 77 | -- performed, we use the Unix way to identify the system, | 77 | -- performed, we use the Unix way to identify the system, |
| 78 | -- even on Windows (assuming UnxUtils or Cygwin). | 78 | -- even on Windows (assuming UnxUtils or Cygwin). |
| 79 | system = site_config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l") | 79 | local system = site_config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l") |
| 80 | proc = site_config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l") | 80 | local proc = site_config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l") |
| 81 | if proc:match("i[%d]86") then | 81 | if proc:match("i[%d]86") then |
| 82 | proc = "x86" | 82 | cfg.target_cpu = "x86" |
| 83 | elseif proc:match("amd64") or proc:match("x86_64") then | 83 | elseif proc:match("amd64") or proc:match("x86_64") then |
| 84 | proc = "x86_64" | 84 | cfg.target_cpu = "x86_64" |
| 85 | elseif proc:match("Power Macintosh") then | 85 | elseif proc:match("Power Macintosh") then |
| 86 | proc = "powerpc" | 86 | cfg.target_cpu = "powerpc" |
| 87 | else | ||
| 88 | cfg.target_cpu = proc | ||
| 87 | end | 89 | end |
| 88 | cfg.target_cpu = proc | ||
| 89 | 90 | ||
| 90 | if system == "FreeBSD" then | 91 | if system == "FreeBSD" then |
| 91 | detected.unix = true | 92 | cfg.platforms.unix = true |
| 92 | detected.freebsd = true | 93 | cfg.platforms.freebsd = true |
| 93 | detected.bsd = true | 94 | cfg.platforms.bsd = true |
| 94 | elseif system == "OpenBSD" then | 95 | elseif system == "OpenBSD" then |
| 95 | detected.unix = true | 96 | cfg.platforms.unix = true |
| 96 | detected.openbsd = true | 97 | cfg.platforms.openbsd = true |
| 97 | detected.bsd = true | 98 | cfg.platforms.bsd = true |
| 98 | elseif system == "NetBSD" then | 99 | elseif system == "NetBSD" then |
| 99 | detected.unix = true | 100 | cfg.platforms.unix = true |
| 100 | detected.netbsd = true | 101 | cfg.platforms.netbsd = true |
| 101 | detected.bsd = true | 102 | cfg.platforms.bsd = true |
| 102 | elseif system == "Darwin" then | 103 | elseif system == "Darwin" then |
| 103 | detected.unix = true | 104 | cfg.platforms.unix = true |
| 104 | detected.macosx = true | 105 | cfg.platforms.macosx = true |
| 105 | detected.bsd = true | 106 | cfg.platforms.bsd = true |
| 106 | elseif system == "Linux" then | 107 | elseif system == "Linux" then |
| 107 | detected.unix = true | 108 | cfg.platforms.unix = true |
| 108 | detected.linux = true | 109 | cfg.platforms.linux = true |
| 109 | elseif system == "SunOS" then | 110 | elseif system == "SunOS" then |
| 110 | detected.unix = true | 111 | cfg.platforms.unix = true |
| 111 | detected.solaris = true | 112 | cfg.platforms.solaris = true |
| 112 | elseif system and system:match("^CYGWIN") then | 113 | elseif system and system:match("^CYGWIN") then |
| 113 | detected.unix = true | 114 | cfg.platforms.unix = true |
| 114 | detected.cygwin = true | 115 | cfg.platforms.cygwin = true |
| 115 | elseif system and system:match("^Windows") then | 116 | elseif system and system:match("^Windows") then |
| 116 | detected.windows = true | 117 | cfg.platforms.windows = true |
| 118 | cfg.platforms.win32 = true | ||
| 117 | elseif system and system:match("^MINGW") then | 119 | elseif system and system:match("^MINGW") then |
| 118 | detected.windows = true | 120 | cfg.platforms.windows = true |
| 119 | detected.mingw32 = true | 121 | cfg.platforms.mingw32 = true |
| 122 | cfg.platforms.win32 = true | ||
| 120 | else | 123 | else |
| 121 | detected.unix = true | 124 | cfg.platforms.unix = true |
| 122 | -- Fall back to Unix in unknown systems. | 125 | -- Fall back to Unix in unknown systems. |
| 123 | end | 126 | end |
| 124 | 127 | ||
| 125 | -- Path configuration: | 128 | -- Set order for platform overrides |
| 129 | local platform_order = { | ||
| 130 | -- Unixes | ||
| 131 | unix = 1, | ||
| 132 | bsd = 2, | ||
| 133 | solaris = 3, | ||
| 134 | netbsd = 4, | ||
| 135 | openbsd = 5, | ||
| 136 | freebsd = 6, | ||
| 137 | linux = 7, | ||
| 138 | macosx = 8, | ||
| 139 | cygwin = 9, | ||
| 140 | -- Windows | ||
| 141 | win32 = 10, | ||
| 142 | mingw32 = 11, | ||
| 143 | windows = 12 } | ||
| 144 | |||
| 126 | 145 | ||
| 146 | -- Path configuration: | ||
| 127 | local sys_config_file, home_config_file | 147 | local sys_config_file, home_config_file |
| 148 | local sys_config_file_default, home_config_file_default | ||
| 128 | local sys_config_dir, home_config_dir | 149 | local sys_config_dir, home_config_dir |
| 129 | local sys_config_ok, home_config_ok = false, false | 150 | local sys_config_ok, home_config_ok = false, false |
| 130 | local extra_luarocks_module_dir | 151 | local extra_luarocks_module_dir |
| 131 | sys_config_dir = site_config.LUAROCKS_SYSCONFDIR | 152 | sys_config_dir = site_config.LUAROCKS_SYSCONFDIR |
| 132 | if detected.windows then | 153 | if cfg.platforms.windows then |
| 133 | cfg.home = os.getenv("APPDATA") or "c:" | 154 | cfg.home = os.getenv("APPDATA") or "c:" |
| 134 | sys_config_dir = sys_config_dir or "c:/luarocks" | 155 | sys_config_dir = sys_config_dir or "c:/luarocks" |
| 135 | home_config_dir = cfg.home.."/luarocks" | 156 | home_config_dir = cfg.home.."/luarocks" |
| @@ -141,16 +162,13 @@ else | |||
| 141 | cfg.home_tree = (os.getenv("USER") ~= "root") and cfg.home.."/.luarocks/" | 162 | cfg.home_tree = (os.getenv("USER") ~= "root") and cfg.home.."/.luarocks/" |
| 142 | end | 163 | end |
| 143 | 164 | ||
| 144 | cfg.variables = {} | ||
| 145 | cfg.rocks_trees = {} | ||
| 146 | |||
| 147 | -- Create global environment for the config files; | 165 | -- Create global environment for the config files; |
| 148 | local env_for_config_file = function() | 166 | local env_for_config_file = function() |
| 149 | local e | 167 | local e |
| 150 | e = { | 168 | e = { |
| 151 | home = cfg.home, | 169 | home = cfg.home, |
| 152 | lua_version = cfg.lua_version, | 170 | lua_version = cfg.lua_version, |
| 153 | platform = util.make_shallow_copy(detected), | 171 | platforms = util.make_shallow_copy(cfg.platforms), |
| 154 | processor = cfg.target_cpu, -- remains for compat reasons | 172 | processor = cfg.target_cpu, -- remains for compat reasons |
| 155 | target_cpu = cfg.target_cpu, -- replaces `processor` | 173 | target_cpu = cfg.target_cpu, -- replaces `processor` |
| 156 | os_getenv = os.getenv, | 174 | os_getenv = os.getenv, |
| @@ -175,49 +193,55 @@ local merge_overrides = function(overrides) | |||
| 175 | util.deep_merge(cfg, overrides) | 193 | util.deep_merge(cfg, overrides) |
| 176 | end | 194 | end |
| 177 | 195 | ||
| 178 | sys_config_file = site_config.LUAROCKS_SYSCONFIG or sys_config_dir.."/config-"..cfg.lua_version..".lua" | 196 | -- load config file from a list until first succesful one. Info is |
| 179 | do | 197 | -- added to `cfg` module table, returns filepath of succesfully loaded |
| 180 | local err, errcode | 198 | -- file or nil if it failed |
| 181 | sys_config_ok, err, errcode = persist.load_into_table(sys_config_file, env_for_config_file()) | 199 | local load_config_file = function(list) |
| 182 | if (not sys_config_ok) and errcode == "open" then -- file not found, so try alternate file | 200 | for _, filepath in ipairs(list) do |
| 183 | sys_config_file = sys_config_dir.."/config.lua" | 201 | local result, err, errcode = persist.load_into_table(filepath, env_for_config_file()) |
| 184 | sys_config_ok, err, errcode = persist.load_into_table(sys_config_file, env_for_config_file()) | 202 | if (not result) and errcode ~= "open" then |
| 185 | end | 203 | -- errcode is either "load" or "run"; bad config file, so error out |
| 186 | if (not sys_config_ok) and errcode ~= "open" then -- either "load" or "run"; bad config file, bail out with error | 204 | io.stderr:write(err.."\n") |
| 187 | io.stderr:write(err.."\n") | 205 | os.exit(cfg.errorcodes.CONFIGFILE) |
| 188 | os.exit(cfg.errorcodes.CONFIGFILE) | 206 | end |
| 189 | end | 207 | if result then |
| 190 | if sys_config_ok then | 208 | -- succes in loading and running, merge contents and exit |
| 191 | merge_overrides(sys_config_ok) | 209 | merge_overrides(result) |
| 210 | return filepath | ||
| 211 | end | ||
| 192 | end | 212 | end |
| 213 | return nil -- nothing was loaded | ||
| 214 | end | ||
| 215 | |||
| 216 | |||
| 217 | -- Load system configuration file | ||
| 218 | do | ||
| 219 | sys_config_file_default = sys_config_dir.."/config-"..cfg.lua_version..".lua" | ||
| 220 | sys_config_file = load_config_file({ | ||
| 221 | site_config.LUAROCKS_SYSCONFIG or sys_config_file_default, | ||
| 222 | sys_config_dir.."/config.lua", | ||
| 223 | }) | ||
| 224 | sys_config_ok = (sys_config_file ~= nil) | ||
| 193 | end | 225 | end |
| 194 | 226 | ||
| 227 | -- Load user configuration file (if allowed) | ||
| 195 | if not site_config.LUAROCKS_FORCE_CONFIG then | 228 | if not site_config.LUAROCKS_FORCE_CONFIG then |
| 229 | |||
| 230 | home_config_file_default = home_config_dir.."/config-"..cfg.lua_version..".lua" | ||
| 231 | local list = { | ||
| 232 | os.getenv("LUAROCKS_CONFIG_" .. version_suffix) or os.getenv("LUAROCKS_CONFIG"), | ||
| 233 | home_config_file_default, | ||
| 234 | home_config_dir.."/config.lua", | ||
| 235 | } | ||
| 236 | -- first entry might be a silent nil, check and remove if so | ||
| 237 | if not list[1] then table.remove(list, 1) end | ||
| 238 | |||
| 239 | home_config_file = load_config_file(list) | ||
| 240 | home_config_ok = (home_config_file ~= nil) | ||
| 196 | 241 | ||
| 197 | local home_overrides, err, errcode | ||
| 198 | home_config_file = os.getenv("LUAROCKS_CONFIG_" .. version_suffix) or os.getenv("LUAROCKS_CONFIG") | ||
| 199 | if home_config_file then | ||
| 200 | home_overrides, err, errcode = persist.load_into_table(home_config_file, env_for_config_file()) | ||
| 201 | else | ||
| 202 | home_config_file = home_config_dir.."/config-"..cfg.lua_version..".lua" | ||
| 203 | home_overrides, err, errcode = persist.load_into_table(home_config_file, env_for_config_file()) | ||
| 204 | if (not home_overrides) and (not errcode == "run") then | ||
| 205 | home_config_file = home_config_dir.."/config.lua" | ||
| 206 | home_overrides, err, errcode = persist.load_into_table(home_config_file, env_for_config_file()) | ||
| 207 | end | ||
| 208 | end | ||
| 209 | if home_overrides then | ||
| 210 | home_config_ok = true | ||
| 211 | merge_overrides(home_overrides) | ||
| 212 | else | ||
| 213 | home_config_ok = home_overrides | ||
| 214 | if errcode ~= "open" then | ||
| 215 | io.stderr:write(err.."\n") | ||
| 216 | os.exit(cfg.errorcodes.CONFIGFILE) | ||
| 217 | end | ||
| 218 | end | ||
| 219 | end | 242 | end |
| 220 | 243 | ||
| 244 | |||
| 221 | if not next(cfg.rocks_trees) then | 245 | if not next(cfg.rocks_trees) then |
| 222 | if cfg.home_tree then | 246 | if cfg.home_tree then |
| 223 | table.insert(cfg.rocks_trees, { name = "user", root = cfg.home_tree } ) | 247 | table.insert(cfg.rocks_trees, { name = "user", root = cfg.home_tree } ) |
| @@ -227,8 +251,29 @@ if not next(cfg.rocks_trees) then | |||
| 227 | end | 251 | end |
| 228 | end | 252 | end |
| 229 | 253 | ||
| 230 | -- Configure defaults: | ||
| 231 | 254 | ||
| 255 | -- update platforms list; keyed -> array | ||
| 256 | do | ||
| 257 | local lst = {} -- use temp array to not confuse `pairs` in loop | ||
| 258 | for plat in pairs(cfg.platforms) do | ||
| 259 | if cfg.platforms[plat] then -- entries set to 'false' skipped | ||
| 260 | if not platform_order[plat] then | ||
| 261 | local pl = "" | ||
| 262 | for k,_ in pairs(platform_order) do pl = pl .. ", " .. k end | ||
| 263 | io.stderr:write("Bad platform given; "..tostring(plat)..". Valid entries are: "..pl:sub(3,-1) ..".\n") | ||
| 264 | os.exit(cfg.errorcodes.CONFIGFILE) | ||
| 265 | end | ||
| 266 | table.insert(lst, plat) | ||
| 267 | else | ||
| 268 | cfg.platforms[plat] = nil | ||
| 269 | end | ||
| 270 | end | ||
| 271 | -- platform overrides depent on the order, so set priorities | ||
| 272 | table.sort(lst, function(key1, key2) return platform_order[key1] < platform_order[key2] end) | ||
| 273 | util.deep_merge(cfg.platforms, lst) | ||
| 274 | end | ||
| 275 | |||
| 276 | -- Configure defaults: | ||
| 232 | local defaults = { | 277 | local defaults = { |
| 233 | 278 | ||
| 234 | local_by_default = false, | 279 | local_by_default = false, |
| @@ -328,14 +373,13 @@ local defaults = { | |||
| 328 | rocks_provided = {} | 373 | rocks_provided = {} |
| 329 | } | 374 | } |
| 330 | 375 | ||
| 331 | if detected.windows then | 376 | if cfg.platforms.windows then |
| 332 | local full_prefix = (site_config.LUAROCKS_PREFIX or (os.getenv("PROGRAMFILES")..[[\LuaRocks]])).."\\"..cfg.major_version | 377 | local full_prefix = (site_config.LUAROCKS_PREFIX or (os.getenv("PROGRAMFILES")..[[\LuaRocks]])).."\\"..cfg.major_version |
| 333 | extra_luarocks_module_dir = full_prefix.."\\lua\\?.lua" | 378 | extra_luarocks_module_dir = full_prefix.."\\lua\\?.lua" |
| 334 | 379 | ||
| 335 | home_config_file = home_config_file and home_config_file:gsub("\\","/") | 380 | home_config_file = home_config_file and home_config_file:gsub("\\","/") |
| 336 | defaults.fs_use_modules = false | 381 | defaults.fs_use_modules = false |
| 337 | defaults.arch = "win32-"..cfg.target_cpu | 382 | defaults.arch = "win32-"..cfg.target_cpu |
| 338 | defaults.platforms = {"win32", "windows" } | ||
| 339 | defaults.lib_extension = "dll" | 383 | defaults.lib_extension = "dll" |
| 340 | defaults.external_lib_extension = "dll" | 384 | defaults.external_lib_extension = "dll" |
| 341 | defaults.obj_extension = "obj" | 385 | defaults.obj_extension = "obj" |
| @@ -388,8 +432,7 @@ if detected.windows then | |||
| 388 | defaults.web_browser = "start" | 432 | defaults.web_browser = "start" |
| 389 | end | 433 | end |
| 390 | 434 | ||
| 391 | if detected.mingw32 then | 435 | if cfg.platforms.mingw32 then |
| 392 | defaults.platforms = { "win32", "mingw32", "windows" } | ||
| 393 | defaults.obj_extension = "o" | 436 | defaults.obj_extension = "o" |
| 394 | defaults.cmake_generator = "MinGW Makefiles" | 437 | defaults.cmake_generator = "MinGW Makefiles" |
| 395 | defaults.variables.MAKE = "mingw32-make" | 438 | defaults.variables.MAKE = "mingw32-make" |
| @@ -413,7 +456,7 @@ if detected.mingw32 then | |||
| 413 | 456 | ||
| 414 | end | 457 | end |
| 415 | 458 | ||
| 416 | if detected.unix then | 459 | if cfg.platforms.unix then |
| 417 | defaults.lib_extension = "so" | 460 | defaults.lib_extension = "so" |
| 418 | defaults.external_lib_extension = "so" | 461 | defaults.external_lib_extension = "so" |
| 419 | defaults.obj_extension = "o" | 462 | defaults.obj_extension = "o" |
| @@ -423,7 +466,6 @@ if detected.unix then | |||
| 423 | defaults.variables.LUA_LIBDIR = site_config.LUA_LIBDIR or "/usr/local/lib" | 466 | defaults.variables.LUA_LIBDIR = site_config.LUA_LIBDIR or "/usr/local/lib" |
| 424 | defaults.variables.CFLAGS = "-O2" | 467 | defaults.variables.CFLAGS = "-O2" |
| 425 | defaults.cmake_generator = "Unix Makefiles" | 468 | defaults.cmake_generator = "Unix Makefiles" |
| 426 | defaults.platforms = { "unix" } | ||
| 427 | defaults.variables.CC = "gcc" | 469 | defaults.variables.CC = "gcc" |
| 428 | defaults.variables.LD = "gcc" | 470 | defaults.variables.LD = "gcc" |
| 429 | defaults.gcc_rpath = true | 471 | defaults.gcc_rpath = true |
| @@ -450,26 +492,24 @@ if detected.unix then | |||
| 450 | defaults.web_browser = "xdg-open" | 492 | defaults.web_browser = "xdg-open" |
| 451 | end | 493 | end |
| 452 | 494 | ||
| 453 | if detected.cygwin then | 495 | if cfg.platforms.cygwin then |
| 454 | defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds | 496 | defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds |
| 455 | defaults.arch = "cygwin-"..cfg.target_cpu | 497 | defaults.arch = "cygwin-"..cfg.target_cpu |
| 456 | defaults.platforms = {"unix", "cygwin"} | ||
| 457 | defaults.cmake_generator = "Unix Makefiles" | 498 | defaults.cmake_generator = "Unix Makefiles" |
| 458 | defaults.variables.CC = "echo -llua | xargs gcc" | 499 | defaults.variables.CC = "echo -llua | xargs gcc" |
| 459 | defaults.variables.LD = "echo -llua | xargs gcc" | 500 | defaults.variables.LD = "echo -llua | xargs gcc" |
| 460 | defaults.variables.LIBFLAG = "-shared" | 501 | defaults.variables.LIBFLAG = "-shared" |
| 461 | end | 502 | end |
| 462 | 503 | ||
| 463 | if detected.bsd then | 504 | if cfg.platforms.bsd then |
| 464 | defaults.variables.MAKE = "gmake" | 505 | defaults.variables.MAKE = "gmake" |
| 465 | defaults.variables.STATFLAG = "-f '%OLp'" | 506 | defaults.variables.STATFLAG = "-f '%OLp'" |
| 466 | end | 507 | end |
| 467 | 508 | ||
| 468 | if detected.macosx then | 509 | if cfg.platforms.macosx then |
| 469 | defaults.variables.MAKE = "make" | 510 | defaults.variables.MAKE = "make" |
| 470 | defaults.external_lib_extension = "dylib" | 511 | defaults.external_lib_extension = "dylib" |
| 471 | defaults.arch = "macosx-"..cfg.target_cpu | 512 | defaults.arch = "macosx-"..cfg.target_cpu |
| 472 | defaults.platforms = {"unix", "bsd", "macosx"} | ||
| 473 | defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" | 513 | defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" |
| 474 | defaults.variables.STAT = "/usr/bin/stat" | 514 | defaults.variables.STAT = "/usr/bin/stat" |
| 475 | defaults.variables.STATFLAG = "-f '%A'" | 515 | defaults.variables.STATFLAG = "-f '%A'" |
| @@ -487,32 +527,28 @@ if detected.macosx then | |||
| 487 | defaults.web_browser = "open" | 527 | defaults.web_browser = "open" |
| 488 | end | 528 | end |
| 489 | 529 | ||
| 490 | if detected.linux then | 530 | if cfg.platforms.linux then |
| 491 | defaults.arch = "linux-"..cfg.target_cpu | 531 | defaults.arch = "linux-"..cfg.target_cpu |
| 492 | defaults.platforms = {"unix", "linux"} | ||
| 493 | end | 532 | end |
| 494 | 533 | ||
| 495 | if detected.freebsd then | 534 | if cfg.platforms.freebsd then |
| 496 | defaults.arch = "freebsd-"..cfg.target_cpu | 535 | defaults.arch = "freebsd-"..cfg.target_cpu |
| 497 | defaults.platforms = {"unix", "bsd", "freebsd"} | ||
| 498 | defaults.gcc_rpath = false | 536 | defaults.gcc_rpath = false |
| 499 | defaults.variables.CC = "cc" | 537 | defaults.variables.CC = "cc" |
| 500 | defaults.variables.LD = "cc" | 538 | defaults.variables.LD = "cc" |
| 501 | end | 539 | end |
| 502 | 540 | ||
| 503 | if detected.openbsd then | 541 | if cfg.platforms.openbsd then |
| 504 | defaults.arch = "openbsd-"..cfg.target_cpu | 542 | defaults.arch = "openbsd-"..cfg.target_cpu |
| 505 | defaults.platforms = {"unix", "bsd", "openbsd"} | ||
| 506 | end | 543 | end |
| 507 | 544 | ||
| 508 | if detected.netbsd then | 545 | if cfg.platforms.netbsd then |
| 509 | defaults.arch = "netbsd-"..cfg.target_cpu | 546 | defaults.arch = "netbsd-"..cfg.target_cpu |
| 510 | defaults.platforms = {"unix", "bsd", "netbsd"} | ||
| 511 | end | 547 | end |
| 512 | 548 | ||
| 513 | if detected.solaris then | 549 | if cfg.platforms.solaris then |
| 514 | defaults.arch = "solaris-"..cfg.target_cpu | 550 | defaults.arch = "solaris-"..cfg.target_cpu |
| 515 | defaults.platforms = {"unix", "solaris"} | 551 | --defaults.platforms = {"unix", "solaris"} |
| 516 | defaults.variables.MAKE = "gmake" | 552 | defaults.variables.MAKE = "gmake" |
| 517 | end | 553 | end |
| 518 | 554 | ||
| @@ -612,11 +648,11 @@ end | |||
| 612 | function cfg.which_config() | 648 | function cfg.which_config() |
| 613 | return { | 649 | return { |
| 614 | system = { | 650 | system = { |
| 615 | file = sys_config_file, | 651 | file = sys_config_file or sys_config_file_default, |
| 616 | ok = sys_config_ok, | 652 | ok = sys_config_ok, |
| 617 | }, | 653 | }, |
| 618 | user = { | 654 | user = { |
| 619 | file = home_config_file, | 655 | file = home_config_file or home_config_file_default, |
| 620 | ok = home_config_ok, | 656 | ok = home_config_ok, |
| 621 | } | 657 | } |
| 622 | } | 658 | } |
