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