aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.bat82
-rw-r--r--src/luarocks/fs/unix/tools.lua2
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 = {}
8vars.PREFIX = nil 8vars.PREFIX = nil
9vars.VERSION = "2.1" 9vars.VERSION = "2.1"
10vars.SYSCONFDIR = nil 10vars.SYSCONFDIR = nil
11vars.ROCKS_TREE = nil 11vars.TREE_ROOT = nil
12vars.SCRIPTS_DIR = nil 12vars.TREE_BIN = nil
13vars.TREE_LMODULE = nil
14vars.TREE_CMODULE = nil
13vars.LUA_INTERPRETER = nil 15vars.LUA_INTERPRETER = nil
14vars.LUA_PREFIX = nil 16vars.LUA_PREFIX = nil
15vars.LUA_BINDIR = nil 17vars.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]]
599end 611end
600vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX 612vars.SYSCONFDIR = vars.SYSCONFDIR or vars.PREFIX
601vars.ROCKS_TREE = vars.ROCKS_TREE or datapath..[[\systree]] 613vars.TREE_ROOT = vars.TREE_ROOT or datapath..[[\systree]]
602if SELFCONTAINED then 614if 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
606end 618end
607 619
@@ -614,7 +626,7 @@ print(S[[
614Will configure LuaRocks with the following paths: 626Will configure LuaRocks with the following paths:
615LuaRocks : $FULL_PREFIX 627LuaRocks : $FULL_PREFIX
616Config file : $SYSCONFDIR\config.lua 628Config file : $SYSCONFDIR\config.lua
617Rocktree : $ROCKS_TREE 629Rocktree : $TREE_ROOT
618 630
619Lua interpreter : $LUA_BINDIR\$LUA_INTERPRETER 631Lua 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
799f:write(S[=[ 811f:write(S[=[
800site_config.LUAROCKS_UNAME_M=[[$UNAME_M]] 812site_config.LUAROCKS_UNAME_M=[[$UNAME_M]]
801site_config.LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] 813site_config.LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]]
802site_config.LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]] 814site_config.LUAROCKS_ROCKS_TREE=[[$TREE_ROOT]]
803site_config.LUAROCKS_PREFIX=[[$PREFIX]] 815site_config.LUAROCKS_PREFIX=[[$PREFIX]]
804site_config.LUAROCKS_DOWNLOADER=[[wget]] 816site_config.LUAROCKS_DOWNLOADER=[[wget]]
805site_config.LUAROCKS_MD5CHECKER=[[md5sum]] 817site_config.LUAROCKS_MD5CHECKER=[[md5sum]]
@@ -836,12 +848,22 @@ rocks_trees = {
836if FORCE_CONFIG then 848if FORCE_CONFIG then
837 f:write(" home..[[/luarocks]],\n") 849 f:write(" home..[[/luarocks]],\n")
838end 850end
839f:write(S" { name = [[user]], root = home..[[/luarocks]] },\n") 851f:write(S" { name = [[user]],\n")
840f:write(S" { name = [[system]], root = [[$ROCKS_TREE]] },\n") 852f:write(S" root = home..[[/luarocks]],\n")
841f:write("}\n") 853f:write(S" },\n")
842if vars.SCRIPTS_DIR then 854f:write(S" { name = [[system]],\n")
843 f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n") 855f:write(S" root = [[$TREE_ROOT]],\n")
856if vars.TREE_BIN then
857 f:write(S" bin_dir = [[$TREE_BIN]],\n")
858end
859if vars.TREE_CMODULE then
860 f:write(S" lib_dir = [[$TREE_CMODULE]],\n")
861end
862if vars.TREE_LMODULE then
863 f:write(S" lua_dir = [[$TREE_LMODULE]],\n")
844end 864end
865f:write(S" },\n")
866f:write("}\n")
845f:write("variables = {\n") 867f:write("variables = {\n")
846if USE_MINGW and vars.LUA_RUNTIME == "MSVCRT" then 868if 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
859print() 881print()
860print("Creating rocktrees...") 882print("Creating rocktrees...")
861if not exists(vars.ROCKS_TREE) then 883if 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"]])
864else 886else
865 print(S[[System rocktree exists : "$ROCKS_TREE"]]) 887 print(S[[System rocktree exists : "$TREE_ROOT"]])
866end 888end
867 889
868vars.APPDATA = os.getenv("APPDATA") 890vars.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 919vars.TREE_BIN = vars.TREE_BIN or vars.TREE_ROOT..[[\bin]]
920vars.TREE_LMODULE = vars.TREE_LMODULE or vars.TREE_ROOT..[[\share\lua\]]..vars.LUA_VERSION
921vars.TREE_CMODULE = vars.TREE_CMODULE or vars.TREE_ROOT..[[\lib\lua\]]..vars.LUA_VERSION
898print(S[[ 922print(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
916System rocktree 940System 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
921Note that the %APPDATA% element in the paths above is user specific and it MUST be replaced by its actual value. 945Note that the %APPDATA% element in the paths above is user specific and it MUST be replaced by its actual value.
922For the current user that value is: $APPDATA. 946For 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