aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/deps.lua10
-rw-r--r--src/luarocks/deps.tl10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 3eded47a..90c11bd5 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -705,19 +705,19 @@ function deps.scan_deps(results, mdeps, name, version, deps_mode)
705end 705end
706 706
707local function lua_h_exists(d, luaver) 707local function lua_h_exists(d, luaver)
708 local major, minor = luaver:match("(%d+)%.(%d+)") 708 local major_s, minor_s = luaver:match("(%d+)%.(%d+)")
709 local luanum = ("%s%02d"):format(major, math.tointeger(minor)) 709 local major, minor = math.tointeger(major_s), math.tointeger(minor_s)
710 710
711 local lua_h = dir.path(d, "lua.h") 711 local lua_h = dir.path(d, "lua.h")
712 local fd = io.open(lua_h) 712 local fd = io.open(lua_h)
713 if fd then 713 if fd then
714 local data = fd:read("*a") 714 local data = fd:read("*a")
715 fd:close() 715 fd:close()
716 if major == "5" and minor == "5" then 716 if vers.parse_version(("%d.%d"):format(major, minor)) >= vers.parse_version("5.5") then
717 if data:match("LUA_VERSION_MINOR_N%s5") and data:match("LUA_VERSION_MAJOR_N%s5") then 717 if data:match("LUA_VERSION_MAJOR_N%s+" .. major) and data:match("LUA_VERSION_MINOR_N%s+" .. minor) then
718 return d ~= nil 718 return d ~= nil
719 end 719 end
720 elseif data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then 720 elseif data:match("LUA_VERSION_NUM%s*" .. ("%d%02d"):format(major, minor)) then
721 return d ~= nil 721 return d ~= nil
722 end 722 end
723 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2 723 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2
diff --git a/src/luarocks/deps.tl b/src/luarocks/deps.tl
index 85980347..55006a95 100644
--- a/src/luarocks/deps.tl
+++ b/src/luarocks/deps.tl
@@ -705,19 +705,19 @@ function deps.scan_deps(results: {string: string}, mdeps: {string: {string: {Que
705end 705end
706 706
707local function lua_h_exists(d: string, luaver: string): boolean, string, string, integer 707local function lua_h_exists(d: string, luaver: string): boolean, string, string, integer
708 local major, minor = luaver:match("(%d+)%.(%d+)") 708 local major_s, minor_s = luaver:match("(%d+)%.(%d+)")
709 local luanum = ("%s%02d"):format(major, math.tointeger(minor)) 709 local major, minor = math.tointeger(major_s), math.tointeger(minor_s)
710 710
711 local lua_h = dir.path(d, "lua.h") 711 local lua_h = dir.path(d, "lua.h")
712 local fd = io.open(lua_h) 712 local fd = io.open(lua_h)
713 if fd then 713 if fd then
714 local data = fd:read("*a") 714 local data = fd:read("*a")
715 fd:close() 715 fd:close()
716 if major == "5" and minor == "5" then 716 if vers.parse_version(("%d.%d"):format(major, minor)) >= vers.parse_version("5.5") then
717 if data:match("LUA_VERSION_MINOR_N%s5") and data:match("LUA_VERSION_MAJOR_N%s5") then 717 if data:match("LUA_VERSION_MAJOR_N%s+" .. major) and data:match("LUA_VERSION_MINOR_N%s+" .. minor) then
718 return d ~= nil 718 return d ~= nil
719 end 719 end
720 elseif data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then 720 elseif data:match("LUA_VERSION_NUM%s*" .. ("%d%02d"):format(major, minor)) then
721 return d ~= nil 721 return d ~= nil
722 end 722 end
723 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2 723 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2