diff options
| author | Philipp Janda <siffiejoe@gmx.net> | 2014-03-26 18:25:16 +0100 |
|---|---|---|
| committer | Philipp Janda <siffiejoe@gmx.net> | 2014-03-26 18:25:16 +0100 |
| commit | eba0f64344ea14c25cbe7b1054739567cd77ec29 (patch) | |
| tree | bfb591cda588c51901a8c1ecb1cbf28a9a86f0b0 | |
| parent | 00b5631f71fcb0db535aded042b51aa58223e6a4 (diff) | |
| download | luarocks-eba0f64344ea14c25cbe7b1054739567cd77ec29.tar.gz luarocks-eba0f64344ea14c25cbe7b1054739567cd77ec29.tar.bz2 luarocks-eba0f64344ea14c25cbe7b1054739567cd77ec29.zip | |
prepare luarocks for lua 5.3
| -rwxr-xr-x | configure | 27 | ||||
| -rw-r--r-- | install.bat | 9 | ||||
| -rw-r--r-- | src/luarocks/cfg.lua | 5 | ||||
| -rw-r--r-- | src/luarocks/util.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/write_rockspec.lua | 10 |
5 files changed, 37 insertions, 16 deletions
| @@ -39,7 +39,7 @@ system's package manager. | |||
| 39 | --rocks-tree=DIR Root of the local tree of installed rocks. | 39 | --rocks-tree=DIR Root of the local tree of installed rocks. |
| 40 | Default is \$PREFIX | 40 | Default is \$PREFIX |
| 41 | 41 | ||
| 42 | --lua-version=VERSION Use specific Lua version: 5.1 or 5.2 | 42 | --lua-version=VERSION Use specific Lua version: 5.1, 5.2, or 5.3 |
| 43 | Default is "$LUA_VERSION" | 43 | Default is "$LUA_VERSION" |
| 44 | --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames. | 44 | --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames. |
| 45 | Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...) | 45 | Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...) |
| @@ -177,7 +177,7 @@ do | |||
| 177 | --lua-version) | 177 | --lua-version) |
| 178 | [ -n "$value" ] || die "Missing value in flag $key." | 178 | [ -n "$value" ] || die "Missing value in flag $key." |
| 179 | LUA_VERSION="$value" | 179 | LUA_VERSION="$value" |
| 180 | [ "$LUA_VERSION" = "5.1" -o "$LUA_VERSION" = "5.2" ] || die "Invalid Lua version in flag $key." | 180 | [ "$LUA_VERSION" = "5.1" -o "$LUA_VERSION" = "5.2" -o "$LUA_VERSION" = "5.3" ] || die "Invalid Lua version in flag $key." |
| 181 | LUA_VERSION_SET=yes | 181 | LUA_VERSION_SET=yes |
| 182 | ;; | 182 | ;; |
| 183 | --with-lua) | 183 | --with-lua) |
| @@ -234,7 +234,7 @@ fi | |||
| 234 | 234 | ||
| 235 | detect_lua_version() { | 235 | detect_lua_version() { |
| 236 | detected_lua=`$1 -e 'print(_VERSION:sub(5))' 2> /dev/null` | 236 | detected_lua=`$1 -e 'print(_VERSION:sub(5))' 2> /dev/null` |
| 237 | if [ "$detected_lua" = "5.1" -o "$detected_lua" = "5.2" ] | 237 | if [ "$detected_lua" = "5.1" -o "$detected_lua" = "5.2" -o "$detected_lua" = "5.3" ] |
| 238 | then | 238 | then |
| 239 | echo "Lua version detected: $detected_lua" | 239 | echo "Lua version detected: $detected_lua" |
| 240 | if [ "$LUA_VERSION_SET" != "yes" ] | 240 | if [ "$LUA_VERSION_SET" != "yes" ] |
| @@ -275,8 +275,11 @@ then | |||
| 275 | elif [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.2" ] | 275 | elif [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.2" ] |
| 276 | then | 276 | then |
| 277 | suffixes="5.2 52 -5.2 -52" | 277 | suffixes="5.2 52 -5.2 -52" |
| 278 | elif [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.3" ] | ||
| 279 | then | ||
| 280 | suffixes="5.3 53 -5.3 -53" | ||
| 278 | else | 281 | else |
| 279 | suffixes="5.2 52 -5.2 -52 5.1 51 -5.1 -51" | 282 | suffixes="5.3 53 -5.3 -53 5.2 52 -5.2 -52 5.1 51 -5.1 -51" |
| 280 | fi | 283 | fi |
| 281 | for suffix in `echo $suffixes` "" | 284 | for suffix in `echo $suffixes` "" |
| 282 | do | 285 | do |
| @@ -371,12 +374,14 @@ else | |||
| 371 | die "Could not determine processor architecture. 'uname -m' failed." | 374 | die "Could not determine processor architecture. 'uname -m' failed." |
| 372 | fi | 375 | fi |
| 373 | 376 | ||
| 374 | if [ "$LUA_VERSION" = "5.2" ] | 377 | for v in 5.1 5.2 5.3; do |
| 375 | then | 378 | if [ "$v" != "$LUA_VERSION" ]; then |
| 376 | LUA_OTHER_VERSION=5.1 | 379 | if [ -e "$PREFIX/share/lua/$v/luarocks/site_config.lua" ]; then |
| 377 | else | 380 | LUA_OTHER_VERSION="$v" |
| 378 | LUA_OTHER_VERSION=5.2 | 381 | break |
| 379 | fi | 382 | fi |
| 383 | fi | ||
| 384 | done | ||
| 380 | 385 | ||
| 381 | LUAROCKS_ROCKS_SUBDIR=/lib/luarocks/rocks | 386 | LUAROCKS_ROCKS_SUBDIR=/lib/luarocks/rocks |
| 382 | if [ "$VERSIONED_ROCKS_DIR" = "yes" ] | 387 | if [ "$VERSIONED_ROCKS_DIR" = "yes" ] |
| @@ -388,7 +393,7 @@ then | |||
| 388 | echo "Existing installation detected." | 393 | echo "Existing installation detected." |
| 389 | LUAROCKS_ROCKS_SUBDIR=`grep "LUAROCKS_ROCKS_SUBDIR" "$PREFIX/share/lua/$LUA_VERSION/luarocks/site_config.lua" | sed 's,.*=\[\[\(.*\)\]\],\1,'` | 394 | LUAROCKS_ROCKS_SUBDIR=`grep "LUAROCKS_ROCKS_SUBDIR" "$PREFIX/share/lua/$LUA_VERSION/luarocks/site_config.lua" | sed 's,.*=\[\[\(.*\)\]\],\1,'` |
| 390 | echo "Using previously configured rocks dir: $PREFIX$LUAROCKS_ROCKS_SUBDIR" | 395 | echo "Using previously configured rocks dir: $PREFIX$LUAROCKS_ROCKS_SUBDIR" |
| 391 | elif [ -e "$PREFIX/share/lua/$LUA_OTHER_VERSION/luarocks/site_config.lua" ] | 396 | elif [ -n "$LUA_OTHER_VERSION" ] |
| 392 | then | 397 | then |
| 393 | echo "Existing installation detected for other Lua version ($LUA_OTHER_VERSION)." | 398 | echo "Existing installation detected for other Lua version ($LUA_OTHER_VERSION)." |
| 394 | LUAROCKS_ROCKS_SUBDIR=$LUAROCKS_ROCKS_SUBDIR-$LUA_VERSION | 399 | LUAROCKS_ROCKS_SUBDIR=$LUAROCKS_ROCKS_SUBDIR-$LUA_VERSION |
diff --git a/install.bat b/install.bat index 287bad5b..93b159a5 100644 --- a/install.bat +++ b/install.bat | |||
| @@ -138,7 +138,7 @@ Configuring the destinations: | |||
| 138 | if you create a self contained installation. | 138 | if you create a self contained installation. |
| 139 | 139 | ||
| 140 | Configuring the Lua interpreter: | 140 | Configuring the Lua interpreter: |
| 141 | /LV [version] Lua version to use; either 5.1 or 5.2. | 141 | /LV [version] Lua version to use; either 5.1, 5.2, or 5.3. |
| 142 | Default is 5.1 | 142 | Default is 5.1 |
| 143 | /LUA [dir] Location where Lua is installed - e.g. c:\lua\5.1\ | 143 | /LUA [dir] Location where Lua is installed - e.g. c:\lua\5.1\ |
| 144 | If not provided, the installer will search the system | 144 | If not provided, the installer will search the system |
| @@ -249,8 +249,10 @@ local function check_flags() | |||
| 249 | if vars.LUA_VERSION ~= "5.1" then | 249 | if vars.LUA_VERSION ~= "5.1" then |
| 250 | if vars.LUA_VERSION == "5.2" then | 250 | if vars.LUA_VERSION == "5.2" then |
| 251 | vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%12") | 251 | vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%12") |
| 252 | elseif vars.LUA_VERSION == "5.3" then | ||
| 253 | vars.LUA_LIB_NAMES = vars.LUA_LIB_NAMES:gsub("5([%.]?)1", "5%13") | ||
| 252 | else | 254 | else |
| 253 | die("Bad argument: /LV must either be 5.1 or 5.2") | 255 | die("Bad argument: /LV must either be 5.1, 5.2, or 5.3") |
| 254 | end | 256 | end |
| 255 | end | 257 | end |
| 256 | end | 258 | end |
| @@ -701,6 +703,9 @@ SET "LUA_PATH=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH%" | |||
| 701 | IF NOT "%LUA_PATH_5_2%"=="" ( | 703 | IF NOT "%LUA_PATH_5_2%"=="" ( |
| 702 | SET "LUA_PATH_5_2=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_2%" | 704 | SET "LUA_PATH_5_2=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_2%" |
| 703 | ) | 705 | ) |
| 706 | IF NOT "%LUA_PATH_5_3%"=="" ( | ||
| 707 | SET "LUA_PATH_5_3=$LUADIR\?.lua;$LUADIR\?\init.lua;%LUA_PATH_5_3%" | ||
| 708 | ) | ||
| 704 | SET "PATH=$BINDIR;%PATH%" | 709 | SET "PATH=$BINDIR;%PATH%" |
| 705 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* | 710 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* |
| 706 | IF NOT "%ERRORLEVEL%"=="2" GOTO EXITLR | 711 | IF NOT "%ERRORLEVEL%"=="2" GOTO EXITLR |
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 21cfbf6d..1207d600 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
| @@ -483,6 +483,11 @@ if cfg.lua_version >= "5.2" then | |||
| 483 | defaults.rocks_provided["bit32"] = cfg.lua_version.."-1" | 483 | defaults.rocks_provided["bit32"] = cfg.lua_version.."-1" |
| 484 | end | 484 | end |
| 485 | 485 | ||
| 486 | if cfg.lua_version >= "5.3" then | ||
| 487 | -- Lua 5.3+ | ||
| 488 | defaults.rocks_provided["utf8"] = cfg.lua_version.."-1" | ||
| 489 | end | ||
| 490 | |||
| 486 | if package.loaded.jit then | 491 | if package.loaded.jit then |
| 487 | -- LuaJIT | 492 | -- LuaJIT |
| 488 | local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","") | 493 | local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","") |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 7e34fe0e..a70e726d 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
| @@ -321,7 +321,7 @@ function util.sortedpairs(tbl, sort_function) | |||
| 321 | end | 321 | end |
| 322 | 322 | ||
| 323 | function util.lua_versions() | 323 | function util.lua_versions() |
| 324 | local versions = { "5.1", "5.2" } | 324 | local versions = { "5.1", "5.2", "5.3" } |
| 325 | local i = 0 | 325 | local i = 0 |
| 326 | return function() | 326 | return function() |
| 327 | i = i + 1 | 327 | i = i + 1 |
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua index a194201d..20d35701 100644 --- a/src/luarocks/write_rockspec.lua +++ b/src/luarocks/write_rockspec.lua | |||
| @@ -31,8 +31,8 @@ rockspec, and is not guaranteed to be complete or correct. | |||
| 31 | --summary="<txt>" A short one-line description summary. | 31 | --summary="<txt>" A short one-line description summary. |
| 32 | --description="<txt>" A longer description string. | 32 | --description="<txt>" A longer description string. |
| 33 | --homepage=<url> Project homepage. | 33 | --homepage=<url> Project homepage. |
| 34 | --lua-version=<ver> Supported Lua versions. Accepted values are "5.1", "5.2" | 34 | --lua-version=<ver> Supported Lua versions. Accepted values are "5.1", "5.2", |
| 35 | or "5.1,5.2". | 35 | "5.3", "5.1,5.2", "5.2,5.3", or "5.1,5.2,5.3". |
| 36 | --tag=<tag> Tag to use. Will attempt to extract version number from it. | 36 | --tag=<tag> Tag to use. Will attempt to extract version number from it. |
| 37 | --lib=<lib>[,<lib>] A comma-separated list of libraries that C files need to | 37 | --lib=<lib>[,<lib>] A comma-separated list of libraries that C files need to |
| 38 | link to. | 38 | link to. |
| @@ -63,8 +63,14 @@ local function configure_lua_version(rockspec, luaver) | |||
| 63 | table.insert(rockspec.dependencies, "lua ~> 5.1") | 63 | table.insert(rockspec.dependencies, "lua ~> 5.1") |
| 64 | elseif luaver == "5.2" then | 64 | elseif luaver == "5.2" then |
| 65 | table.insert(rockspec.dependencies, "lua ~> 5.2") | 65 | table.insert(rockspec.dependencies, "lua ~> 5.2") |
| 66 | elseif luaver == "5.3" then | ||
| 67 | table.insert(rockspec.dependencies, "lua ~> 5.3") | ||
| 66 | elseif luaver == "5.1,5.2" then | 68 | elseif luaver == "5.1,5.2" then |
| 67 | table.insert(rockspec.dependencies, "lua >= 5.1, < 5.3") | 69 | table.insert(rockspec.dependencies, "lua >= 5.1, < 5.3") |
| 70 | elseif luaver == "5.2,5.3" then | ||
| 71 | table.insert(rockspec.dependencies, "lua >= 5.2, < 5.4") | ||
| 72 | elseif luaver == "5.1,5.2,5.3" then | ||
| 73 | table.insert(rockspec.dependencies, "lua >= 5.1, < 5.4") | ||
| 68 | else | 74 | else |
| 69 | util.warning("Please specify supported Lua version with --lua-version=<ver>. "..util.see_help("write_rockspec")) | 75 | util.warning("Please specify supported Lua version with --lua-version=<ver>. "..util.see_help("write_rockspec")) |
| 70 | end | 76 | end |
