From 8f362f99582db3842a01cb703e0ca9dac3adb3d9 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 26 Jul 2019 16:25:50 -0300 Subject: only check for LUA_LIBDIR in platforms that need it --- src/luarocks/core/cfg.lua | 1 + 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) lib = { "cyg?.dll", "?.dll", "lib?.dll" }, include = { "?.h" } } + defaults.link_lua_explicitly = true end 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) end function deps.check_lua(vars) - local incdir_found = true local ljv = util.get_luajit_version() + if (not vars.LUA_INCDIR) and vars.LUA_DIR then vars.LUA_INCDIR = find_lua_incdir(vars.LUA_DIR, cfg.lua_version, ljv) - incdir_found = (vars.LUA_INCDIR ~= nil) - end - local shortv = cfg.lua_version:gsub("%.", "") - local libnames = { - "lua" .. cfg.lua_version, - "lua" .. shortv, - "lua-" .. cfg.lua_version, - "lua-" .. shortv, - "lua", - } - if ljv then - table.insert(libnames, 1, "luajit-" .. cfg.lua_version) - end - local cache = {} - for _, libname in ipairs(libnames) do - local ok = check_external_dependency("LUA", { library = libname }, vars, "build", cache) - if ok then - vars.LUALIB = vars.LUA_LIBDIR_FILE - return true + if vars.LUA_INCDIR == nil then + return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" end end - if not incdir_found then - return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" + + if cfg.link_lua_explicitly then + local shortv = cfg.lua_version:gsub("%.", "") + local libnames = { + "lua" .. cfg.lua_version, + "lua" .. shortv, + "lua-" .. cfg.lua_version, + "lua-" .. shortv, + "lua", + } + if ljv then + table.insert(libnames, 1, "luajit-" .. cfg.lua_version) + end + local cache = {} + for _, libname in ipairs(libnames) do + local ok = check_external_dependency("LUA", { library = libname }, vars, "build", cache) + if ok then + vars.LUALIB = vars.LUA_LIBDIR_FILE + return true + end + end + return nil, "Failed finding Lua library. You may need to configure LUA_LIBDIR.", "dependency" end - return nil, "Failed finding Lua library. You may need to configure LUA_LIBDIR.", "dependency" + + return true end local valid_deps_modes = { -- cgit v1.2.3-55-g6feb