diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/deps.lua | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 25905ae3..0ea105f9 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
| @@ -742,22 +742,32 @@ function deps.check_lua_libdir(vars) | |||
| 742 | local save_LUA_INCDIR = vars.LUA_INCDIR | 742 | local save_LUA_INCDIR = vars.LUA_INCDIR |
| 743 | local ok = check_external_dependency("LUA", { library = libnames }, vars, "build", cache) | 743 | local ok = check_external_dependency("LUA", { library = libnames }, vars, "build", cache) |
| 744 | vars.LUA_INCDIR = save_LUA_INCDIR | 744 | vars.LUA_INCDIR = save_LUA_INCDIR |
| 745 | local err | ||
| 745 | if ok then | 746 | if ok then |
| 746 | local filename = dir.path(vars.LUA_LIBDIR, vars.LUA_LIBDIR_FILE) | 747 | local filename = dir.path(vars.LUA_LIBDIR, vars.LUA_LIBDIR_FILE) |
| 747 | local fd = io.open(filename, "r") | 748 | local fd = io.open(filename, "r") |
| 748 | if fd then | 749 | if fd then |
| 749 | local txt = fd:read("*a") | 750 | if not vars.LUA_LIBDIR_FILE:match((cfg.lua_version:gsub("%.", "%%.?"))) then |
| 750 | fd:close() | 751 | -- if filename isn't versioned, check file contents |
| 751 | if txt:match("Lua " .. cfg.lua_version, 1, true) then | 752 | local txt = fd:read("*a") |
| 752 | vars.LUALIB = vars.LUA_LIBDIR_FILE | 753 | ok = txt:match("Lua " .. cfg.lua_version, 1, true) |
| 753 | return true | 754 | or txt:match("lua" .. (cfg.lua_version:gsub("%.", "")), 1, true) |
| 754 | else | 755 | if not ok then |
| 755 | return nil, "Lua library at " .. filename .. " does not match Lua version " .. cfg.lua_version .. ". You may want to override this by configuring LUA_INCDIR.", "dependency" | 756 | err = "Lua library at " .. filename .. " does not match Lua version " .. cfg.lua_version .. ". You may want to override this by configuring LUA_INCDIR." |
| 757 | end | ||
| 756 | end | 758 | end |
| 759 | |||
| 760 | fd:close() | ||
| 757 | end | 761 | end |
| 762 | end | ||
| 763 | |||
| 764 | if ok then | ||
| 765 | vars.LUALIB = vars.LUA_LIBDIR_FILE | ||
| 758 | return true | 766 | return true |
| 767 | else | ||
| 768 | err = err or "Failed finding Lua library. You may need to configure LUA_LIBDIR." | ||
| 769 | return nil, err, "dependency" | ||
| 759 | end | 770 | end |
| 760 | return nil, "Failed finding Lua library. You may need to configure LUA_LIBDIR.", "dependency" | ||
| 761 | end | 771 | end |
| 762 | 772 | ||
| 763 | function deps.get_deps_mode(args) | 773 | function deps.get_deps_mode(args) |
