aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-10-11 20:28:19 -0300
committerHisham Muhammad <hisham@gobolinux.org>2013-10-11 20:28:19 -0300
commite11e2f8153a5d802c19be89e1e406a1941b56420 (patch)
treedec4d45e0aaac25fa6c509cec4947e89d6d2d454
parentc0a59c50fff8455bfa5a094146a5823570ba42b5 (diff)
parent68878f0fdde4749be50eeb141631eafa5b7aa8e3 (diff)
downloadluarocks-e11e2f8153a5d802c19be89e1e406a1941b56420.tar.gz
luarocks-e11e2f8153a5d802c19be89e1e406a1941b56420.tar.bz2
luarocks-e11e2f8153a5d802c19be89e1e406a1941b56420.zip
Merge branch 'master' of github.com:keplerproject/luarocks
-rw-r--r--install.bat40
-rw-r--r--src/luarocks/fs/win32.lua4
-rw-r--r--src/luarocks/fs/win32/tools.lua6
3 files changed, 44 insertions, 6 deletions
diff --git a/install.bat b/install.bat
index 99dc7fa7..0f34276d 100644
--- a/install.bat
+++ b/install.bat
@@ -16,9 +16,10 @@ vars.LUA_INCDIR = nil
16vars.LUA_LIBDIR = nil 16vars.LUA_LIBDIR = nil
17vars.LUA_LIBNAME = nil 17vars.LUA_LIBNAME = nil
18vars.LUA_VERSION = "5.1" 18vars.LUA_VERSION = "5.1"
19vars.LUA_SHORTV = nil 19vars.LUA_SHORTV = nil -- "51"
20vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" 20vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a"
21vars.LUA_RUNTIME = nil 21vars.LUA_RUNTIME = nil
22vars.UNAME_M = nil
22 23
23local P_SET = false 24local P_SET = false
24local FORCE = false 25local FORCE = false
@@ -180,6 +181,10 @@ local function look_for_interpreter (directory)
180 vars.LUA_INTERPRETER = S"lua$LUA_VERSION.exe" 181 vars.LUA_INTERPRETER = S"lua$LUA_VERSION.exe"
181 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") 182 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER")
182 return true 183 return true
184 elseif exists( S"$LUA_BINDIR\\lua$LUA_SHORTV.exe" ) then
185 vars.LUA_INTERPRETER = S"lua$LUA_SHORTV.exe"
186 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER")
187 return true
183 elseif exists(S"$LUA_BINDIR\\lua.exe") then 188 elseif exists(S"$LUA_BINDIR\\lua.exe") then
184 vars.LUA_INTERPRETER = "lua.exe" 189 vars.LUA_INTERPRETER = "lua.exe"
185 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") 190 print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER")
@@ -199,6 +204,12 @@ local function look_for_interpreter (directory)
199 print(" Found ."..e..vars.LUA_INTERPRETER) 204 print(" Found ."..e..vars.LUA_INTERPRETER)
200 return true 205 return true
201 206
207 elseif exists(directory..e.."\\lua"..vars.LUA_SHORTV..".exe") then
208 vars.LUA_INTERPRETER = S"lua$LUA_SHORTV.exe"
209 vars.LUA_BINDIR = directory .. e
210 print(" Found ."..e..vars.LUA_INTERPRETER)
211 return true
212
202 elseif exists(directory..e.."\\lua.exe") then 213 elseif exists(directory..e.."\\lua.exe") then
203 vars.LUA_INTERPRETER = "lua.exe" 214 vars.LUA_INTERPRETER = "lua.exe"
204 vars.LUA_BINDIR = directory..e 215 vars.LUA_BINDIR = directory..e
@@ -377,6 +388,26 @@ local function look_for_lua_install ()
377 return false 388 return false
378end 389end
379 390
391local function get_architecture()
392 -- detect processor arch
393 local tmpname = [[.\_architect_temp.txt]]
394 local cmd = [[REG.exe Query HKLM\Hardware\Description\System\CentralProcessor\0 >"]]..tmpname.. [["]]
395 if not exec(cmd) then
396 die("Could not detect processor architecture")
397 end
398 local f = io.open(tmpname, "r")
399 local proc = f:read('*a')
400 f:close()
401 os.remove(tmpname)
402
403 if proc:match("x86") then
404 proc = "x86"
405 else
406 proc = "x86_64"
407 end
408 return proc
409end
410
380--- 411---
381-- Poor man's command-line parsing 412-- Poor man's command-line parsing
382local config = {} 413local config = {}
@@ -418,6 +449,7 @@ vars.LIBDIR = vars.FULL_PREFIX
418vars.LUADIR = S"$FULL_PREFIX\\lua" 449vars.LUADIR = S"$FULL_PREFIX\\lua"
419vars.INCDIR = S"$FULL_PREFIX\\include" 450vars.INCDIR = S"$FULL_PREFIX\\include"
420vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") 451vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "")
452vars.UNAME_M = get_architecture()
421 453
422if not look_for_lua_install() then 454if not look_for_lua_install() then
423 print("Could not find Lua. Will install its own copy.") 455 print("Could not find Lua. Will install its own copy.")
@@ -442,6 +474,7 @@ Lua binaries : $LUA_BINDIR
442Lua libraries : $LUA_LIBDIR 474Lua libraries : $LUA_LIBDIR
443Lua includes : $LUA_INCDIR 475Lua includes : $LUA_INCDIR
444Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME 476Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME
477System architecture detected as: $UNAME_M
445 478
446]]) 479]])
447end 480end
@@ -508,6 +541,9 @@ for _, c in ipairs{"luarocks", "luarocks-admin"} do
508@ECHO OFF 541@ECHO OFF
509SETLOCAL 542SETLOCAL
510SET LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH% 543SET LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH%
544IF NOT "%LUA_PATH_5_2%"=="" (
545 SET LUA_PATH_5_2=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_2%
546)
511SET PATH=$BINDIR\;%PATH% 547SET PATH=$BINDIR\;%PATH%
512"$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* 548"$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %*
513ENDLOCAL 549ENDLOCAL
@@ -553,7 +589,7 @@ else
553 f:write("LUAROCKS_UNAME_S=[[WindowsNT]]\n") 589 f:write("LUAROCKS_UNAME_S=[[WindowsNT]]\n")
554end 590end
555f:write(S[=[ 591f:write(S[=[
556LUAROCKS_UNAME_M=[[x86]] 592LUAROCKS_UNAME_M=[[$UNAME_M]]
557LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] 593LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]]
558LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]] 594LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]]
559LUAROCKS_PREFIX=[[$PREFIX]] 595LUAROCKS_PREFIX=[[$PREFIX]]
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua
index 2b5bb955..2bc595f6 100644
--- a/src/luarocks/fs/win32.lua
+++ b/src/luarocks/fs/win32.lua
@@ -71,7 +71,9 @@ function wrap_script(file, dest, name, version)
71 wrapper:write("setlocal\n") 71 wrapper:write("setlocal\n")
72 wrapper:write('set LUA_PATH='..package.path..";%LUA_PATH%\n") 72 wrapper:write('set LUA_PATH='..package.path..";%LUA_PATH%\n")
73 wrapper:write('set LUA_CPATH='..package.cpath..";%LUA_CPATH%\n") 73 wrapper:write('set LUA_CPATH='..package.cpath..";%LUA_CPATH%\n")
74 wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -lluarocks.loader -e\'luarocks.loader.add_context([['..name..']],[['..version..']])\' "'..file..'" %*\n') 74 wrapper:write('if not "%LUA_PATH_5_2%"=="" set LUA_PATH_5_2='..package.path..";%LUA_PATH_5_2%\n")
75 wrapper:write('if not "%LUA_CPATH_5_2%"=="" set LUA_CPATH_5_2='..package.cpath..";%LUA_CPATH_5_2%\n")
76 wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -lluarocks.loader -e"luarocks.loader.add_context([['..name..']],[['..version..']])" "'..file..'" %*\n')
75 wrapper:write("endlocal\n") 77 wrapper:write("endlocal\n")
76 wrapper:close() 78 wrapper:close()
77 return true 79 return true
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua
index b8f9bd36..2e125923 100644
--- a/src/luarocks/fs/win32/tools.lua
+++ b/src/luarocks/fs/win32/tools.lua
@@ -229,7 +229,7 @@ end
229-- additional arguments. 229-- additional arguments.
230-- @return boolean: true on success, false on failure. 230-- @return boolean: true on success, false on failure.
231function zip(zipfile, ...) 231function zip(zipfile, ...)
232 return fs.execute(vars.SEVENZ.." a -tzip", zipfile, ...) 232 return fs.execute_quiet(vars.SEVENZ.." a -tzip", zipfile, ...)
233end 233end
234 234
235--- Uncompress files from a .zip archive. 235--- Uncompress files from a .zip archive.
@@ -237,7 +237,7 @@ end
237-- @return boolean: true on success, false on failure. 237-- @return boolean: true on success, false on failure.
238function unzip(zipfile) 238function unzip(zipfile)
239 assert(zipfile) 239 assert(zipfile)
240 return fs.execute(vars.SEVENZ.." x", zipfile) 240 return fs.execute_quiet(vars.SEVENZ.." x", zipfile)
241end 241end
242 242
243--- Test is pathname is a directory. 243--- Test is pathname is a directory.
@@ -285,7 +285,7 @@ end
285-- @param archive string: Filename of archive. 285-- @param archive string: Filename of archive.
286-- @return boolean : success status 286-- @return boolean : success status
287local function gunzip(archive) 287local function gunzip(archive)
288 return fs.execute(vars.SEVENZ.." x", archive) 288 return fs.execute_quiet(vars.SEVENZ.." x", archive)
289end 289end
290 290
291--- Unpack an archive. 291--- Unpack an archive.