aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-02-19 20:21:32 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-02-20 03:51:25 -0300
commit1ed80a15d215f5b924008f61f4a30da6139ca1bf (patch)
tree82995044c324a65bb5b5b512eecd557e60682e80
parentfaa7c7560645fde443ad022214c0bb1fbea6953f (diff)
downloadluarocks-1ed80a15d215f5b924008f61f4a30da6139ca1bf.tar.gz
luarocks-1ed80a15d215f5b924008f61f4a30da6139ca1bf.tar.bz2
luarocks-1ed80a15d215f5b924008f61f4a30da6139ca1bf.zip
fix: let runtime detection handle LUALIB filename
This should be more flexible than hardcoding a value that may become incorrect once people reconfigure their LuaRocks to point to another Lua distribution, especially on Windows. Fixes #905.
-rw-r--r--install.bat3
-rw-r--r--src/luarocks/core/cfg.lua4
2 files changed, 2 insertions, 5 deletions
diff --git a/install.bat b/install.bat
index e84f78cf..ba4a12fd 100644
--- a/install.bat
+++ b/install.bat
@@ -339,7 +339,7 @@ local function look_for_link_libraries(directory)
339 -- MinGW does not generate .lib, nor needs it to link, but MSVC does, 339 -- MinGW does not generate .lib, nor needs it to link, but MSVC does,
340 -- so .lib must be listed first to ensure they are found first if present, 340 -- so .lib must be listed first to ensure they are found first if present,
341 -- to prevent MSVC trying to link to a .dll, which won't work. 341 -- to prevent MSVC trying to link to a .dll, which won't work.
342 local names = {S"lua$LUA_VERSION.lib", S"lua$LUA_SHORTV.lib", S"lua$LUA_VERSION.dll", S"lua$LUA_SHORTV.dll", "liblua.dll.a"} 342 local names = {S"lua$LUA_VERSION.lib", S"lua$LUA_SHORTV.lib", S"liblua$LUA_SHORTV.a", S"lua$LUA_VERSION.dll", S"lua$LUA_SHORTV.dll", "liblua.dll.a"}
343 local directories 343 local directories
344 if vars.LUA_LIBDIR then 344 if vars.LUA_LIBDIR then
345 directories = {vars.LUA_LIBDIR} 345 directories = {vars.LUA_LIBDIR}
@@ -1151,7 +1151,6 @@ if USE_MINGW and vars.LUA_RUNTIME == "MSVCRT" then
1151else 1151else
1152 f:write(" MSVCRT = '"..vars.LUA_RUNTIME.."',\n") 1152 f:write(" MSVCRT = '"..vars.LUA_RUNTIME.."',\n")
1153end 1153end
1154f:write(S" LUALIB = '$LUA_LIBNAME',\n")
1155if USE_MINGW then 1154if USE_MINGW then
1156 f:write(S[[ 1155 f:write(S[[
1157 CC = $MINGW_CC, 1156 CC = $MINGW_CC,
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index a420bb44..a3a7d6cb 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -293,14 +293,13 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
293 defaults.variables.LD = os.getenv("LINK") or "link" 293 defaults.variables.LD = os.getenv("LINK") or "link"
294 defaults.variables.MT = os.getenv("MT") or "mt" 294 defaults.variables.MT = os.getenv("MT") or "mt"
295 defaults.variables.AR = os.getenv("AR") or "lib" 295 defaults.variables.AR = os.getenv("AR") or "lib"
296 defaults.variables.LUALIB = "lua"..lua_version..".lib"
297 defaults.variables.CFLAGS = os.getenv("CFLAGS") or "/nologo /MD /O2" 296 defaults.variables.CFLAGS = os.getenv("CFLAGS") or "/nologo /MD /O2"
298 defaults.variables.LDFLAGS = os.getenv("LDFLAGS") 297 defaults.variables.LDFLAGS = os.getenv("LDFLAGS")
299 defaults.variables.LIBFLAG = "/nologo /dll" 298 defaults.variables.LIBFLAG = "/nologo /dll"
300 299
301 defaults.external_deps_patterns = { 300 defaults.external_deps_patterns = {
302 bin = { "?.exe", "?.bat" }, 301 bin = { "?.exe", "?.bat" },
303 lib = { "?.lib", "?.dll", "lib?.dll" }, 302 lib = { "?.lib", "lib?.lib", "?.dll", "lib?.dll" },
304 include = { "?.h" } 303 include = { "?.h" }
305 } 304 }
306 defaults.runtime_external_deps_patterns = { 305 defaults.runtime_external_deps_patterns = {
@@ -443,7 +442,6 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
443 defaults.variables.MT = os.getenv("MT") or nil 442 defaults.variables.MT = os.getenv("MT") or nil
444 defaults.variables.AR = os.getenv("AR") or "ar" 443 defaults.variables.AR = os.getenv("AR") or "ar"
445 defaults.variables.RANLIB = os.getenv("RANLIB") or "ranlib" 444 defaults.variables.RANLIB = os.getenv("RANLIB") or "ranlib"
446 defaults.variables.LUALIB = "liblua"..lua_version..".dll.a"
447 445
448 defaults.variables.CFLAGS = os.getenv("CFLAGS") or "-O2 -fPIC" 446 defaults.variables.CFLAGS = os.getenv("CFLAGS") or "-O2 -fPIC"
449 if not defaults.variables.CFLAGS:match("-fPIC") then 447 if not defaults.variables.CFLAGS:match("-fPIC") then