aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.bat23
1 files changed, 8 insertions, 15 deletions
diff --git a/install.bat b/install.bat
index 7ed59525..bdde4413 100644
--- a/install.bat
+++ b/install.bat
@@ -24,10 +24,6 @@ vars.LUA_LIBDIR = nil
24vars.LUA_LIBNAME = nil 24vars.LUA_LIBNAME = nil
25vars.LUA_VERSION = "5.1" 25vars.LUA_VERSION = "5.1"
26vars.LUA_SHORTV = nil -- "51" 26vars.LUA_SHORTV = nil -- "51"
27-- MinGW does not generate .lib, nor needs it to link, but MSVC does
28-- so .lib must be listed first to ensure they are found first if present.
29-- To prevent MSVC trying to link to a .dll, which won't work.
30vars.LUA_LIB_NAMES = "lua5.1.lib lua51.lib lua5.1.dll lua51.dll liblua.dll.a"
31vars.LUA_RUNTIME = nil 27vars.LUA_RUNTIME = nil
32vars.UNAME_M = nil 28vars.UNAME_M = nil
33vars.COMPILER_ENV_CMD = nil 29vars.COMPILER_ENV_CMD = nil
@@ -273,14 +269,8 @@ local function check_flags()
273 die("Bundled Lua version is 5.1, cannot install "..vars.LUA_VERSION) 269 die("Bundled Lua version is 5.1, cannot install "..vars.LUA_VERSION)
274 end 270 end
275 end 271 end
276 if vars.LUA_VERSION ~= "5.1" then 272 if not vars.LUA_VERSION:match("^5%.[123]$") then
277 if vars.LUA_VERSION == "5.2" then 273 die("Bad argument: /LV must either be 5.1, 5.2, or 5.3")
278 vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%12")
279 elseif vars.LUA_VERSION == "5.3" then
280 vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%13")
281 else
282 die("Bad argument: /LV must either be 5.1, 5.2, or 5.3")
283 end
284 end 274 end
285 if USE_MSVC_MANUAL and USE_MINGW then 275 if USE_MSVC_MANUAL and USE_MINGW then
286 die("Cannot combine option /MSVC and /MW") 276 die("Cannot combine option /MSVC and /MW")
@@ -339,7 +329,6 @@ local function look_for_interpreter(directory)
339 else 329 else
340 vars.LUA_VERSION = version 330 vars.LUA_VERSION = version
341 vars.LUA_SHORTV = version:gsub("%.", "") 331 vars.LUA_SHORTV = version:gsub("%.", "")
342 vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)[123]", "5%1" .. version:sub(-1))
343 end 332 end
344 end 333 end
345 334
@@ -358,6 +347,10 @@ local function look_for_interpreter(directory)
358end 347end
359 348
360local function look_for_link_libraries(directory) 349local function look_for_link_libraries(directory)
350 -- MinGW does not generate .lib, nor needs it to link, but MSVC does,
351 -- so .lib must be listed first to ensure they are found first if present,
352 -- to prevent MSVC trying to link to a .dll, which won't work.
353 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"}
361 local directories 354 local directories
362 if vars.LUA_LIBDIR then 355 if vars.LUA_LIBDIR then
363 directories = {vars.LUA_LIBDIR} 356 directories = {vars.LUA_LIBDIR}
@@ -366,7 +359,7 @@ local function look_for_link_libraries(directory)
366 end 359 end
367 360
368 for _, dir in ipairs(directories) do 361 for _, dir in ipairs(directories) do
369 for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do 362 for _, name in ipairs(names) do
370 local full_name = dir .. "\\" .. name 363 local full_name = dir .. "\\" .. name
371 print(" checking for " .. full_name) 364 print(" checking for " .. full_name)
372 if exists(full_name) then 365 if exists(full_name) then
@@ -379,7 +372,7 @@ local function look_for_link_libraries(directory)
379 end 372 end
380 373
381 if vars.LUA_LIBDIR then 374 if vars.LUA_LIBDIR then
382 die(S"link library (one of; $LUA_LIB_NAMES) not found in $LUA_LIBDIR") 375 die(("Link library (one of %s) not found in %s"):format(table.concat(names, ", "), vars.LUA_LIBDIR))
383 end 376 end
384 return false 377 return false
385end 378end