diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-06-13 12:10:59 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-06-13 12:29:06 +0300 |
commit | 9fa380490931813a153b1cb079c2b3c21092bacf (patch) | |
tree | cb0cafa825a7815810d13945d20808cc43869c03 /install.bat | |
parent | 0bed8bc1cf789ec3539469ed7d6ec437446b1b95 (diff) | |
parent | f75295ee52bc2c335d12e82282d0f92a419a82d1 (diff) | |
download | luarocks-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.bat | 40 |
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) |
56 | end | 56 | end |
57 | 57 | ||
58 | function split_string(str, delim, maxNb) | 58 | local 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 |
652 | local oarg = arg -- retain old table | 664 | local oarg = arg -- retain old table |
653 | if #arg > 0 then | 665 | if #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 |
673 | end | 685 | end |
674 | for k,v in pairs(oarg) do if k < 1 then arg[k] = v end end -- copy 0 and negative indexes | 686 | for k,v in pairs(oarg) do if k < 1 then arg[k] = v end end -- copy 0 and negative indexes |
675 | oarg = nil | ||
676 | 687 | ||
677 | -- build config option table with name and value elements | 688 | -- build config option table with name and value elements |
678 | local i = 1 | 689 | local i = 1 |
@@ -771,7 +782,6 @@ if not vars.TREE_ROOT then | |||
771 | end | 782 | end |
772 | end | 783 | end |
773 | 784 | ||
774 | local datapath | ||
775 | vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX | 785 | vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX |
776 | vars.SYSCONFFILENAME = S"config-$LUA_VERSION.lua" | 786 | vars.SYSCONFFILENAME = S"config-$LUA_VERSION.lua" |
777 | vars.CONFIG_FILE = vars.SYSCONFDIR.."\\"..vars.SYSCONFFILENAME | 787 | vars.CONFIG_FILE = vars.SYSCONFDIR.."\\"..vars.SYSCONFFILENAME |