diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2022-04-16 17:12:28 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2022-04-16 17:15:06 -0300 |
commit | 1411cd7ea9e51eeae050fa27ea6a95190737b601 (patch) | |
tree | cc7928cb2c349c69ca2d7651eb702c69fd678d7c | |
parent | ab5b1380c1717c22c9d6188b334e8a93c877be57 (diff) | |
download | luarocks-1411cd7ea9e51eeae050fa27ea6a95190737b601.tar.gz luarocks-1411cd7ea9e51eeae050fa27ea6a95190737b601.tar.bz2 luarocks-1411cd7ea9e51eeae050fa27ea6a95190737b601.zip |
deps: better error message when lua.h version mismatches
-rwxr-xr-x | binary/all_in_one | 4 | ||||
-rw-r--r-- | src/luarocks/deps.lua | 22 |
2 files changed, 17 insertions, 9 deletions
diff --git a/binary/all_in_one b/binary/all_in_one index 34b84a2c..63c6ef98 100755 --- a/binary/all_in_one +++ b/binary/all_in_one | |||
@@ -410,8 +410,8 @@ local function generate(main_program, dir, skip) | |||
410 | fd:write(reindent_c(table.concat(out, "\n"))) | 410 | fd:write(reindent_c(table.concat(out, "\n"))) |
411 | fd:close() | 411 | fd:close() |
412 | 412 | ||
413 | deps.check_lua_incdir(cfg.variables) | 413 | assert(deps.check_lua_incdir(cfg.variables)) |
414 | deps.check_lua_libdir(cfg.variables) | 414 | assert(deps.check_lua_libdir(cfg.variables)) |
415 | 415 | ||
416 | cmd = table.concat(filter_in(nonnull, { | 416 | cmd = table.concat(filter_in(nonnull, { |
417 | CC, "-o", TARGET_DIR .. "/" .. program_name .. ".exe", | 417 | CC, "-o", TARGET_DIR .. "/" .. program_name .. ".exe", |
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" |