aboutsummaryrefslogtreecommitdiff
path: root/install.bat
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-06-13 12:10:59 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-06-13 12:29:06 +0300
commit9fa380490931813a153b1cb079c2b3c21092bacf (patch)
treecb0cafa825a7815810d13945d20808cc43869c03 /install.bat
parent0bed8bc1cf789ec3539469ed7d6ec437446b1b95 (diff)
parentf75295ee52bc2c335d12e82282d0f92a419a82d1 (diff)
downloadluarocks-9fa380490931813a153b1cb079c2b3c21092bacf.tar.gz
luarocks-9fa380490931813a153b1cb079c2b3c21092bacf.tar.bz2
luarocks-9fa380490931813a153b1cb079c2b3c21092bacf.zip
Merge branch 'master' into luarocks-3
Diffstat (limited to 'install.bat')
-rw-r--r--install.bat40
1 files changed, 25 insertions, 15 deletions
diff --git a/install.bat b/install.bat
index 053fdfd6..dcd132ff 100644
--- a/install.bat
+++ b/install.bat
@@ -55,7 +55,7 @@ local function die(message)
55 os.exit(1) 55 os.exit(1)
56end 56end
57 57
58function split_string(str, delim, maxNb) 58local function split_string(str, delim, maxNb)
59 -- Eliminate bad cases... 59 -- Eliminate bad cases...
60 if string.find(str, delim) == nil then 60 if string.find(str, delim) == nil then
61 return { str } 61 return { str }
@@ -508,17 +508,30 @@ local function get_msvc_env_setup_cmd()
508 -- 1. try visual studio command line tools 508 -- 1. try visual studio command line tools
509 local vcdir = get_visual_studio_directory() 509 local vcdir = get_visual_studio_directory()
510 if vcdir then 510 if vcdir then
511 -- 1.1. try vcvarsall.bat 511 local vcvars_bats = {
512 local vcvarsall = vcdir .. 'vcvarsall.bat' 512 x86 = {
513 if exists(vcvarsall) then 513 "bin\\vcvars32.bat", -- prefers native compiler
514 return ('call "%s"%s'):format(vcvarsall, x64 and ' amd64' or '') 514 "bin\\amd64_x86\\vcvarsamd64_x86.bat"-- then cross compiler
515 },
516 x86_64 = {
517 "bin\\amd64\\vcvars64.bat", -- prefers native compiler
518 "bin\\x86_amd64\\vcvarsx86_amd64.bat" -- then cross compiler
519 }
520 }
521 assert(vcvars_bats[vars.UNAME_M], "vars.UNAME_M: only x86 and x86_64 are supported")
522 for _, bat in ipairs(vcvars_bats[vars.UNAME_M]) do
523 local full_path = vcdir .. bat
524 if exists(full_path) then
525 return ('call "%s"'):format(full_path)
526 end
515 end 527 end
516 528
517 -- 1.2. try vcvars32.bat / vcvars64.bat 529 -- try vcvarsall.bat in case MS changes the undocumented bat files above.
518 local relative_path = x64 and "bin\\amd64\\vcvars64.bat" or "bin\\vcvars32.bat" 530 -- but this way we don't konw if specified compiler is installed...
519 local full_path = vcdir .. relative_path 531 local vcvarsall = vcdir .. 'vcvarsall.bat'
520 if exists(full_path) then 532 if exists(vcvarsall) then
521 return ('call "%s"'):format(full_path) 533 local vcvarsall_args = { x86 = "", x86_64 = " amd64" }
534 return ('call "%s"%s'):format(vcvarsall, vcvarsall_args[vars.UNAME_M])
522 end 535 end
523 end 536 end
524 537
@@ -543,8 +556,7 @@ local function look_for_lua_install ()
543 else 556 else
544 -- no prefix given, so use path 557 -- no prefix given, so use path
545 directories = (os.getenv("PATH",";") or "") 558 directories = (os.getenv("PATH",";") or "")
546 local i = 1 559 directories = directories:gsub(";+", ";") --remove all doubles
547 while i ~= 0 do directories, i = directories:gsub(";;",";") end --remove all doubles
548 directories = split_string(directories,";") 560 directories = split_string(directories,";")
549 -- if a path element ends with "\bin\" then remove it, as the searcher will check there anyway 561 -- if a path element ends with "\bin\" then remove it, as the searcher will check there anyway
550 for i, val in ipairs(directories) do 562 for i, val in ipairs(directories) do
@@ -651,7 +663,7 @@ local with_arg = { -- options followed by an argument, others are flags
651-- this will be damaged by the batch construction at the start of this file 663-- this will be damaged by the batch construction at the start of this file
652local oarg = arg -- retain old table 664local oarg = arg -- retain old table
653if #arg > 0 then 665if #arg > 0 then
654 farg = table.concat(arg, " ") .. " " 666 local farg = table.concat(arg, " ") .. " "
655 arg = {} 667 arg = {}
656 farg = farg:gsub('%"', "") 668 farg = farg:gsub('%"', "")
657 local i = 0 669 local i = 0
@@ -672,7 +684,6 @@ if #arg > 0 then
672 end 684 end
673end 685end
674for k,v in pairs(oarg) do if k < 1 then arg[k] = v end end -- copy 0 and negative indexes 686for k,v in pairs(oarg) do if k < 1 then arg[k] = v end end -- copy 0 and negative indexes
675oarg = nil
676 687
677-- build config option table with name and value elements 688-- build config option table with name and value elements
678local i = 1 689local i = 1
@@ -771,7 +782,6 @@ if not vars.TREE_ROOT then
771 end 782 end
772end 783end
773 784
774local datapath
775vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX 785vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX
776vars.SYSCONFFILENAME = S"config-$LUA_VERSION.lua" 786vars.SYSCONFFILENAME = S"config-$LUA_VERSION.lua"
777vars.CONFIG_FILE = vars.SYSCONFDIR.."\\"..vars.SYSCONFFILENAME 787vars.CONFIG_FILE = vars.SYSCONFDIR.."\\"..vars.SYSCONFFILENAME