diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-08-28 17:29:35 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-08-28 17:29:35 -0300 |
commit | d826373f886be97eb5f96d45ae828870211075e5 (patch) | |
tree | 5dcefa967b1c170957393d7ebcff662bf6f2101c | |
parent | c2c0272d973929fa1f74e4dcbc11402a5c5273e6 (diff) | |
download | luarocks-fix-lua-link-windows.tar.gz luarocks-fix-lua-link-windows.tar.bz2 luarocks-fix-lua-link-windows.zip |
fix: when linking Lua explicitly (Windows), use dynamic librariesfix-lua-link-windows
The original code was inconsistent, since it demanded dynamic libraries
for Cygwin but static libraries for other Windows compilers. However,
that wouldn't work for the same reason as Cygwin:
From the LuaJIT makefile:
https://github.com/LuaJIT/LuaJIT/blob/ae4735f621d89d84758769b76432d2319dda9827/src/Makefile#L558-L563V
"Mixed mode [static + dynamic] is not supported on Windows.
And static mode doesn't work well.
C modules cannot be loaded, because they bind to lua51.dll."
-rw-r--r-- | src/luarocks/deps.lua | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 344991f6..676668f8 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -553,15 +553,13 @@ local function check_external_dependency(name, ext_files, vars, mode, cache) | |||
553 | 553 | ||
554 | for _, prefix in ipairs(prefixes) do | 554 | for _, prefix in ipairs(prefixes) do |
555 | prefix = resolve_prefix(prefix, dirs) | 555 | prefix = resolve_prefix(prefix, dirs) |
556 | if cfg.is_platform("mingw32") and name == "LUA" then | 556 | |
557 | dirs.LIBDIR.pattern = fun.filter(util.deep_copy(dirs.LIBDIR.pattern), function(s) | 557 | if name == "LUA" and cfg.link_lua_explicitly then |
558 | return not s:match("%.a$") | ||
559 | end) | ||
560 | elseif cfg.is_platform("windows") and name == "LUA" then | ||
561 | dirs.LIBDIR.pattern = fun.filter(util.deep_copy(dirs.LIBDIR.pattern), function(s) | 558 | dirs.LIBDIR.pattern = fun.filter(util.deep_copy(dirs.LIBDIR.pattern), function(s) |
562 | return not s:match("%.dll$") | 559 | return not s:match("%." .. cfg.static_lib_extension .. "$") |
563 | end) | 560 | end) |
564 | end | 561 | end |
562 | |||
565 | ok, err_dirname, err_testfile = check_external_dependency_at(prefix, name, ext_files, vars, dirs, err_files, cache) | 563 | ok, err_dirname, err_testfile = check_external_dependency_at(prefix, name, ext_files, vars, dirs, err_files, cache) |
566 | if ok then | 564 | if ok then |
567 | return true | 565 | return true |