diff options
-rw-r--r-- | install.bat | 82 | ||||
-rw-r--r-- | src/luarocks/fs/unix/tools.lua | 2 |
2 files changed, 54 insertions, 30 deletions
diff --git a/install.bat b/install.bat index 85ef73f6..ddcbc71a 100644 --- a/install.bat +++ b/install.bat | |||
@@ -8,8 +8,10 @@ local vars = {} | |||
8 | vars.PREFIX = nil | 8 | vars.PREFIX = nil |
9 | vars.VERSION = "2.1" | 9 | vars.VERSION = "2.1" |
10 | vars.SYSCONFDIR = nil | 10 | vars.SYSCONFDIR = nil |
11 | vars.ROCKS_TREE = nil | 11 | vars.TREE_ROOT = nil |
12 | vars.SCRIPTS_DIR = nil | 12 | vars.TREE_BIN = nil |
13 | vars.TREE_LMODULE = nil | ||
14 | vars.TREE_CMODULE = nil | ||
13 | vars.LUA_INTERPRETER = nil | 15 | vars.LUA_INTERPRETER = nil |
14 | vars.LUA_PREFIX = nil | 16 | vars.LUA_PREFIX = nil |
15 | vars.LUA_BINDIR = nil | 17 | vars.LUA_BINDIR = nil |
@@ -126,7 +128,11 @@ Configuring the destinations: | |||
126 | /TREE [dir] Root of the local tree of installed rocks. | 128 | /TREE [dir] Root of the local tree of installed rocks. |
127 | Default is %PROGRAMFILES%\LuaRocks\systree | 129 | Default is %PROGRAMFILES%\LuaRocks\systree |
128 | /SCRIPTS [dir] Where to install commandline scripts installed by | 130 | /SCRIPTS [dir] Where to install commandline scripts installed by |
129 | rocks. Default is {TREE}/bin. | 131 | rocks. Default is {TREE}\bin. |
132 | /LUAMOD [dir] Where to install Lua modules installed by rocks. | ||
133 | Default is {TREE}\share\lua\{LV}. | ||
134 | /CMOD [dir] Where to install c modules installed by rocks. | ||
135 | Default is {TREE}\lib\lua\{LV}. | ||
130 | /CONFIG [dir] Location where the config file should be installed. | 136 | /CONFIG [dir] Location where the config file should be installed. |
131 | Default is to follow /P option | 137 | Default is to follow /P option |
132 | /SELFCONTAINED Creates a self contained installation in a single | 138 | /SELFCONTAINED Creates a self contained installation in a single |
@@ -193,9 +199,13 @@ local function parse_options(args) | |||
193 | elseif name == "/CONFIG" then | 199 | elseif name == "/CONFIG" then |
194 | vars.SYSCONFDIR = option.value | 200 | vars.SYSCONFDIR = option.value |
195 | elseif name == "/TREE" then | 201 | elseif name == "/TREE" then |
196 | vars.ROCKS_TREE = option.value | 202 | vars.TREE_ROOT = option.value |
197 | elseif name == "/SCRIPTS" then | 203 | elseif name == "/SCRIPTS" then |
198 | vars.SCRIPTS_DIR = option.value | 204 | vars.TREE_BIN = option.value |
205 | elseif name == "/LUAMOD" then | ||
206 | vars.TREE_LMODULE = option.value | ||
207 | elseif name == "/CMOD" then | ||
208 | vars.TREE_CMODULE = option.value | ||
199 | elseif name == "/LV" then | 209 | elseif name == "/LV" then |
200 | vars.LUA_VERSION = option.value | 210 | vars.LUA_VERSION = option.value |
201 | elseif name == "/L" then | 211 | elseif name == "/L" then |
@@ -234,8 +244,8 @@ local function check_flags() | |||
234 | if not vars.PREFIX then | 244 | if not vars.PREFIX then |
235 | die("Option /P is required when using /SELFCONTAINED") | 245 | die("Option /P is required when using /SELFCONTAINED") |
236 | end | 246 | end |
237 | if vars.SYSCONFDIR or vars.ROCKS_TREE or vars.SCRIPTS_DIR then | 247 | if vars.SYSCONFDIR or vars.TREE_ROOT or vars.TREE_BIN or vars.TREE_LMODULE or vars.TREE_CMODULE then |
238 | die("Cannot combine /TREE, /SCRIPTS or /CONFIG with /SELFCONTAINED") | 248 | die("Cannot combine /TREE, /SCRIPTS, /LUAMOD, /CMOD, or /CONFIG with /SELFCONTAINED") |
239 | end | 249 | end |
240 | end | 250 | end |
241 | if INSTALL_LUA then | 251 | if INSTALL_LUA then |
@@ -472,6 +482,8 @@ local with_arg = { -- options followed by an argument, others are flags | |||
472 | ["/CONFIG"] = true, | 482 | ["/CONFIG"] = true, |
473 | ["/TREE"] = true, | 483 | ["/TREE"] = true, |
474 | ["/SCRIPTS"] = true, | 484 | ["/SCRIPTS"] = true, |
485 | ["/LUAMOD"] = true, | ||
486 | ["/CMOD"] = true, | ||
475 | ["/LV"] = true, | 487 | ["/LV"] = true, |
476 | ["/LUA"] = true, | 488 | ["/LUA"] = true, |
477 | ["/INC"] = true, | 489 | ["/INC"] = true, |
@@ -598,10 +610,10 @@ else | |||
598 | datapath = os.getenv("ProgramW6432") .. [[\LuaRocks]] | 610 | datapath = os.getenv("ProgramW6432") .. [[\LuaRocks]] |
599 | end | 611 | end |
600 | vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX | 612 | vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX |
601 | vars.ROCKS_TREE = vars.ROCKS_TREE or datapath..[[\systree]] | 613 | vars.TREE_ROOT = vars.TREE_ROOT or datapath..[[\systree]] |
602 | if SELFCONTAINED then | 614 | if SELFCONTAINED then |
603 | vars.SYSCONFDIR = vars.PREFIX | 615 | vars.SYSCONFDIR = vars.PREFIX |
604 | vars.ROCKS_TREE = vars.PREFIX..[[\systree]] | 616 | vars.TREE_ROOT = vars.PREFIX..[[\systree]] |
605 | REGISTRY = false | 617 | REGISTRY = false |
606 | end | 618 | end |
607 | 619 | ||
@@ -614,7 +626,7 @@ print(S[[ | |||
614 | Will configure LuaRocks with the following paths: | 626 | Will configure LuaRocks with the following paths: |
615 | LuaRocks : $FULL_PREFIX | 627 | LuaRocks : $FULL_PREFIX |
616 | Config file : $SYSCONFDIR\config.lua | 628 | Config file : $SYSCONFDIR\config.lua |
617 | Rocktree : $ROCKS_TREE | 629 | Rocktree : $TREE_ROOT |
618 | 630 | ||
619 | Lua interpreter : $LUA_BINDIR\$LUA_INTERPRETER | 631 | Lua interpreter : $LUA_BINDIR\$LUA_INTERPRETER |
620 | binaries : $LUA_BINDIR | 632 | binaries : $LUA_BINDIR |
@@ -756,19 +768,19 @@ end | |||
756 | -- see https://github.com/keplerproject/luarocks/pull/197#issuecomment-30176548 | 768 | -- see https://github.com/keplerproject/luarocks/pull/197#issuecomment-30176548 |
757 | 769 | ||
758 | -- configure 'scripts' directory | 770 | -- configure 'scripts' directory |
759 | -- if vars.SCRIPTS_DIR then | 771 | -- if vars.TREE_BIN then |
760 | -- mkdir(vars.SCRIPTS_DIR) | 772 | -- mkdir(vars.TREE_BIN) |
761 | -- if not USE_MINGW then | 773 | -- if not USE_MINGW then |
762 | -- -- definitly not for MinGW because of conflicting runtimes | 774 | -- -- definitly not for MinGW because of conflicting runtimes |
763 | -- -- but is it ok to do it for others??? | 775 | -- -- but is it ok to do it for others??? |
764 | -- exec(S[[COPY lua5.1\bin\*.dll "$SCRIPTS_DIR" >NUL]]) | 776 | -- exec(S[[COPY lua5.1\bin\*.dll "$TREE_BIN" >NUL]]) |
765 | -- end | 777 | -- end |
766 | -- else | 778 | -- else |
767 | -- if not USE_MINGW then | 779 | -- if not USE_MINGW then |
768 | -- mkdir(S[[$ROCKS_TREE\bin]]) | 780 | -- mkdir(S[[$TREE_ROOT\bin]]) |
769 | -- -- definitly not for MinGW because of conflicting runtimes | 781 | -- -- definitly not for MinGW because of conflicting runtimes |
770 | -- -- but is it ok to do it for others??? | 782 | -- -- but is it ok to do it for others??? |
771 | -- exec(S[[COPY lua5.1\bin\*.dll "$ROCKS_TREE"\bin >NUL]]) | 783 | -- exec(S[[COPY lua5.1\bin\*.dll "$TREE_ROOT"\bin >NUL]]) |
772 | -- end | 784 | -- end |
773 | -- end | 785 | -- end |
774 | 786 | ||
@@ -799,7 +811,7 @@ end | |||
799 | f:write(S[=[ | 811 | f:write(S[=[ |
800 | site_config.LUAROCKS_UNAME_M=[[$UNAME_M]] | 812 | site_config.LUAROCKS_UNAME_M=[[$UNAME_M]] |
801 | site_config.LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] | 813 | site_config.LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] |
802 | site_config.LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]] | 814 | site_config.LUAROCKS_ROCKS_TREE=[[$TREE_ROOT]] |
803 | site_config.LUAROCKS_PREFIX=[[$PREFIX]] | 815 | site_config.LUAROCKS_PREFIX=[[$PREFIX]] |
804 | site_config.LUAROCKS_DOWNLOADER=[[wget]] | 816 | site_config.LUAROCKS_DOWNLOADER=[[wget]] |
805 | site_config.LUAROCKS_MD5CHECKER=[[md5sum]] | 817 | site_config.LUAROCKS_MD5CHECKER=[[md5sum]] |
@@ -836,12 +848,22 @@ rocks_trees = { | |||
836 | if FORCE_CONFIG then | 848 | if FORCE_CONFIG then |
837 | f:write(" home..[[/luarocks]],\n") | 849 | f:write(" home..[[/luarocks]],\n") |
838 | end | 850 | end |
839 | f:write(S" { name = [[user]], root = home..[[/luarocks]] },\n") | 851 | f:write(S" { name = [[user]],\n") |
840 | f:write(S" { name = [[system]], root = [[$ROCKS_TREE]] },\n") | 852 | f:write(S" root = home..[[/luarocks]],\n") |
841 | f:write("}\n") | 853 | f:write(S" },\n") |
842 | if vars.SCRIPTS_DIR then | 854 | f:write(S" { name = [[system]],\n") |
843 | f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n") | 855 | f:write(S" root = [[$TREE_ROOT]],\n") |
856 | if vars.TREE_BIN then | ||
857 | f:write(S" bin_dir = [[$TREE_BIN]],\n") | ||
858 | end | ||
859 | if vars.TREE_CMODULE then | ||
860 | f:write(S" lib_dir = [[$TREE_CMODULE]],\n") | ||
861 | end | ||
862 | if vars.TREE_LMODULE then | ||
863 | f:write(S" lua_dir = [[$TREE_LMODULE]],\n") | ||
844 | end | 864 | end |
865 | f:write(S" },\n") | ||
866 | f:write("}\n") | ||
845 | f:write("variables = {\n") | 867 | f:write("variables = {\n") |
846 | if USE_MINGW and vars.LUA_RUNTIME == "MSVCRT" then | 868 | if USE_MINGW and vars.LUA_RUNTIME == "MSVCRT" then |
847 | f:write(" MSVCRT = 'm', -- make MinGW use MSVCRT.DLL as runtime\n") | 869 | f:write(" MSVCRT = 'm', -- make MinGW use MSVCRT.DLL as runtime\n") |
@@ -858,11 +880,11 @@ print(S"Created LuaRocks config file: $CONFIG_FILE") | |||
858 | 880 | ||
859 | print() | 881 | print() |
860 | print("Creating rocktrees...") | 882 | print("Creating rocktrees...") |
861 | if not exists(vars.ROCKS_TREE) then | 883 | if not exists(vars.TREE_ROOT) then |
862 | mkdir(vars.ROCKS_TREE) | 884 | mkdir(vars.TREE_ROOT) |
863 | print(S[[Created system rocktree : "$ROCKS_TREE"]]) | 885 | print(S[[Created system rocktree : "$TREE_ROOT"]]) |
864 | else | 886 | else |
865 | print(S[[System rocktree exists : "$ROCKS_TREE"]]) | 887 | print(S[[System rocktree exists : "$TREE_ROOT"]]) |
866 | end | 888 | end |
867 | 889 | ||
868 | vars.APPDATA = os.getenv("APPDATA") | 890 | vars.APPDATA = os.getenv("APPDATA") |
@@ -894,7 +916,9 @@ exec( S[[del "$FULL_PREFIX\pe-parser.lua" >NUL]] ) | |||
894 | -- *********************************************************** | 916 | -- *********************************************************** |
895 | -- Exit handlers | 917 | -- Exit handlers |
896 | -- *********************************************************** | 918 | -- *********************************************************** |
897 | 919 | vars.TREE_BIN = vars.TREE_BIN or vars.TREE_ROOT..[[\bin]] | |
920 | vars.TREE_LMODULE = vars.TREE_LMODULE or vars.TREE_ROOT..[[\share\lua\]]..vars.LUA_VERSION | ||
921 | vars.TREE_CMODULE = vars.TREE_CMODULE or vars.TREE_ROOT..[[\lib\lua\]]..vars.LUA_VERSION | ||
898 | print(S[[ | 922 | print(S[[ |
899 | 923 | ||
900 | ============================ | 924 | ============================ |
@@ -914,9 +938,9 @@ Local user rocktree (Note: %APPDATA% is user dependent); | |||
914 | LUA_PATH : %APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?.lua;%APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?\init.lua | 938 | LUA_PATH : %APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?.lua;%APPDATA%\LuaRocks\share\lua\$LUA_VERSION\?\init.lua |
915 | LUA_CPATH: %APPDATA%\LuaRocks\lib\lua\$LUA_VERSION\?.dll | 939 | LUA_CPATH: %APPDATA%\LuaRocks\lib\lua\$LUA_VERSION\?.dll |
916 | System rocktree | 940 | System rocktree |
917 | PATH : $ROCKS_TREE\bin | 941 | PATH : $TREE_BIN |
918 | LUA_PATH : $ROCKS_TREE\share\lua\$LUA_VERSION\?.lua;$ROCKS_TREE\share\lua\$LUA_VERSION\?\init.lua | 942 | LUA_PATH : $TREE_LMODULE\?.lua;$TREE_LMODULE\?\init.lua |
919 | LUA_CPATH: $ROCKS_TREE\lib\lua\$LUA_VERSION\?.dll | 943 | LUA_CPATH: $TREE_CMODULE\?.dll |
920 | 944 | ||
921 | Note that the %APPDATA% element in the paths above is user specific and it MUST be replaced by its actual value. | 945 | Note that the %APPDATA% element in the paths above is user specific and it MUST be replaced by its actual value. |
922 | For the current user that value is: $APPDATA. | 946 | For the current user that value is: $APPDATA. |
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index f8f39eca..69466931 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
@@ -264,7 +264,7 @@ function tools.download(url, filename, cache) | |||
264 | elseif cfg.downloader == "curl" then | 264 | elseif cfg.downloader == "curl" then |
265 | local curl_cmd = fs.Q(vars.CURL).." -f -k -L --user-agent '"..cfg.user_agent.." via curl' " | 265 | local curl_cmd = fs.Q(vars.CURL).." -f -k -L --user-agent '"..cfg.user_agent.." via curl' " |
266 | if cfg.connection_timeout and cfg.connection_timeout > 0 then | 266 | if cfg.connection_timeout and cfg.connection_timeout > 0 then |
267 | curl_cmd = curl_cmd .. "--connect-timeout="..tonumber(cfg.connection_timeout).." " | 267 | curl_cmd = curl_cmd .. "--connect-timeout "..tonumber(cfg.connection_timeout).." " |
268 | end | 268 | end |
269 | ok = fs.execute_string(curl_cmd..fs.Q(url).." 2> /dev/null 1> "..fs.Q(filename)) | 269 | ok = fs.execute_string(curl_cmd..fs.Q(url).." 2> /dev/null 1> "..fs.Q(filename)) |
270 | end | 270 | end |