From 93d3b245edcb2ff7c3dacd6f382e7ec8b8de6c9edd238f44489ae1b445d22a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 19 Jun 2017 10:47:16 +0000 Subject: [PATCH] Accepting request 504614 from home:susnux:branches:multimedia:apps Fixed for tumbleweed OBS-URL: https://build.opensuse.org/request/show/504614 OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/aegisub?expand=0&rev=41 --- aegisub.changes | 5 ++ aegisub.spec | 2 + luabins.patch | 174 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 181 insertions(+) create mode 100644 luabins.patch diff --git a/aegisub.changes b/aegisub.changes index 6337323..bfcc790 100644 --- a/aegisub.changes +++ b/aegisub.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jun 19 10:43:28 UTC 2017 - rpm@fthiessen.de + +- Added luabins.patch to fix build with lua 5.2 / 5.3. + ------------------------------------------------------------------- Mon Jun 5 07:47:20 UTC 2017 - tchvatal@suse.com diff --git a/aegisub.spec b/aegisub.spec index a408173..216bd79 100644 --- a/aegisub.spec +++ b/aegisub.spec @@ -31,6 +31,7 @@ Patch1: Makefile.inc.in.patch Patch2: remove-vendor-luajit-dependency.patch Patch3: icu59.patch Patch4: aegisub-no-optimize.patch +Patch5: luabins.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc-c++ @@ -76,6 +77,7 @@ functions with ease. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y') sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/version.cpp FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S') diff --git a/luabins.patch b/luabins.patch new file mode 100644 index 0000000..00fa2ec --- /dev/null +++ b/luabins.patch @@ -0,0 +1,174 @@ +diff -Nur aegisub-3.2.2/libaegisub/lua/modules/lpeg.c new/libaegisub/lua/modules/lpeg.c +--- aegisub-3.2.2/libaegisub/lua/modules/lpeg.c 2014-12-08 01:07:09.000000000 +0100 ++++ new/libaegisub/lua/modules/lpeg.c 2017-06-19 12:33:03.929957005 +0200 +@@ -2334,7 +2334,7 @@ + } + + +-static struct luaL_reg pattreg[] = { ++static struct luaL_Reg pattreg[] = { + {"match", matchl}, + {"print", printpat_l}, + {"locale", locale_l}, +@@ -2360,7 +2360,7 @@ + }; + + +-static struct luaL_reg metapattreg[] = { ++static struct luaL_Reg metapattreg[] = { + {"__add", union_l}, + {"__pow", star_l}, + {"__sub", diff_l}, +diff -Nur aegisub-3.2.2/vendor/luabins/AUTHORS new/vendor/luabins/AUTHORS +--- aegisub-3.2.2/vendor/luabins/AUTHORS 2014-12-08 01:07:09.000000000 +0100 ++++ new/vendor/luabins/AUTHORS 2016-12-17 08:09:13.000000000 +0100 +@@ -2,3 +2,4 @@ + ---------------- + + Alexander Gladysh ++hanxi +diff -Nur aegisub-3.2.2/vendor/luabins/README.md new/vendor/luabins/README.md +--- aegisub-3.2.2/vendor/luabins/README.md 2014-12-08 01:07:09.000000000 +0100 ++++ new/vendor/luabins/README.md 2016-12-17 08:09:13.000000000 +0100 +@@ -4,6 +4,8 @@ + Allows to save tuples of primitive Lua types into binary chunks + and to load saved data back. + ++NB: You may be better off with luatexts: https://github.com/agladysh/luatexts. ++ + On serialization + ---------------- + +diff -Nur aegisub-3.2.2/vendor/luabins/src/luabins.c new/vendor/luabins/src/luabins.c +--- aegisub-3.2.2/vendor/luabins/src/luabins.c 2014-12-08 01:07:09.000000000 +0100 ++++ new/vendor/luabins/src/luabins.c 2016-12-17 08:09:13.000000000 +0100 +@@ -54,7 +54,7 @@ + } + + /* luabins Lua module API */ +-static const struct luaL_reg R[] = ++static const struct luaL_Reg R[] = + { + { "save", l_save }, + { "load", l_load }, +diff -Nur aegisub-3.2.2/vendor/luabins/src/luaheaders.h new/vendor/luabins/src/luaheaders.h +--- aegisub-3.2.2/vendor/luabins/src/luaheaders.h 2014-12-08 01:07:09.000000000 +0100 ++++ new/vendor/luabins/src/luaheaders.h 2016-12-17 08:09:13.000000000 +0100 +@@ -7,6 +7,16 @@ + + #include + #include ++ ++#if !defined LUA_VERSION_NUM ++#define luaL_Reg luaL_reg ++#endif ++ ++#if LUA_VERSION_NUM > 501 ++#define luaL_register(L,n,R) (luaL_newlib(L,R)) ++#define lua_objlen(L,i) lua_rawlen(L, (i)) ++#endif ++ + #if defined (__cplusplus) && !defined (LUABINS_LUABUILTASCPP) + } + #endif +diff -Nur aegisub-3.2.2/vendor/luabins/src/luainternals.h new/vendor/luabins/src/luainternals.h +--- aegisub-3.2.2/vendor/luabins/src/luainternals.h 2014-12-08 01:07:09.000000000 +0100 ++++ new/vendor/luabins/src/luainternals.h 2017-06-19 12:26:34.402690003 +0200 +@@ -7,6 +7,24 @@ + #ifndef LUABINS_LUAINTERNALS_H_INCLUDED_ + #define LUABINS_LUAINTERNALS_H_INCLUDED_ + ++#ifndef LUAI_BITSINT ++/* ++* LUAI_BITSINT defines the number of bits in an int. ++* CHANGE here if Lua cannot automatically detect the number of bits of ++* your machine. Probably you do not need to change this. ++* ++* avoid overflows in comparison */ ++#if INT_MAX-20 < 32760 ++#define LUAI_BITSINT 16 ++#elif INT_MAX > 2147483640L ++/* int has at least 32 bits */ ++#define LUAI_BITSINT 32 ++#else ++#error "you must define LUA_BITSINT with number of bits in an integer" ++#endif ++ ++#endif // ifndef LUAI_BITSINT ++ + /* + * BEGIN COPY-PASTE FROM Lua 5.1.4 luaconf.h + * WARNING: If your Lua config differs, fix this! +@@ -38,7 +56,6 @@ + /* + ** max size of array part is 2^MAXBITS + */ +-#define LUAI_BITSINT 32 + #if LUAI_BITSINT > 26 + #define MAXBITS 26 + #else +diff -Nur aegisub-3.2.2/vendor/luabins/src/lualess.c new/vendor/luabins/src/lualess.c +--- aegisub-3.2.2/vendor/luabins/src/lualess.c 1970-01-01 01:00:00.000000000 +0100 ++++ new/vendor/luabins/src/lualess.c 2016-12-17 08:09:13.000000000 +0100 +@@ -0,0 +1,32 @@ ++/* ++* lualess.h ++* Lua-related definitions for lua-less builds (based on Lua manual) ++* See copyright notice in luabins.h ++*/ ++ ++#include ++ ++/* ++* lua_Alloc-compatible allocator to use in Lua-less applications ++* with lbs_SaveBuffer. Based on sample code from Lua 5.1 manual. ++*/ ++void * lbs_simplealloc( ++ void * ud, ++ void * ptr, ++ size_t osize, ++ size_t nsize ++ ) ++{ ++ (void) ud; ++ (void) osize; /* not used */ ++ ++ if (nsize == 0) ++ { ++ free(ptr); ++ return NULL; ++ } ++ else ++ { ++ return realloc(ptr, nsize); ++ } ++} +diff -Nur aegisub-3.2.2/vendor/luabins/test/test.lua new/vendor/luabins/test/test.lua +--- aegisub-3.2.2/vendor/luabins/test/test.lua 2014-12-08 01:07:09.000000000 +0100 ++++ new/vendor/luabins/test/test.lua 2016-12-17 08:09:13.000000000 +0100 +@@ -6,6 +6,8 @@ + + package.cpath = "./?.so;"..package.cpath + ++local pack = pack or table.pack ++local unpack = unpack or table.unpack + local randomseed = 1235134892 + --local randomseed = os.time() + +@@ -145,6 +147,7 @@ + -- Test helper functions + -- ---------------------------------------------------------------------------- + ++luabins = require 'luabins' + local luabins_local = require 'luabins' + assert(luabins_local == luabins) + +@@ -281,7 +284,7 @@ + "can't save: unsupported type detected", + coroutine.create(function() end) + ) +-check_fail_save("can't save: unsupported type detected", newproxy()) ++check_fail_save("can't save: unsupported type detected", function()end) + + print("---> basic table tests") +