diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-08-21 18:36:25 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-08-21 18:38:53 +0300 |
commit | 1adda57f6d311e181998918ce27bdd5bd743975e (patch) | |
tree | 8dedbaa3e2555fa74d7f60c79ad87b8a386f4dd3 | |
parent | e3c6073f5912d3fd9d098783483a63bf39610fb3 (diff) | |
download | luarocks-1adda57f6d311e181998918ce27bdd5bd743975e.tar.gz luarocks-1adda57f6d311e181998918ce27bdd5bd743975e.tar.bz2 luarocks-1adda57f6d311e181998918ce27bdd5bd743975e.zip |
Refactor look_for_link_libraries in install.bat
One side effect should be that inferred LIB_DIR has no trailing backslash.
-rw-r--r-- | install.bat | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/install.bat b/install.bat index 1bce4c53..0f377d8d 100644 --- a/install.bat +++ b/install.bat | |||
@@ -316,30 +316,30 @@ local function look_for_interpreter(directory) | |||
316 | return false | 316 | return false |
317 | end | 317 | end |
318 | 318 | ||
319 | local function look_for_link_libraries (directory) | 319 | local function look_for_link_libraries(directory) |
320 | local directories | ||
320 | if vars.LUA_LIBDIR then | 321 | if vars.LUA_LIBDIR then |
321 | for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do | 322 | directories = {vars.LUA_LIBDIR} |
322 | print(S" checking for $LUA_LIBDIR\\"..name) | 323 | else |
323 | if exists(vars.LUA_LIBDIR.."\\"..name) then | 324 | directories = {directory, directory .. "\\lib", directory .. "\\bin"} |
324 | vars.LUA_LIBNAME = name | ||
325 | print(" Found "..name) | ||
326 | return true | ||
327 | end | ||
328 | end | ||
329 | die(S"link library (one of; $LUA_LIB_NAMES) not found in $LUA_LIBDIR") | ||
330 | end | 325 | end |
331 | 326 | ||
332 | for _, e in ipairs{ [[\]], [[\lib\]], [[\bin\]]} do | 327 | for _, dir in ipairs(directories) do |
333 | for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do | 328 | for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do |
334 | print(" checking for "..directory..e.."\\"..name) | 329 | local full_name = dir .. "\\" .. name |
335 | if exists(directory..e.."\\"..name) then | 330 | print(" checking for " .. full_name) |
336 | vars.LUA_LIBDIR = directory .. e | 331 | if exists(full_name) then |
332 | vars.LUA_LIBDIR = dir | ||
337 | vars.LUA_LIBNAME = name | 333 | vars.LUA_LIBNAME = name |
338 | print(" Found "..name) | 334 | print(" Found " .. name) |
339 | return true | 335 | return true |
340 | end | 336 | end |
341 | end | 337 | end |
342 | end | 338 | end |
339 | |||
340 | if vars.LUA_LIBDIR then | ||
341 | die(S"link library (one of; $LUA_LIB_NAMES) not found in $LUA_LIBDIR") | ||
342 | end | ||
343 | return false | 343 | return false |
344 | end | 344 | end |
345 | 345 | ||