diff options
| -rw-r--r-- | install.bat | 40 | ||||
| -rw-r--r-- | src/luarocks/fs/win32.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/fs/win32/tools.lua | 6 |
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 | |||
| 16 | vars.LUA_LIBDIR = nil | 16 | vars.LUA_LIBDIR = nil |
| 17 | vars.LUA_LIBNAME = nil | 17 | vars.LUA_LIBNAME = nil |
| 18 | vars.LUA_VERSION = "5.1" | 18 | vars.LUA_VERSION = "5.1" |
| 19 | vars.LUA_SHORTV = nil | 19 | vars.LUA_SHORTV = nil -- "51" |
| 20 | vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" | 20 | vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" |
| 21 | vars.LUA_RUNTIME = nil | 21 | vars.LUA_RUNTIME = nil |
| 22 | vars.UNAME_M = nil | ||
| 22 | 23 | ||
| 23 | local P_SET = false | 24 | local P_SET = false |
| 24 | local FORCE = false | 25 | local 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 |
| 378 | end | 389 | end |
| 379 | 390 | ||
| 391 | local 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 | ||
| 409 | end | ||
| 410 | |||
| 380 | --- | 411 | --- |
| 381 | -- Poor man's command-line parsing | 412 | -- Poor man's command-line parsing |
| 382 | local config = {} | 413 | local config = {} |
| @@ -418,6 +449,7 @@ vars.LIBDIR = vars.FULL_PREFIX | |||
| 418 | vars.LUADIR = S"$FULL_PREFIX\\lua" | 449 | vars.LUADIR = S"$FULL_PREFIX\\lua" |
| 419 | vars.INCDIR = S"$FULL_PREFIX\\include" | 450 | vars.INCDIR = S"$FULL_PREFIX\\include" |
| 420 | vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") | 451 | vars.LUA_SHORTV = vars.LUA_VERSION:gsub("%.", "") |
| 452 | vars.UNAME_M = get_architecture() | ||
| 421 | 453 | ||
| 422 | if not look_for_lua_install() then | 454 | if 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 | |||
| 442 | Lua libraries : $LUA_LIBDIR | 474 | Lua libraries : $LUA_LIBDIR |
| 443 | Lua includes : $LUA_INCDIR | 475 | Lua includes : $LUA_INCDIR |
| 444 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME | 476 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME |
| 477 | System architecture detected as: $UNAME_M | ||
| 445 | 478 | ||
| 446 | ]]) | 479 | ]]) |
| 447 | end | 480 | end |
| @@ -508,6 +541,9 @@ for _, c in ipairs{"luarocks", "luarocks-admin"} do | |||
| 508 | @ECHO OFF | 541 | @ECHO OFF |
| 509 | SETLOCAL | 542 | SETLOCAL |
| 510 | SET LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH% | 543 | SET LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH% |
| 544 | IF NOT "%LUA_PATH_5_2%"=="" ( | ||
| 545 | SET LUA_PATH_5_2=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_2% | ||
| 546 | ) | ||
| 511 | SET PATH=$BINDIR\;%PATH% | 547 | SET PATH=$BINDIR\;%PATH% |
| 512 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* | 548 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* |
| 513 | ENDLOCAL | 549 | ENDLOCAL |
| @@ -553,7 +589,7 @@ else | |||
| 553 | f:write("LUAROCKS_UNAME_S=[[WindowsNT]]\n") | 589 | f:write("LUAROCKS_UNAME_S=[[WindowsNT]]\n") |
| 554 | end | 590 | end |
| 555 | f:write(S[=[ | 591 | f:write(S[=[ |
| 556 | LUAROCKS_UNAME_M=[[x86]] | 592 | LUAROCKS_UNAME_M=[[$UNAME_M]] |
| 557 | LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] | 593 | LUAROCKS_SYSCONFIG=[[$SYSCONFDIR\config.lua]] |
| 558 | LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]] | 594 | LUAROCKS_ROCKS_TREE=[[$ROCKS_TREE]] |
| 559 | LUAROCKS_PREFIX=[[$PREFIX]] | 595 | LUAROCKS_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. |
| 231 | function zip(zipfile, ...) | 231 | function zip(zipfile, ...) |
| 232 | return fs.execute(vars.SEVENZ.." a -tzip", zipfile, ...) | 232 | return fs.execute_quiet(vars.SEVENZ.." a -tzip", zipfile, ...) |
| 233 | end | 233 | end |
| 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. |
| 238 | function unzip(zipfile) | 238 | function 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) |
| 241 | end | 241 | end |
| 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 |
| 287 | local function gunzip(archive) | 287 | local function gunzip(archive) |
| 288 | return fs.execute(vars.SEVENZ.." x", archive) | 288 | return fs.execute_quiet(vars.SEVENZ.." x", archive) |
| 289 | end | 289 | end |
| 290 | 290 | ||
| 291 | --- Unpack an archive. | 291 | --- Unpack an archive. |
