From 3b08f674e3f771b49370edb144dab0958c8cf721 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 31 Aug 2021 08:59:54 +0100 Subject: gentoo resync : 31.08.2021 --- .../files/LuaBitOp-1.0.2-support-lua5-3+.patch | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 dev-lua/LuaBitOp/files/LuaBitOp-1.0.2-support-lua5-3+.patch (limited to 'dev-lua/LuaBitOp/files/LuaBitOp-1.0.2-support-lua5-3+.patch') diff --git a/dev-lua/LuaBitOp/files/LuaBitOp-1.0.2-support-lua5-3+.patch b/dev-lua/LuaBitOp/files/LuaBitOp-1.0.2-support-lua5-3+.patch new file mode 100644 index 000000000000..23c0d23a2150 --- /dev/null +++ b/dev-lua/LuaBitOp/files/LuaBitOp-1.0.2-support-lua5-3+.patch @@ -0,0 +1,78 @@ +This patch is a result of diff between upstream and bundled library in rspamd + +https://github.com/rspamd/rspamd/blob/30298909543453ebe969878f1406ee76ad148494/contrib/lua-bit/bit.c + +diff --git a/bit.c b/bit.c +index 690df7d3c..01326c99a 100644 +--- a/bit.c ++++ b/bit.c +@@ -46,7 +46,7 @@ typedef uint32_t UBits; + + typedef union { + lua_Number n; +-#ifdef LUA_NUMBER_DOUBLE ++#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_FLOAT_DOUBLE) + uint64_t b; + #else + UBits b; +@@ -63,24 +63,25 @@ static UBits barg(lua_State *L, int idx) + #else + bn.n = luaL_checknumber(L, idx); + #endif +-#if defined(LUA_NUMBER_DOUBLE) ++#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_FLOAT_DOUBLE) + bn.n += 6755399441055744.0; /* 2^52+2^51 */ + #ifdef SWAPPED_DOUBLE + b = (UBits)(bn.b >> 32); + #else + b = (UBits)bn.b; + #endif +-#elif defined(LUA_NUMBER_INT) || defined(LUA_NUMBER_LONG) || \ +- defined(LUA_NUMBER_LONGLONG) || defined(LUA_NUMBER_LONG_LONG) || \ +- defined(LUA_NUMBER_LLONG) ++#elif defined(LUA_NUMBER_INT) || defined(LUA_INT_INT) || \ ++ defined(LUA_NUMBER_LONG) || defined(LUA_INT_LONG) || \ ++ defined(LUA_NUMBER_LONGLONG) || defined(LUA_INT_LONGLONG) || \ ++ defined(LUA_NUMBER_LONG_LONG) || defined(LUA_NUMBER_LLONG) + if (sizeof(UBits) == sizeof(lua_Number)) + b = bn.b; + else + b = (UBits)(SBits)bn.n; +-#elif defined(LUA_NUMBER_FLOAT) ++#elif defined(LUA_NUMBER_FLOAT) || defined(LUA_FLOAT_FLOAT) + #error "A 'float' lua_Number type is incompatible with this library" + #else +-#error "Unknown number type, check LUA_NUMBER_* in luaconf.h" ++#error "Unknown number type, check LUA_NUMBER_*, LUA_FLOAT_*, LUA_INT_* in luaconf.h" + #endif + #if LUA_VERSION_NUM < 502 + if (b == 0 && !lua_isnumber(L, idx)) { +@@ -91,7 +92,11 @@ static UBits barg(lua_State *L, int idx) + } + + /* Return bit type. */ ++#if LUA_VERSION_NUM < 503 + #define BRET(b) lua_pushnumber(L, (lua_Number)(SBits)(b)); return 1; ++#else ++#define BRET(b) lua_pushinteger(L, (lua_Integer)(SBits)(b)); return 1; ++#endif + + static int bit_tobit(lua_State *L) { BRET(barg(L, 1)) } + static int bit_bnot(lua_State *L) { BRET(~barg(L, 1)) } +@@ -163,11 +168,15 @@ static const struct luaL_Reg bit_funcs[] = { + LUALIB_API int luaopen_bit(lua_State *L) + { + UBits b; ++#if LUA_VERSION_NUM < 503 + lua_pushnumber(L, (lua_Number)1437217655L); ++#else ++ lua_pushinteger(L, (lua_Integer)1437217655L); ++#endif + b = barg(L, -1); + if (b != (UBits)1437217655L || BAD_SAR) { /* Perform a simple self-test. */ + const char *msg = "compiled with incompatible luaconf.h"; +-#ifdef LUA_NUMBER_DOUBLE ++#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_FLOAT_DOUBLE) + #ifdef _WIN32 + if (b == (UBits)1610612736L) + msg = "use D3DCREATE_FPU_PRESERVE with DirectX"; -- cgit v1.2.3