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