diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/core/cfg.lua | 1 | ||||
-rw-r--r-- | src/luarocks/deps.lua | 50 |
2 files changed, 28 insertions, 23 deletions
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index c50e0a44..8edd5f63 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
@@ -356,6 +356,7 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
356 | lib = { "cyg?.dll", "?.dll", "lib?.dll" }, | 356 | lib = { "cyg?.dll", "?.dll", "lib?.dll" }, |
357 | include = { "?.h" } | 357 | include = { "?.h" } |
358 | } | 358 | } |
359 | defaults.link_lua_explicitly = true | ||
359 | end | 360 | end |
360 | 361 | ||
361 | if platforms.unix then | 362 | if platforms.unix then |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 874787da..9ea14881 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -532,35 +532,39 @@ local function find_lua_incdir(prefix, luaver, luajitver) | |||
532 | end | 532 | end |
533 | 533 | ||
534 | function deps.check_lua(vars) | 534 | function deps.check_lua(vars) |
535 | local incdir_found = true | ||
536 | local ljv = util.get_luajit_version() | 535 | local ljv = util.get_luajit_version() |
536 | |||
537 | if (not vars.LUA_INCDIR) and vars.LUA_DIR then | 537 | if (not vars.LUA_INCDIR) and vars.LUA_DIR then |
538 | vars.LUA_INCDIR = find_lua_incdir(vars.LUA_DIR, cfg.lua_version, ljv) | 538 | vars.LUA_INCDIR = find_lua_incdir(vars.LUA_DIR, cfg.lua_version, ljv) |
539 | incdir_found = (vars.LUA_INCDIR ~= nil) | 539 | if vars.LUA_INCDIR == nil then |
540 | end | 540 | return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" |
541 | local shortv = cfg.lua_version:gsub("%.", "") | ||
542 | local libnames = { | ||
543 | "lua" .. cfg.lua_version, | ||
544 | "lua" .. shortv, | ||
545 | "lua-" .. cfg.lua_version, | ||
546 | "lua-" .. shortv, | ||
547 | "lua", | ||
548 | } | ||
549 | if ljv then | ||
550 | table.insert(libnames, 1, "luajit-" .. cfg.lua_version) | ||
551 | end | ||
552 | local cache = {} | ||
553 | for _, libname in ipairs(libnames) do | ||
554 | local ok = check_external_dependency("LUA", { library = libname }, vars, "build", cache) | ||
555 | if ok then | ||
556 | vars.LUALIB = vars.LUA_LIBDIR_FILE | ||
557 | return true | ||
558 | end | 541 | end |
559 | end | 542 | end |
560 | if not incdir_found then | 543 | |
561 | return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" | 544 | if cfg.link_lua_explicitly then |
545 | local shortv = cfg.lua_version:gsub("%.", "") | ||
546 | local libnames = { | ||
547 | "lua" .. cfg.lua_version, | ||
548 | "lua" .. shortv, | ||
549 | "lua-" .. cfg.lua_version, | ||
550 | "lua-" .. shortv, | ||
551 | "lua", | ||
552 | } | ||
553 | if ljv then | ||
554 | table.insert(libnames, 1, "luajit-" .. cfg.lua_version) | ||
555 | end | ||
556 | local cache = {} | ||
557 | for _, libname in ipairs(libnames) do | ||
558 | local ok = check_external_dependency("LUA", { library = libname }, vars, "build", cache) | ||
559 | if ok then | ||
560 | vars.LUALIB = vars.LUA_LIBDIR_FILE | ||
561 | return true | ||
562 | end | ||
563 | end | ||
564 | return nil, "Failed finding Lua library. You may need to configure LUA_LIBDIR.", "dependency" | ||
562 | end | 565 | end |
563 | return nil, "Failed finding Lua library. You may need to configure LUA_LIBDIR.", "dependency" | 566 | |
567 | return true | ||
564 | end | 568 | end |
565 | 569 | ||
566 | local valid_deps_modes = { | 570 | local valid_deps_modes = { |