- https://issues.prosody.im/1395
- https://hg.prosody.im/trunk/rev/48f7cda4174d
- https://hg.prosody.im/trunk/rev/a7903de619b0
--- prosody-0.11.5/configure 2020-06-30 15:47:57.575906862 -0400
+++ prosody-0.11.5/configure.lua54 2020-06-30 15:50:52.970509696 -0400
@@ -44,7 +44,7 @@ Configure $APP_NAME prior to building.
Default is \$PREFIX/lib
--datadir=DIR Location where the server data should be stored.
Default is \$PREFIX/var/lib/$APP_DIRNAME
---lua-version=VERSION Use specific Lua version: 5.1, 5.2, or 5.3
+--lua-version=VERSION Use specific Lua version: 5.1, 5.2, 5.3, or 5.4
Default is auto-detected.
--lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
@@ -237,7 +237,7 @@ do
--lua-version|--with-lua-version)
[ -n "$value" ] || die "Missing value in flag $key."
LUA_VERSION="$value"
- [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || die "Invalid Lua version in flag $key."
+ [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || [ "$LUA_VERSION" = "5.4" ] || die "Invalid Lua version in flag $key."
LUA_VERSION_SET=yes
;;
--with-lua)
@@ -340,7 +340,7 @@ then
fi
detect_lua_version() {
- detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[123])$"))' 2> /dev/null)
+ detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[1234])$"))' 2> /dev/null)
if [ "$detected_lua" != "nil" ]
then
if [ "$LUA_VERSION_SET" != "yes" ]
@@ -403,8 +403,11 @@ then
elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.3" ]
then
suffixes="5.3 53 -5.3 -53"
+ elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.4" ]
+ then
+ suffixes="5.4 54 -5.4 -54"
else
- suffixes="5.1 51 -5.1 -51 5.2 52 -5.2 -52 5.3 53 -5.3 -53"
+ suffixes="5.1 51 -5.1 -51 5.2 52 -5.2 -52 5.3 53 -5.3 -53 5.4 54 -5.4 -54"
fi
for suffix in "" $suffixes
do
--- prosody-0.11.7/net/websocket/frames.lua 2020-05-31 22:39:34.000000000 +0200
+++ prosody-0.11.7/net/websocket/frames.lua.lua54 2020-10-08 22:31:55.998715572 +0200
@@ -9,8 +9,7 @@
local softreq = require "util.dependencies".softreq;
local random_bytes = require "util.random".bytes;
-local bit = assert(softreq"bit" or softreq"bit32",
- "No bit module found. See https://prosody.im/doc/depends#bitop");
+local bit = require "util.bitcompat";
local band = bit.band;
local bor = bit.bor;
local bxor = bit.bxor;
--- prosody-0.11.7/util/bit53.lua 1970-01-01 01:00:00.000000000 +0100
+++ prosody-0.11.7/util/bit53.lua.lua54 2020-10-08 22:31:55.998715572 +0200
@@ -0,0 +1,7 @@
+-- Only the operators needed by net.websocket.frames are provided at this point
+return {
+ band = function (a, b) return a & b end;
+ bor = function (a, b) return a | b end;
+ bxor = function (a, b) return a ~ b end;
+};
+
--- prosody-0.11.7/util/bitcompat.lua 1970-01-01 01:00:00.000000000 +0100
+++ prosody-0.11.7/util/bitcompat.lua.lua54 2020-10-08 22:31:55.998715572 +0200
@@ -0,0 +1,32 @@
+-- Compatibility layer for bitwise operations
+
+-- First try the bit32 lib
+-- Lua 5.3 has it with compat enabled
+-- Lua 5.2 has it by default
+if _G.bit32 then
+ return _G.bit32;
+else
+ -- Lua 5.1 may have it as a standalone module that can be installed
+ local ok, bitop = pcall(require, "bit32")
+ if ok then
+ return bitop;
+ end
+end
+
+do
+ -- Lua 5.3 and 5.4 would be able to use native infix operators
+ local ok, bitop = pcall(require, "util.bit53")
+ if ok then
+ return bitop;
+ end
+end
+
+do
+ -- Lastly, try the LuaJIT bitop library
+ local ok, bitop = pcall(require, "bit")
+ if ok then
+ return bitop;
+ end
+end
+
+error "No bit module found. See https://prosody.im/doc/depends#bitop";
--- prosody-0.11.7/util/dependencies.lua 2020-05-31 22:39:34.000000000 +0200
+++ prosody-0.11.7/util/dependencies.lua.lua54 2020-10-08 22:32:01.423752075 +0200
@@ -90,7 +90,7 @@
}, "SSL/TLS support will not be available");
end
- local bit = _G.bit32 or softreq"bit";
+ local bit = softreq"util.bitcompat";
if not bit then
missingdep("lua-bitops", {