From d03c7efca69544200f9d2c3743f610e172f2cf04 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Fri, 27 Sep 2013 16:33:48 +0200 Subject: ditch some more output --- src/luarocks/fs/win32/tools.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- additional arguments. -- @return boolean: true on success, false on failure. function zip(zipfile, ...) - return fs.execute(vars.SEVENZ.." a -tzip", zipfile, ...) + return fs.execute_quiet(vars.SEVENZ.." a -tzip", zipfile, ...) end --- Uncompress files from a .zip archive. @@ -237,7 +237,7 @@ end -- @return boolean: true on success, false on failure. function unzip(zipfile) assert(zipfile) - return fs.execute(vars.SEVENZ.." x", zipfile) + return fs.execute_quiet(vars.SEVENZ.." x", zipfile) end --- Test is pathname is a directory. @@ -285,7 +285,7 @@ end -- @param archive string: Filename of archive. -- @return boolean : success status local function gunzip(archive) - return fs.execute(vars.SEVENZ.." x", archive) + return fs.execute_quiet(vars.SEVENZ.." x", archive) end --- Unpack an archive. -- cgit v1.2.3-55-g6feb From 8580df1a98ba200e9a7b0ae9c08c667b738bd7f6 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Mon, 7 Oct 2013 11:24:59 +0200 Subject: make installer find interpreter by short versioned name, eg. lua52.exe instead of lua5.2.exe --- install.bat | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/install.bat b/install.bat index 99dc7fa7..87c7b5a2 100644 --- a/install.bat +++ b/install.bat @@ -16,7 +16,7 @@ vars.LUA_INCDIR = nil vars.LUA_LIBDIR = nil vars.LUA_LIBNAME = nil vars.LUA_VERSION = "5.1" -vars.LUA_SHORTV = nil +vars.LUA_SHORTV = nil -- "51" vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" vars.LUA_RUNTIME = nil @@ -180,6 +180,10 @@ local function look_for_interpreter (directory) vars.LUA_INTERPRETER = S"lua$LUA_VERSION.exe" print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") return true + elseif exists( S"$LUA_BINDIR\\lua$LUA_SHORTV.exe" ) then + vars.LUA_INTERPRETER = S"lua$LUA_SHORTV.exe" + print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") + return true elseif exists(S"$LUA_BINDIR\\lua.exe") then vars.LUA_INTERPRETER = "lua.exe" print(S" Found $LUA_BINDIR\\$LUA_INTERPRETER") @@ -199,6 +203,12 @@ local function look_for_interpreter (directory) print(" Found ."..e..vars.LUA_INTERPRETER) return true + elseif exists(directory..e.."\\lua"..vars.LUA_SHORTV..".exe") then + vars.LUA_INTERPRETER = S"lua$LUA_SHORTV.exe" + vars.LUA_BINDIR = directory .. e + print(" Found ."..e..vars.LUA_INTERPRETER) + return true + elseif exists(directory..e.."\\lua.exe") then vars.LUA_INTERPRETER = "lua.exe" vars.LUA_BINDIR = directory..e -- cgit v1.2.3-55-g6feb From 54be99ff40fcb2012a06372cac2735818b0fbc98 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Mon, 7 Oct 2013 14:39:07 +0200 Subject: added platform detection 32/64bit --- install.bat | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/install.bat b/install.bat index 87c7b5a2..976efb6f 100644 --- a/install.bat +++ b/install.bat @@ -19,6 +19,7 @@ vars.LUA_VERSION = "5.1" vars.LUA_SHORTV = nil -- "51" vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" vars.LUA_RUNTIME = nil +vars.UNAME_M = nil local P_SET = false local FORCE = false @@ -387,6 +388,19 @@ local function look_for_lua_install () return false end +local function get_architecture() + -- detect processor arch + proc = io.popen([[.\bin\bin\uname -m]]):read("*l") + if proc:match("i[%d]86") then + proc = "x86" + elseif proc:match("amd64") or proc:match("x86_64") then + proc = "x86_64" + else + die("Could not detect processor architecture") + end + return proc +end + --- -- Poor man's command-line parsing local config = {} @@ -428,6 +442,7 @@ vars.LIBDIR = vars.FULL_PREFIX vars.LUADIR = S"$FULL_PREFIX\\lua" vars.INCDIR = S"$FULL_PREFIX\\include" vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") +vars.UNAME_M = get_architecture() if not look_for_lua_install() then print("Could not find Lua. Will install its own copy.") @@ -452,6 +467,7 @@ Lua binaries : $LUA_BINDIR Lua libraries : $LUA_LIBDIR Lua includes : $LUA_INCDIR Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME +System architecture detected as: $UNAME_M ]]) end @@ -563,7 +579,7 @@ else f:write("LUAROCKS_UNAME_S=[[WindowsNT]]\n") end f:write(S[=[ -LUAROCKS_UNAME_M=[[x86]] +LUAROCKS_UNAME_M=[[$UNAME_M]] LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]] LUAROCKS_PREFIX=[[$PREFIX]] -- cgit v1.2.3-55-g6feb From 83aa8df67ba691fe6ea334eba2bab82cb1a9cee4 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Mon, 7 Oct 2013 14:57:13 +0200 Subject: fix for 5.2 path variable --- install.bat | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install.bat b/install.bat index 976efb6f..7ece98bc 100644 --- a/install.bat +++ b/install.bat @@ -534,6 +534,9 @@ for _, c in ipairs{"luarocks", "luarocks-admin"} do @ECHO OFF SETLOCAL SET LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH% +IF NOT *%LUA_PATH_5_2%*==** ( + SET LUA_PATH_5_2=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_2% +) SET PATH=$BINDIR\;%PATH% "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* ENDLOCAL -- cgit v1.2.3-55-g6feb From 41a84a7f1fe0b62b2fbbb3fda992f586b6c43f9e Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Mon, 7 Oct 2013 23:00:25 +0200 Subject: modified architecture detection as per http://support.microsoft.com/kb/556009 --- install.bat | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/install.bat b/install.bat index 7ece98bc..8d8b3e4c 100644 --- a/install.bat +++ b/install.bat @@ -389,15 +389,22 @@ local function look_for_lua_install () end local function get_architecture() - -- detect processor arch - proc = io.popen([[.\bin\bin\uname -m]]):read("*l") - if proc:match("i[%d]86") then - proc = "x86" - elseif proc:match("amd64") or proc:match("x86_64") then - proc = "x86_64" - else + -- detect processor arch + local tmpname = [[.\_architect_temp.txt]] + local cmd = [[REG.exe Query HKLM\Hardware\Description\System\CentralProcessor\0 >"]]..tmpname.. [["]] + if not exec(cmd) then die("Could not detect processor architecture") - end + end + local f = io.open(tmpname, "r") + local proc = f:read('*a') + f:close() + os.remove(tmpname) + + if proc:match("x86") then + proc = "x86" + else + proc = "x86_64" + end return proc end -- cgit v1.2.3-55-g6feb From 8c675a194ed8b038dcf3678d995aa87899282692 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Thu, 10 Oct 2013 08:45:28 +0200 Subject: fix paths for 5.2, escaping in installer and fix wrapper scripts --- install.bat | 2 +- src/luarocks/fs/win32.lua | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/install.bat b/install.bat index 8d8b3e4c..0f34276d 100644 --- a/install.bat +++ b/install.bat @@ -541,7 +541,7 @@ for _, c in ipairs{"luarocks", "luarocks-admin"} do @ECHO OFF SETLOCAL SET LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH% -IF NOT *%LUA_PATH_5_2%*==** ( +IF NOT "%LUA_PATH_5_2%"=="" ( SET LUA_PATH_5_2=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_2% ) SET PATH=$BINDIR\;%PATH% 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) wrapper:write("setlocal\n") wrapper:write('set LUA_PATH='..package.path..";%LUA_PATH%\n") wrapper:write('set LUA_CPATH='..package.cpath..";%LUA_CPATH%\n") - wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -lluarocks.loader -e\'luarocks.loader.add_context([['..name..']],[['..version..']])\' "'..file..'" %*\n') + wrapper:write('if not "%LUA_PATH_5_2%"=="" set LUA_PATH_5_2='..package.path..";%LUA_PATH_5_2%\n") + wrapper:write('if not "%LUA_CPATH_5_2%"=="" set LUA_CPATH_5_2='..package.cpath..";%LUA_CPATH_5_2%\n") + wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -lluarocks.loader -e"luarocks.loader.add_context([['..name..']],[['..version..']])" "'..file..'" %*\n') wrapper:write("endlocal\n") wrapper:close() return true -- cgit v1.2.3-55-g6feb