aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2015-12-01 16:42:23 +0100
committerThijs Schreijer <thijs@thijsschreijer.nl>2015-12-01 16:42:23 +0100
commitfd88e3664f2dfb7fad4deb99e1d4ad79a56f4bcc (patch)
tree9e7840888fa73db1b906591ccc67856870d143b5
parentf00f9c9ecf110b05f62d6cc2d42b2f662a935015 (diff)
downloadluarocks-fd88e3664f2dfb7fad4deb99e1d4ad79a56f4bcc.tar.gz
luarocks-fd88e3664f2dfb7fad4deb99e1d4ad79a56f4bcc.tar.bz2
luarocks-fd88e3664f2dfb7fad4deb99e1d4ad79a56f4bcc.zip
updated;
- output on checks done - commandline switch to disable the auto-search for ms tools - added debug libs to the SDK search
-rw-r--r--install.bat63
1 files changed, 54 insertions, 9 deletions
diff --git a/install.bat b/install.bat
index 718ec8d6..29c42d0e 100644
--- a/install.bat
+++ b/install.bat
@@ -29,11 +29,13 @@ vars.LUA_SHORTV = nil -- "51"
29vars.LUA_LIB_NAMES = "lua5.1.lib lua51.lib lua5.1.dll lua51.dll liblua.dll.a" 29vars.LUA_LIB_NAMES = "lua5.1.lib lua51.lib lua5.1.dll lua51.dll liblua.dll.a"
30vars.LUA_RUNTIME = nil 30vars.LUA_RUNTIME = nil
31vars.UNAME_M = nil 31vars.UNAME_M = nil
32vars.COMPILER_ENV_CMD = nil
32 33
33local FORCE = false 34local FORCE = false
34local FORCE_CONFIG = false 35local FORCE_CONFIG = false
35local INSTALL_LUA = false 36local INSTALL_LUA = false
36local USE_MINGW = false 37local USE_MINGW = false
38local USE_MSVC_MANUAL = false
37local REGISTRY = true 39local REGISTRY = true
38local NOADMIN = false 40local NOADMIN = false
39local PROMPT = true 41local PROMPT = true
@@ -166,7 +168,14 @@ Configuring the Lua interpreter:
166 (/LUA, /INC, /LIB, /BIN cannot be used with /L) 168 (/LUA, /INC, /LIB, /BIN cannot be used with /L)
167 169
168Compiler configuration: 170Compiler configuration:
169/MW Use mingw as build system instead of MSVC 171 By default the installer will try to determine the
172 Microsoft toolchain to use. And will automatically use
173 a setup command to initialize that toolchain when
174 LuaRocks is run. If it cannot find it, it will default
175 to the /MSVC switch.
176/MSVC Use MS toolchain, without a setup command (tools must
177 be in your path)
178/MW Use mingw as build system (tools must be in your path)
170 179
171Other options: 180Other options:
172/FORCECONFIG Use a single config location. Do not use the 181/FORCECONFIG Use a single config location. Do not use the
@@ -213,6 +222,8 @@ local function parse_options(args)
213 INSTALL_LUA = true 222 INSTALL_LUA = true
214 elseif name == "/MW" then 223 elseif name == "/MW" then
215 USE_MINGW = true 224 USE_MINGW = true
225 elseif name == "/MSVC" then
226 USE_MSVC_MANUAL = true
216 elseif name == "/LUA" then 227 elseif name == "/LUA" then
217 vars.LUA_PREFIX = option.value 228 vars.LUA_PREFIX = option.value
218 elseif name == "/LIB" then 229 elseif name == "/LIB" then
@@ -266,6 +277,9 @@ local function check_flags()
266 die("Bad argument: /LV must either be 5.1, 5.2, or 5.3") 277 die("Bad argument: /LV must either be 5.1, 5.2, or 5.3")
267 end 278 end
268 end 279 end
280 if USE_MSVC_MANUAL and USE_MINGW then
281 die("Cannot combine option /MSVC and /MW")
282 end
269end 283end
270 284
271-- *********************************************************** 285-- ***********************************************************
@@ -433,14 +447,22 @@ end
433local function get_visual_studio_directory() 447local function get_visual_studio_directory()
434 assert(type(vars.LUA_RUNTIME)=="string", "requires vars.LUA_RUNTIME to be set before calling this function.") 448 assert(type(vars.LUA_RUNTIME)=="string", "requires vars.LUA_RUNTIME to be set before calling this function.")
435 local major, minor = vars.LUA_RUNTIME:match('VCR%u*(%d+)(%d)$') -- MSVCR<x><y> or VCRUNTIME<x><y> 449 local major, minor = vars.LUA_RUNTIME:match('VCR%u*(%d+)(%d)$') -- MSVCR<x><y> or VCRUNTIME<x><y>
436 if not major then return nil end 450 if not major then
451 print(S[[ Cannot auto-detect Visual Studio version from $LUA_RUNTIME]])
452 return nil
453 end
437 local keys = { 454 local keys = {
438 "HKLM\\Software\\Microsoft\\VisualStudio\\%d.%d\\Setup\\VC", 455 "HKLM\\Software\\Microsoft\\VisualStudio\\%d.%d\\Setup\\VC",
439 "HKLM\\Software\\Microsoft\\VCExpress\\%d.%d\\Setup\\VS" 456 "HKLM\\Software\\Microsoft\\VCExpress\\%d.%d\\Setup\\VS"
440 } 457 }
441 for _, key in ipairs(keys) do 458 for _, key in ipairs(keys) do
442 local vcdir = get_registry(key:format(major, minor), "ProductDir") 459 local versionedkey = key:format(major, minor)
443 if vcdir then return vcdir end 460 local vcdir = get_registry(versionedkey, "ProductDir")
461 print(" checking: "..versionedkey)
462 if vcdir then
463 print(" Found: "..vcdir)
464 return vcdir
465 end
444 end 466 end
445 return nil 467 return nil
446end 468end
@@ -452,18 +474,32 @@ local function get_windows_sdk_directory()
452 -- see https://github.com/keplerproject/luarocks/pull/443#issuecomment-152792516 474 -- see https://github.com/keplerproject/luarocks/pull/443#issuecomment-152792516
453 local wsdks = { 475 local wsdks = {
454 ["MSVCR100"] = "v7.1", -- shipped with Visual Studio 2010 compilers. 476 ["MSVCR100"] = "v7.1", -- shipped with Visual Studio 2010 compilers.
477 ["MSVCR100D"] = "v7.1", -- shipped with Visual Studio 2010 compilers.
455 ["MSVCR90"] = "v6.1", -- shipped with Visual Studio 2008 compilers. 478 ["MSVCR90"] = "v6.1", -- shipped with Visual Studio 2008 compilers.
479 ["MSVCR90D"] = "v6.1", -- shipped with Visual Studio 2008 compilers.
456 } 480 }
457 local wsdkver = wsdks[vars.LUA_RUNTIME] 481 local wsdkver = wsdks[vars.LUA_RUNTIME]
458 if not wsdkver then 482 if not wsdkver then
483 print(S[[ Cannot auto-detect Windows SDK version from $LUA_RUNTIME]])
459 return nil 484 return nil
460 end 485 end
461 486
462 local key = "HKLM\\Software\\Microsoft\\Microsoft SDKs\\Windows\\"..wsdkver 487 local key = "HKLM\\Software\\Microsoft\\Microsoft SDKs\\Windows\\"..wsdkver
463 return get_registry(key, "InstallationFolder") 488 print(" checking: "..key)
489 local dir = get_registry(key, "InstallationFolder")
490 if dir then
491 print(" Found: "..dir)
492 return dir
493 end
494 print(" No SDK found")
495 return nil
464end 496end
497
465-- returns the batch command to setup msvc compiler path. 498-- returns the batch command to setup msvc compiler path.
499-- or an empty string (eg. "") if not found
466local function get_msvc_env_setup_cmd() 500local function get_msvc_env_setup_cmd()
501 print(S[[Looking for Microsoft toolchain matching runtime $LUA_RUNTIME and architecture $UNAME_M]])
502
467 assert(type(vars.UNAME_M) == "string", "requires vars.UNAME_M to be set before calling this function.") 503 assert(type(vars.UNAME_M) == "string", "requires vars.UNAME_M to be set before calling this function.")
468 local x64 = vars.UNAME_M=="x86_64" 504 local x64 = vars.UNAME_M=="x86_64"
469 505
@@ -493,7 +529,7 @@ local function get_msvc_env_setup_cmd()
493 end 529 end
494 end 530 end
495 531
496 -- finaly, we can't detect more, just don't setup the msvc compiler in luarocks.bat. 532 -- finally, we can't detect more, just don't setup the msvc compiler in luarocks.bat.
497 return "" 533 return ""
498end 534end
499 535
@@ -742,7 +778,7 @@ if SELFCONTAINED then
742 vars.TREE_ROOT = vars.PREFIX..[[\systree]] 778 vars.TREE_ROOT = vars.PREFIX..[[\systree]]
743 REGISTRY = false 779 REGISTRY = false
744end 780end
745vars.COMPILER_ENV_CMD = USE_MINGW and "" or get_msvc_env_setup_cmd() 781vars.COMPILER_ENV_CMD = (USE_MINGW and "") or (USE_MSVC_MANUAL and "") or get_msvc_env_setup_cmd()
746 782
747print(S[[ 783print(S[[
748 784
@@ -761,11 +797,20 @@ Lua interpreter : $LUA_BINDIR\$LUA_INTERPRETER
761 includes : $LUA_INCDIR 797 includes : $LUA_INCDIR
762 architecture: $UNAME_M 798 architecture: $UNAME_M
763 binary link : $LUA_LIBNAME with runtime $LUA_RUNTIME.dll 799 binary link : $LUA_LIBNAME with runtime $LUA_RUNTIME.dll
764
765]]) 800]])
766 801
802if USE_MINGW then
803 print("Compiler : MinGW (make sure it is in your path before using LuaRocks)")
804else
805 if vars.COMPILER_ENV_CMD == "" then
806 print("Compiler : Micorosft (make sure it is in your path before using LuaRocks)")
807 else
808 print(S[[Compiler : Microsoft, using; $COMPILER_ENV_CMD]])
809 end
810end
811
767if PROMPT then 812if PROMPT then
768 print("Press <ENTER> to start installing, or press <CTRL>+<C> to abort. Use install /? for installation options.") 813 print("\nPress <ENTER> to start installing, or press <CTRL>+<C> to abort. Use install /? for installation options.")
769 io.read() 814 io.read()
770end 815end
771 816