diff options
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r-- | src/luarocks/cfg.lua | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 3a5294f5..2904146b 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -265,6 +265,8 @@ local defaults = { | |||
265 | lib = "lib", | 265 | lib = "lib", |
266 | include = "include" | 266 | include = "include" |
267 | }, | 267 | }, |
268 | |||
269 | rocks_provided = {} | ||
268 | } | 270 | } |
269 | 271 | ||
270 | if detected.windows then | 272 | if detected.windows then |
@@ -453,16 +455,33 @@ defaults.variables.OBJ_EXTENSION = defaults.obj_extension | |||
453 | defaults.variables.LUAROCKS_PREFIX = site_config.LUAROCKS_PREFIX | 455 | defaults.variables.LUAROCKS_PREFIX = site_config.LUAROCKS_PREFIX |
454 | defaults.variables.LUA = site_config.LUA_DIR_SET and (defaults.variables.LUA_BINDIR.."/"..defaults.lua_interpreter) or defaults.lua_interpreter | 456 | defaults.variables.LUA = site_config.LUA_DIR_SET and (defaults.variables.LUA_BINDIR.."/"..defaults.lua_interpreter) or defaults.lua_interpreter |
455 | 457 | ||
456 | -- Use defaults: | 458 | -- Add built-in modules to rocks_provided |
459 | defaults.rocks_provided["lua"] = lua_version.."-1" | ||
457 | 460 | ||
458 | -- Populate values from 'defaults.variables' in 'variables' if they were not | 461 | if lua_version >= "5.2" then |
459 | -- already set by user. | 462 | -- Lua 5.2+ |
460 | if not _M.variables then | 463 | defaults.rocks_provided["bit32"] = lua_version.."-1" |
461 | _M.variables = {} | ||
462 | end | 464 | end |
463 | for k,v in pairs(defaults.variables) do | 465 | |
464 | if not _M.variables[k] then | 466 | if package.loaded.jit then |
465 | _M.variables[k] = v | 467 | -- LuaJIT |
468 | local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","") | ||
469 | --defaults.rocks_provided["luajit"] = lj_version.."-1" | ||
470 | defaults.rocks_provided["luabitop"] = lj_version.."-1" | ||
471 | end | ||
472 | |||
473 | -- Use defaults: | ||
474 | |||
475 | -- Populate some arrays with values from their 'defaults' counterparts | ||
476 | -- if they were not already set by user. | ||
477 | for _, entry in ipairs({"variables", "rocks_provided"}) do | ||
478 | if not _M[entry] then | ||
479 | _M[entry] = {} | ||
480 | end | ||
481 | for k,v in pairs(defaults[entry]) do | ||
482 | if not _M[entry][k] then | ||
483 | _M[entry][k] = v | ||
484 | end | ||
466 | end | 485 | end |
467 | end | 486 | end |
468 | 487 | ||