aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-08-21 18:49:21 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-08-21 18:51:06 +0300
commit285bf935d0cf7fe12640d788b29fa092027a8d60 (patch)
treee1e28a4b5aede0065986801d651000a6a8c9b850
parent1adda57f6d311e181998918ce27bdd5bd743975e (diff)
downloadluarocks-285bf935d0cf7fe12640d788b29fa092027a8d60.tar.gz
luarocks-285bf935d0cf7fe12640d788b29fa092027a8d60.tar.bz2
luarocks-285bf935d0cf7fe12640d788b29fa092027a8d60.zip
Refactor look_for_headers in install.bat
One side effect should be that LUA_INCDIR does not have trailing backslash when inferred.
-rw-r--r--install.bat38
1 files changed, 20 insertions, 18 deletions
diff --git a/install.bat b/install.bat
index 0f377d8d..41474c47 100644
--- a/install.bat
+++ b/install.bat
@@ -343,31 +343,33 @@ local function look_for_link_libraries(directory)
343 return false 343 return false
344end 344end
345 345
346local function look_for_headers (directory) 346local function look_for_headers(directory)
347 local directories
347 if vars.LUA_INCDIR then 348 if vars.LUA_INCDIR then
348 print(S" checking for $LUA_INCDIR\\lua.h") 349 directories = {vars.LUA_INCDIR}
349 if exists(S"$LUA_INCDIR\\lua.h") then 350 else
350 print(" Found lua.h") 351 directories = {
351 return true 352 directory .. S"\\include\\lua\\$LUA_VERSION",
352 end 353 directory .. S"\\include\\lua$LUA_SHORTV",
353 die(S"lua.h not found in $LUA_INCDIR") 354 directory .. S"\\include\\lua$LUA_VERSION",
355 directory .. "\\include",
356 directory
357 }
354 end 358 end
355 359
356 for _, e in ipairs{ 360 for _, dir in ipairs(directories) do
357 S([[\include\lua\$LUA_VERSION]]), 361 local full_name = dir .. "\\lua.h"
358 S([[\include\lua$LUA_SHORTV]]), 362 print(" checking for " .. full_name)
359 S([[\include\lua$LUA_VERSION]]), 363 if exists(full_name) then
360 S([[\include\$LUA_VERSION]]), 364 vars.LUA_INCDIR = dir
361 [[\include\]],
362 [[\]],
363 } do
364 print(" checking for "..directory..e.."\\lua.h")
365 if exists(directory..e.."\\lua.h") then
366 vars.LUA_INCDIR = directory..e
367 print(" Found lua.h") 365 print(" Found lua.h")
368 return true 366 return true
369 end 367 end
370 end 368 end
369
370 if vars.LUA_INCDIR then
371 die(S"lua.h not found in $LUA_INCDIR")
372 end
371 return false 373 return false
372end 374end
373 375