aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--install.bat95
-rw-r--r--src/luarocks/build/cmake.lua2
-rw-r--r--src/luarocks/loader.lua2
4 files changed, 66 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index b2701aa3..8933d8aa 100644
--- a/Makefile
+++ b/Makefile
@@ -143,7 +143,7 @@ install_bins: built
143 cd src/bin && for f in $(BIN_FILES); \ 143 cd src/bin && for f in $(BIN_FILES); \
144 do \ 144 do \
145 cp "$$f" "$(DESTDIR)$(BINDIR)/$$f-$(LUA_VERSION)"; \ 145 cp "$$f" "$(DESTDIR)$(BINDIR)/$$f-$(LUA_VERSION)"; \
146 ln -nfs "$(DESTDIR)$(BINDIR)/$$f-$(LUA_VERSION)" "$(DESTDIR)$(BINDIR)/$$f"; \ 146 ln -nfs "$$f-$(LUA_VERSION)" "$(DESTDIR)$(BINDIR)/$$f"; \
147 done 147 done
148 148
149install_luas: built 149install_luas: built
diff --git a/install.bat b/install.bat
index c085de40..d234e242 100644
--- a/install.bat
+++ b/install.bat
@@ -91,42 +91,49 @@ local function print_help()
91 print(S[[ 91 print(S[[
92Installs LuaRocks. 92Installs LuaRocks.
93 93
94/P [dir] (REQUIRED) Where to install. 94/P [dir] (REQUIRED) Where to install LuaRocks.
95 Note that version; $VERSION, will be 95 Note that version; $VERSION, will be appended to this
96 appended to this path. 96 path, so "/P c:\luarocks\" will install in
97/CONFIG [dir] Location where the config file should be installed. 97 "c:\luarocks\$VERSION\"
98 Default is same place of installation 98
99Configuring the destinations:
99/TREE [dir] Root of the local tree of installed rocks. 100/TREE [dir] Root of the local tree of installed rocks.
100 Default is same place of installation 101 Default is same place of installation
101/SCRIPTS [dir] Where to install scripts installed by rocks. 102/SCRIPTS [dir] Where to install commandline scripts installed by
102 Default is TREE/bin. 103 rocks. Default is TREE/bin.
103 104
105Configuring the Lua interpreter:
104/LV [version] Lua version to use; either 5.1 or 5.2. 106/LV [version] Lua version to use; either 5.1 or 5.2.
105 Default is 5.1 107 Default is 5.1
106/L Install LuaRocks' own copy of Lua even if detected,
107 this will always be a 5.1 installation.
108 (/LUA, /INC, /LIB, /BIN cannot be used with /L)
109/LUA [dir] Location where Lua is installed - e.g. c:\lua\5.1\ 108/LUA [dir] Location where Lua is installed - e.g. c:\lua\5.1\
109 If not provided, the installer will search the system
110 path and some default locations for a valid Lua
111 installation.
110 This is the base directory, the installer will look 112 This is the base directory, the installer will look
111 for subdirectories bin, lib, include. Alternatively 113 for subdirectories bin, lib, include. Alternatively
112 these can be specified explicitly using the /INC, 114 these can be specified explicitly using the /INC,
113 /LIB, and /BIN options. 115 /LIB, and /BIN options.
114/INC [dir] Location of Lua includes - e.g. c:\lua\5.1\include 116/INC [dir] Location of Lua includes - e.g. c:\lua\5.1\include
115 If provided overrides sub directory found using /LUA. 117 If provided overrides sub directory found using /LUA.
116/LIB [dir] Location of Lua libraries -e.g. c:\lua\5.1\lib 118/LIB [dir] Location of Lua libraries (.dll) - e.g. c:\lua\5.1\lib
117 If provided overrides sub directory found using /LUA. 119 If provided overrides sub directory found using /LUA.
118/BIN [dir] Location of Lua executables - e.g. c:\lua\5.1\bin 120/BIN [dir] Location of Lua executables - e.g. c:\lua\5.1\bin
119 If provided overrides sub directory found using /LUA. 121 If provided overrides sub directory found using /LUA.
122/L Install LuaRocks' own copy of Lua even if detected,
123 this will always be a 5.1 installation.
124 (/LUA, /INC, /LIB, /BIN cannot be used with /L)
120 125
126Compiler configuration:
121/MW Use mingw as build system instead of MSVC 127/MW Use mingw as build system instead of MSVC
122 128
129Other options:
130/CONFIG [dir] Location where the config file should be installed.
131 Default is same place of installation
123/FORCECONFIG Use a single config location. Do not use the 132/FORCECONFIG Use a single config location. Do not use the
124 LUAROCKS_CONFIG variable or the user's home directory. 133 LUAROCKS_CONFIG variable or the user's home directory.
125 Useful to avoid conflicts when LuaRocks 134 Useful to avoid conflicts when LuaRocks
126 is embedded within an application. 135 is embedded within an application.
127
128/F Remove installation directory if it already exists. 136/F Remove installation directory if it already exists.
129
130/R Load registry information to register '.rockspec' 137/R Load registry information to register '.rockspec'
131 extension with LuaRocks commands (right-click). 138 extension with LuaRocks commands (right-click).
132 139
@@ -224,7 +231,7 @@ local function look_for_interpreter (directory)
224 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") 231 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER")
225 return true 232 return true
226 end 233 end
227 die(S"Lua executable lua.exe, luajit.exe or lua$LUA_VERSION.exe not found in $LUA_BINDIR") 234 die(S"Lua executable lua.exe, luajit.exe, lua$LUA_SHORTV.exe or lua$LUA_VERSION.exe not found in $LUA_BINDIR")
228 end 235 end
229 236
230 for _, e in ipairs{ [[\]], [[\bin\]] } do 237 for _, e in ipairs{ [[\]], [[\bin\]] } do
@@ -307,31 +314,31 @@ end
307 314
308 315
309local function get_runtime() 316local function get_runtime()
310 local f 317 local f
311 vars.LUA_RUNTIME, f = pe.msvcrt(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER) 318 vars.LUA_RUNTIME, f = pe.msvcrt(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER)
312 if type(vars.LUA_RUNTIME) ~= "string" then 319 if type(vars.LUA_RUNTIME) ~= "string" then
313 -- analysis failed, issue a warning 320 -- analysis failed, issue a warning
314 vars.LUA_RUNTIME = "MSVCR80" 321 vars.LUA_RUNTIME = "MSVCR80"
315 print("*** WARNING ***: could not analyse the runtime used, defaulting to "..vars.LUA_RUNTIME) 322 print("*** WARNING ***: could not analyse the runtime used, defaulting to "..vars.LUA_RUNTIME)
316 else 323 else
317 print(" "..f.." uses "..vars.LUA_RUNTIME..".DLL as runtime") 324 print(" "..f.." uses "..vars.LUA_RUNTIME..".DLL as runtime")
318 end 325 end
319 return true 326 return true
320end 327end
321 328
322local function get_architecture() 329local function get_architecture()
323 -- detect processor arch interpreter was compiled for 330 -- detect processor arch interpreter was compiled for
324 local proc = (pe.parse(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER) or {}).Machine 331 local proc = (pe.parse(vars.LUA_BINDIR.."\\"..vars.LUA_INTERPRETER) or {}).Machine
325 if not proc then 332 if not proc then
326 die("Could not detect processor architecture used in "..vars.LUA_INTERPRETER) 333 die("Could not detect processor architecture used in "..vars.LUA_INTERPRETER)
327 end 334 end
328 proc = pe.const.Machine[proc] -- collect name from constant value 335 proc = pe.const.Machine[proc] -- collect name from constant value
329 if proc == "IMAGE_FILE_MACHINE_I386" then 336 if proc == "IMAGE_FILE_MACHINE_I386" then
330 proc = "x86" 337 proc = "x86"
331 else 338 else
332 proc = "x86_64" 339 proc = "x86_64"
333 end 340 end
334 return proc 341 return proc
335end 342end
336 343
337local function look_for_lua_install () 344local function look_for_lua_install ()
@@ -418,10 +425,34 @@ local with_arg = { -- options followed by an argument, others are flags
418 ["/BIN"] = true, 425 ["/BIN"] = true,
419 ["/LIB"] = true, 426 ["/LIB"] = true,
420} 427}
428-- reconstruct argument values with spaces and double quotes
429-- this will be damaged by the batch construction at the start of this file
430if #arg > 0 then
431 farg = table.concat(arg, " ") .. " "
432 arg = {}
433 farg = farg:gsub('%"', "")
434 local i = 0
435 while #farg>0 do
436 i = i + 1
437 if (farg:sub(1,1) ~= "/") and ((arg[i-1] or ""):sub(1,1) ~= "/") then
438 i = i - 1 -- continued previous arg
439 if i == 0 then i = 1 end
440 end
441 if arg[i] then
442 arg[i] = arg[i] .. " "
443 else
444 arg[i] = ""
445 end
446 local v,r = farg:match("^(.-)%s(.*)$")
447 arg[i], farg = arg[i]..v, r
448 while farg:sub(1,1) == " " do farg = farg:sub(2,-1) end -- remove prefix spaces
449 end
450end
451
421local i = 1 452local i = 1
422while i <= #arg do 453while i <= #arg do
423 local opt = arg[i] 454 local opt = arg[i]
424 if with_arg[opt] then 455 if with_arg[opt:upper()] then
425 local value = arg[i + 1] 456 local value = arg[i + 1]
426 if not value then 457 if not value then
427 die("Missing value for option "..opt) 458 die("Missing value for option "..opt)
@@ -448,15 +479,15 @@ vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "")
448 479
449if INSTALL_LUA then 480if INSTALL_LUA then
450 if vars.LUA_VERSION ~= "5.1" then 481 if vars.LUA_VERSION ~= "5.1" then
451 die("Cannot install own copy because no 5.2 version is bundled") 482 die("Cannot install own copy of Lua because only 5.1 is bundled")
452 end 483 end
453 vars.LUA_INTERPRETER = "lua5.1" 484 vars.LUA_INTERPRETER = "lua5.1"
454 vars.LUA_BINDIR = vars.BINDIR 485 vars.LUA_BINDIR = vars.BINDIR
455 vars.LUA_LIBDIR = vars.LIBDIR 486 vars.LUA_LIBDIR = vars.LIBDIR
456 vars.LUA_INCDIR = vars.INCDIR 487 vars.LUA_INCDIR = vars.INCDIR
457 vars.LUA_LIBNAME = "lua5.1.lib" 488 vars.LUA_LIBNAME = "lua5.1.lib"
458 vars.LUA_RUNTIME = "MSVCR80" 489 vars.LUA_RUNTIME = "MSVCR80"
459 vars.UNAME_M = "x86" 490 vars.UNAME_M = "x86"
460else 491else
461 if not look_for_lua_install() then 492 if not look_for_lua_install() then
462 die("Could not find Lua. See /? for options for specifying the location of Lua, or installing a bundled copy of Lua 5.1.") 493 die("Could not find Lua. See /? for options for specifying the location of Lua, or installing a bundled copy of Lua 5.1.")
diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua
index f1737876..0df3a921 100644
--- a/src/luarocks/build/cmake.lua
+++ b/src/luarocks/build/cmake.lua
@@ -22,7 +22,7 @@ function run(rockspec)
22 22
23 util.variable_substitutions(variables, rockspec.variables) 23 util.variable_substitutions(variables, rockspec.variables)
24 24
25 if not fs.execute_quiet(rockspec.variables.CMAKE, "--help")) then 25 if not fs.execute_quiet(rockspec.variables.CMAKE, "--help") then
26 return nil, "'"..rockspec.variables.CMAKE.."' program not found. Is cmake installed? You may want to edit variables.CMAKE" 26 return nil, "'"..rockspec.variables.CMAKE.."' program not found. Is cmake installed? You may want to edit variables.CMAKE"
27 end 27 end
28 28
diff --git a/src/luarocks/loader.lua b/src/luarocks/loader.lua
index a116766c..aa3b2781 100644
--- a/src/luarocks/loader.lua
+++ b/src/luarocks/loader.lua
@@ -108,7 +108,7 @@ end
108-- @return table or (nil, string): The module table as returned by some other loader, 108-- @return table or (nil, string): The module table as returned by some other loader,
109-- or nil followed by an error message if no other loader managed to load the module. 109-- or nil followed by an error message if no other loader managed to load the module.
110local function call_other_loaders(module, name, version, module_name) 110local function call_other_loaders(module, name, version, module_name)
111 for i, loader in pairs(package.loaders) do 111 for i, loader in ipairs(package.loaders) do
112 if loader ~= luarocks_loader then 112 if loader ~= luarocks_loader then
113 local results = { loader(module_name) } 113 local results = { loader(module_name) }
114 if type(results[1]) == "function" then 114 if type(results[1]) == "function" then