aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.bat92
1 files changed, 60 insertions, 32 deletions
diff --git a/install.bat b/install.bat
index f6601aa8..02a3f013 100644
--- a/install.bat
+++ b/install.bat
@@ -65,21 +65,20 @@ local function print_help()
65 print(S[[ 65 print(S[[
66Installs LuaRocks. 66Installs LuaRocks.
67 67
68/P [dir] (REQUIRED) Where to install. 68/P [dir] (REQUIRED) Where to install LuaRocks.
69 Note that version; $VERSION, will be 69 Note that version; $VERSION, will be appended to this
70 appended to this path. 70 path, so "/P c:\luarocks\" will install in
71/CONFIG [dir] Location where the config file should be installed. 71 "c:\luarocks\$VERSION\"
72 Default is same place of installation 72
73Configuring the destinations:
73/TREE [dir] Root of the local tree of installed rocks. 74/TREE [dir] Root of the local tree of installed rocks.
74 Default is same place of installation 75 Default is same place of installation
75/SCRIPTS [dir] Where to install scripts installed by rocks. 76/SCRIPTS [dir] Where to install commandline scripts installed by
76 Default is TREE/bin. 77 rocks. Default is TREE/bin.
77 78
79Configuring the Lua interpreter:
78/LV [version] Lua version to use; either 5.1 or 5.2. 80/LV [version] Lua version to use; either 5.1 or 5.2.
79 Default is 5.1 81 Default is 5.1
80/L Install LuaRocks' own copy of Lua even if detected,
81 this will always be a 5.1 installation.
82 (/LUA, /INC, /LIB, /BIN cannot be used with /L)
83/LUA [dir] Location where Lua is installed - e.g. c:\lua\5.1\ 82/LUA [dir] Location where Lua is installed - e.g. c:\lua\5.1\
84 This is the base directory, the installer will look 83 This is the base directory, the installer will look
85 for subdirectories bin, lib, include. Alternatively 84 for subdirectories bin, lib, include. Alternatively
@@ -87,20 +86,25 @@ Installs LuaRocks.
87 /LIB, and /BIN options. 86 /LIB, and /BIN options.
88/INC [dir] Location of Lua includes - e.g. c:\lua\5.1\include 87/INC [dir] Location of Lua includes - e.g. c:\lua\5.1\include
89 If provided overrides sub directory found using /LUA. 88 If provided overrides sub directory found using /LUA.
90/LIB [dir] Location of Lua libraries -e.g. c:\lua\5.1\lib 89/LIB [dir] Location of Lua libraries (.dll) - e.g. c:\lua\5.1\lib
91 If provided overrides sub directory found using /LUA. 90 If provided overrides sub directory found using /LUA.
92/BIN [dir] Location of Lua executables - e.g. c:\lua\5.1\bin 91/BIN [dir] Location of Lua executables - e.g. c:\lua\5.1\bin
93 If provided overrides sub directory found using /LUA. 92 If provided overrides sub directory found using /LUA.
93/L Install LuaRocks' own copy of Lua even if detected,
94 this will always be a 5.1 installation.
95 (/LUA, /INC, /LIB, /BIN cannot be used with /L)
94 96
97Compiler configuration:
95/MW Use mingw as build system instead of MSVC 98/MW Use mingw as build system instead of MSVC
96 99
100Other options:
101/CONFIG [dir] Location where the config file should be installed.
102 Default is same place of installation
97/FORCECONFIG Use a single config location. Do not use the 103/FORCECONFIG Use a single config location. Do not use the
98 LUAROCKS_CONFIG variable or the user's home directory. 104 LUAROCKS_CONFIG variable or the user's home directory.
99 Useful to avoid conflicts when LuaRocks 105 Useful to avoid conflicts when LuaRocks
100 is embedded within an application. 106 is embedded within an application.
101
102/F Remove installation directory if it already exists. 107/F Remove installation directory if it already exists.
103
104/R Load registry information to register '.rockspec' 108/R Load registry information to register '.rockspec'
105 extension with LuaRocks commands (right-click). 109 extension with LuaRocks commands (right-click).
106 110
@@ -197,7 +201,7 @@ local function look_for_interpreter (directory)
197 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") 201 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER")
198 return true 202 return true
199 end 203 end
200 die(S"Lua executable lua.exe, luajit.exe or lua$LUA_VERSION.exe not found in $LUA_BINDIR") 204 die(S"Lua executable lua.exe, luajit.exe, lua$LUA_SHORTV.exe or lua$LUA_VERSION.exe not found in $LUA_BINDIR")
201 end 205 end
202 206
203 for _, e in ipairs{ [[\]], [[\bin\]] } do 207 for _, e in ipairs{ [[\]], [[\bin\]] } do
@@ -280,31 +284,31 @@ end
280 284
281 285
282local function get_runtime() 286local function get_runtime()
283 local f 287 local f
284 vars.LUA_RUNTIME, f = pe.msvcrt(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER) 288 vars.LUA_RUNTIME, f = pe.msvcrt(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER)
285 if type(vars.LUA_RUNTIME) ~= "string" then 289 if type(vars.LUA_RUNTIME) ~= "string" then
286 -- analysis failed, issue a warning 290 -- analysis failed, issue a warning
287 vars.LUA_RUNTIME = "MSVCR80" 291 vars.LUA_RUNTIME = "MSVCR80"
288 print("*** WARNING ***: could not analyse the runtime used, defaulting to "..vars.LUA_RUNTIME) 292 print("*** WARNING ***: could not analyse the runtime used, defaulting to "..vars.LUA_RUNTIME)
289 else 293 else
290 print(" "..f.." uses "..vars.LUA_RUNTIME..".DLL as runtime") 294 print(" "..f.." uses "..vars.LUA_RUNTIME..".DLL as runtime")
291 end 295 end
292 return true 296 return true
293end 297end
294 298
295local function get_architecture() 299local function get_architecture()
296 -- detect processor arch interpreter was compiled for 300 -- detect processor arch interpreter was compiled for
297 local proc = (pe.parse(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER) or {}).Machine 301 local proc = (pe.parse(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER) or {}).Machine
298 if not proc then 302 if not proc then
299 die("Could not detect processor architecture used in "..vars.LUA_INTERPRETER) 303 die("Could not detect processor architecture used in "..vars.LUA_INTERPRETER)
300 end 304 end
301 proc = pe.const.Machine[proc] -- collect name from constant value 305 proc = pe.const.Machine[proc] -- collect name from constant value
302 if proc == "IMAGE_FILE_MACHINE_I386" then 306 if proc == "IMAGE_FILE_MACHINE_I386" then
303 proc = "x86" 307 proc = "x86"
304 else 308 else
305 proc = "x86_64" 309 proc = "x86_64"
306 end 310 end
307 return proc 311 return proc
308end 312end
309 313
310local function look_for_lua_install () 314local function look_for_lua_install ()
@@ -369,10 +373,34 @@ local with_arg = { -- options followed by an argument, others are flags
369 ["/BIN"] = true, 373 ["/BIN"] = true,
370 ["/LIB"] = true, 374 ["/LIB"] = true,
371} 375}
376-- reconstruct argument values with spaces and double quotes
377-- this will be damaged by the batch construction at the start of this file
378if #arg > 0 then
379 farg = table.concat(arg, " ") .. " "
380 arg = {}
381 farg = farg:gsub('%"', "")
382 local i = 0
383 while #farg>0 do
384 i = i + 1
385 if (farg:sub(1,1) ~= "/") and ((arg[i-1] or ""):sub(1,1) ~= "/") then
386 i = i - 1 -- continued previous arg
387 if i == 0 then i = 1 end
388 end
389 if arg[i] then
390 arg[i] = arg[i] .. " "
391 else
392 arg[i] = ""
393 end
394 local v,r = farg:match("^(.-)%s(.*)$")
395 arg[i], farg = arg[i]..v, r
396 while farg:sub(1,1) == " " do farg = farg:sub(2,-1) end -- remove prefix spaces
397 end
398end
399
372local i = 1 400local i = 1
373while i <= #arg do 401while i <= #arg do
374 local opt = arg[i] 402 local opt = arg[i]
375 if with_arg[opt] then 403 if with_arg[opt:upper()] then
376 local value = arg[i + 1] 404 local value = arg[i + 1]
377 if not value then 405 if not value then
378 die("Missing value for option "..opt) 406 die("Missing value for option "..opt)
@@ -409,10 +437,10 @@ if not look_for_lua_install() then
409 vars.LUA_LIBDIR = vars.LIBDIR 437 vars.LUA_LIBDIR = vars.LIBDIR
410 vars.LUA_INCDIR = vars.INCDIR 438 vars.LUA_INCDIR = vars.INCDIR
411 vars.LUA_LIBNAME = "lua5.1.lib" 439 vars.LUA_LIBNAME = "lua5.1.lib"
412 vars.LUA_RUNTIME = "MSVCR80" 440 vars.LUA_RUNTIME = "MSVCR80"
413 vars.UNAME_M = "x86" 441 vars.UNAME_M = "x86"
414else 442else
415 vars.UNAME_M = get_architecture() 443 vars.UNAME_M = get_architecture()
416 print(S[[ 444 print(S[[
417 445
418Will configure LuaRocks with the following paths: 446Will configure LuaRocks with the following paths: