diff options
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r-- | src/luarocks/cfg.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 3a5294f5..56396239 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,6 +455,24 @@ 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 | ||
458 | -- Add built-in modules to rocks_provided | ||
459 | defaults.rocks_provided["lua"] = lua_version.."-1" | ||
460 | |||
461 | if lua_version >= "5.2" then | ||
462 | -- Lua 5.2+ | ||
463 | defaults.rocks_provided["bit32"] = lua_version.."-1" | ||
464 | end | ||
465 | |||
466 | if package.loaded.jit then | ||
467 | -- LuaJIT | ||
468 | local lj_version = package.loaded.jit.version:match("LuaJIT (%d%.%d%.%d)") | ||
469 | defaults.rocks_provided["luajit"] = lj_version.."-1" | ||
470 | defaults.rocks_provided["jit"] = lj_version.."-1" | ||
471 | defaults.rocks_provided["ffi"] = lj_version.."-1" | ||
472 | defaults.rocks_provided["bit"] = lj_version.."-1" | ||
473 | defaults.rocks_provided["luabitop"] = lj_version.."-1" | ||
474 | end | ||
475 | |||
456 | -- Use defaults: | 476 | -- Use defaults: |
457 | 477 | ||
458 | -- Populate values from 'defaults.variables' in 'variables' if they were not | 478 | -- Populate values from 'defaults.variables' in 'variables' if they were not |
@@ -466,6 +486,17 @@ for k,v in pairs(defaults.variables) do | |||
466 | end | 486 | end |
467 | end | 487 | end |
468 | 488 | ||
489 | -- Populate values from 'defaults.rocks_provided' in 'rocks_provided' if they | ||
490 | -- were not already set by user. | ||
491 | if not type(_M.rocks_provided) == "table" then | ||
492 | _M.rocks_provided = {} | ||
493 | end | ||
494 | for k,v in pairs(defaults.rocks_provided) do | ||
495 | if not _M.rocks_provided[k] then | ||
496 | _M.rocks_provided[k] = v | ||
497 | end | ||
498 | end | ||
499 | |||
469 | -- For values not set in the config file, use values from the 'defaults' table. | 500 | -- For values not set in the config file, use values from the 'defaults' table. |
470 | local cfg_mt = { | 501 | local cfg_mt = { |
471 | __index = function(t, k) | 502 | __index = function(t, k) |