diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/deps.lua | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index fc9ed804..cbd8962c 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -665,11 +665,10 @@ local function lua_h_exists(d, luaver) | |||
665 | if data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then | 665 | if data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then |
666 | return d | 666 | return d |
667 | end | 667 | end |
668 | 668 | return nil, "Lua header found at " .. d .. " does not match Lua version " .. luaver .. ". You may want to override this by configuring LUA_INCDIR.", "dependency", 2 | |
669 | return nil, "Lua header mismatches configured version. You may need to install them or configure LUA_INCDIR.", "dependency" | ||
670 | end | 669 | end |
671 | 670 | ||
672 | return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" | 671 | return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency", 1 |
673 | end | 672 | end |
674 | 673 | ||
675 | local function find_lua_incdir(prefix, luaver, luajitver) | 674 | local function find_lua_incdir(prefix, luaver, luajitver) |
@@ -684,14 +683,21 @@ local function find_lua_incdir(prefix, luaver, luajitver) | |||
684 | prefix, | 683 | prefix, |
685 | luajitver and prefix .. "/include/luajit-" .. luajitver:match("^(%d+%.%d+)"), | 684 | luajitver and prefix .. "/include/luajit-" .. luajitver:match("^(%d+%.%d+)"), |
686 | } | 685 | } |
686 | local errprio = 0 | ||
687 | local mainerr | ||
687 | for _, d in ipairs(incdirs) do | 688 | for _, d in ipairs(incdirs) do |
688 | if lua_h_exists(d, luaver) then | 689 | local ok, err, _, prio = lua_h_exists(d, luaver) |
690 | if ok then | ||
689 | return d | 691 | return d |
690 | end | 692 | end |
693 | if prio > errprio then | ||
694 | mainerr = err | ||
695 | errprio = prio | ||
696 | end | ||
691 | end | 697 | end |
692 | 698 | ||
693 | -- not found, will fallback to a default | 699 | -- not found, will fallback to a default |
694 | return nil | 700 | return nil, mainerr |
695 | end | 701 | end |
696 | 702 | ||
697 | function deps.check_lua_incdir(vars) | 703 | function deps.check_lua_incdir(vars) |
@@ -702,10 +708,12 @@ function deps.check_lua_incdir(vars) | |||
702 | end | 708 | end |
703 | 709 | ||
704 | if vars.LUA_DIR then | 710 | if vars.LUA_DIR then |
705 | vars.LUA_INCDIR = find_lua_incdir(vars.LUA_DIR, cfg.lua_version, ljv) | 711 | local d, err = find_lua_incdir(vars.LUA_DIR, cfg.lua_version, ljv) |
706 | if vars.LUA_INCDIR then | 712 | if d then |
713 | vars.LUA_INCDIR = d | ||
707 | return true | 714 | return true |
708 | end | 715 | end |
716 | return nil, err | ||
709 | end | 717 | end |
710 | 718 | ||
711 | return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" | 719 | return nil, "Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.", "dependency" |