aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.bat66
1 files changed, 50 insertions, 16 deletions
diff --git a/install.bat b/install.bat
index f6d6f842..ed2a49ff 100644
--- a/install.bat
+++ b/install.bat
@@ -5,10 +5,10 @@ rem=rem --[[
5local vars = {} 5local vars = {}
6 6
7 7
8vars.PREFIX = os.getenv("PROGRAMFILES")..[[\LuaRocks]] 8vars.PREFIX = nil
9vars.VERSION = "2.1" 9vars.VERSION = "2.1"
10vars.SYSCONFDIR = (os.getenv("PROGRAMDATA") or (os.getenv("ALLUSERSPROFILE")..[[\Application Data]])) .. [[\LuaRocks]] -- ALLUSERS for WinXP compat 10vars.SYSCONFDIR = nil
11vars.ROCKS_TREE = vars.SYSCONFDIR 11vars.ROCKS_TREE = nil
12vars.SCRIPTS_DIR = nil 12vars.SCRIPTS_DIR = nil
13vars.LUA_INTERPRETER = nil 13vars.LUA_INTERPRETER = nil
14vars.LUA_PREFIX = nil 14vars.LUA_PREFIX = nil
@@ -26,9 +26,10 @@ local FORCE = false
26local FORCE_CONFIG = false 26local FORCE_CONFIG = false
27local INSTALL_LUA = false 27local INSTALL_LUA = false
28local USE_MINGW = false 28local USE_MINGW = false
29local REGISTRY = false 29local REGISTRY = true
30local NOADMIN = false 30local NOADMIN = false
31local PROMPT = true 31local PROMPT = true
32local SELFCONTAINED = false
32 33
33--- 34---
34-- Some helpers 35-- Some helpers
@@ -120,10 +121,19 @@ Installs LuaRocks.
120 121
121Configuring the destinations: 122Configuring the destinations:
122/TREE [dir] Root of the local tree of installed rocks. 123/TREE [dir] Root of the local tree of installed rocks.
123 Default is %PROGRAMDATA%\LuaRocks 124 Default is %PROGRAMFILES%\LuaRocks\systree
124/SCRIPTS [dir] Where to install commandline scripts installed by 125/SCRIPTS [dir] Where to install commandline scripts installed by
125 rocks. Default is {TREE}/bin. 126 rocks. Default is {TREE}/bin.
126 127/CONFIG [dir] Location where the config file should be installed.
128 Default is %PROGRAMFILES%\LuaRocks
129/SELFCONTAINED Creates a self contained installation in a single
130 directory given by /P.
131 Sets the /TREE and /CONFIG options to the same
132 location as /P. And does not load registry info
133 with option /NOREG. The only option NOT self
134 contained is the user rock tree, so don't use that
135 if you create a self contained installation.
136
127Configuring the Lua interpreter: 137Configuring the Lua interpreter:
128/LV [version] Lua version to use; either 5.1 or 5.2. 138/LV [version] Lua version to use; either 5.1 or 5.2.
129 Default is 5.1 139 Default is 5.1
@@ -149,14 +159,12 @@ Compiler configuration:
149/MW Use mingw as build system instead of MSVC 159/MW Use mingw as build system instead of MSVC
150 160
151Other options: 161Other options:
152/CONFIG [dir] Location where the config file should be installed.
153 Default is %PROGRAMDATA%\LuaRocks
154/FORCECONFIG Use a single config location. Do not use the 162/FORCECONFIG Use a single config location. Do not use the
155 LUAROCKS_CONFIG variable or the user's home directory. 163 LUAROCKS_CONFIG variable or the user's home directory.
156 Useful to avoid conflicts when LuaRocks 164 Useful to avoid conflicts when LuaRocks
157 is embedded within an application. 165 is embedded within an application.
158/F Remove installation directory if it already exists. 166/F Remove installation directory if it already exists.
159/R Load registry information to register '.rockspec' 167/NOREG Do not load registry info to register '.rockspec'
160 extension with LuaRocks commands (right-click). 168 extension with LuaRocks commands (right-click).
161/NOADMIN The installer requires admin priviledges. If not 169/NOADMIN The installer requires admin priviledges. If not
162 available it will elevate a new process. Use this 170 available it will elevate a new process. Use this
@@ -165,10 +173,6 @@ Other options:
165 user. 173 user.
166/Q Do not prompt for confirmation of settings 174/Q Do not prompt for confirmation of settings
167 175
168Example:
169To create a self contained install use (assuming Lua is in your PATH):
170INSTALL /P c:\LuaRocks /TREE c:\LuaRocks /CONFIG c:\LuaRocks
171
172]]) 176]])
173end 177end
174 178
@@ -207,8 +211,10 @@ local function parse_options(args)
207 FORCE_CONFIG = true 211 FORCE_CONFIG = true
208 elseif name == "/F" then 212 elseif name == "/F" then
209 FORCE = true 213 FORCE = true
210 elseif name == "/R" then 214 elseif name == "/SELFCONTAINED" then
211 REGISTRY = true 215 SELFCONTAINED = true
216 elseif name == "/NOREG" then
217 REGISTRY = false
212 elseif name == "/NOADMIN" then 218 elseif name == "/NOADMIN" then
213 NOADMIN = true 219 NOADMIN = true
214 elseif name == "/Q" then 220 elseif name == "/Q" then
@@ -221,6 +227,14 @@ end
221 227
222-- check for combination/required flags 228-- check for combination/required flags
223local function check_flags() 229local function check_flags()
230 if SELFCONTAINED then
231 if not vars.PREFIX then
232 die("Option /P is required when using /SELFCONTAINED")
233 end
234 if vars.SYSCONFDIR or vars.ROCKS_TREE or vars.SCRIPTS_DIR then
235 die("Cannot combine /TREE, /SCRIPTS or /CONFIG with /SELFCONTAINED")
236 end
237 end
224 if INSTALL_LUA then 238 if INSTALL_LUA then
225 if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then 239 if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then
226 die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") 240 die("Cannot combine option /L with any of /LUA /BIN /LIB /INC")
@@ -536,6 +550,7 @@ else
536 print("Admin priviledges available for installing") 550 print("Admin priviledges available for installing")
537end 551end
538 552
553vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]]
539vars.FULL_PREFIX = S"$PREFIX\\$VERSION" 554vars.FULL_PREFIX = S"$PREFIX\\$VERSION"
540vars.BINDIR = vars.FULL_PREFIX 555vars.BINDIR = vars.FULL_PREFIX
541vars.LIBDIR = vars.FULL_PREFIX 556vars.LIBDIR = vars.FULL_PREFIX
@@ -561,15 +576,34 @@ else
561 vars.UNAME_M = get_architecture() -- can only do when installation was found 576 vars.UNAME_M = get_architecture() -- can only do when installation was found
562end 577end
563 578
579local datapath
580if vars.UNAME_M == "x86" then
581 datapath = os.getenv("PROGRAMFILES") .. [[\LuaRocks]]
582else
583 -- our target interpreter is 64bit, so the tree (with binaries) should go into 64bit program files
584 datapath = os.getenv("ProgramW6432") .. [[\LuaRocks]]
585end
586vars.SYSCONFDIR = vars.SYSCONDFIR or datapath
587vars.ROCKS_TREE = vars.ROCKS_TREE or datapath..[[\systree]]
588if SELFCONTAINED then
589 vars.SYSCONFDIR = vars.PREFIX
590 vars.ROCKS_TREE = vars.PREFIX..[[\systree]]
591 REGISTRY = false
592end
593
564print(S[[ 594print(S[[
565 595
566Will configure LuaRocks with the following paths: 596Will configure LuaRocks with the following paths:
567LuaRocks : $FULL_PREFIX 597LuaRocks : $FULL_PREFIX
598Config file : $SYSCONFDIR\config.lua
599Rocktree : $ROCKS_TREE
600
568Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER 601Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER
569 binaries : $LUA_BINDIR 602 binaries : $LUA_BINDIR
570 libraries : $LUA_LIBDIR 603 libraries : $LUA_LIBDIR
571 includes : $LUA_INCDIR 604 includes : $LUA_INCDIR
572Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME 605
606Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME.dll
573System architecture detected as: $UNAME_M 607System architecture detected as: $UNAME_M
574 608
575]]) 609]])