diff --git a/vis-0.9-lua-5.5.patch b/vis-0.9-lua-5.5.patch new file mode 100644 index 0000000..155a945 --- /dev/null +++ b/vis-0.9-lua-5.5.patch @@ -0,0 +1,38 @@ +diff -up vis-v0.9/vis-lua.c.lua55 vis-v0.9/vis-lua.c +--- vis-v0.9/vis-lua.c.lua55 2026-03-16 16:23:43.668922812 -0400 ++++ vis-v0.9/vis-lua.c 2026-03-16 16:25:41.892362312 -0400 +@@ -3208,7 +3208,11 @@ static void *alloc_lua(void *ud, void *p + * @function init + */ + void vis_lua_init(Vis *vis) { ++#if LUA_VERSION_NUM >= 505 ++ lua_State *L = lua_newstate(alloc_lua, vis, luaL_makeseed(0)); ++#else + lua_State *L = lua_newstate(alloc_lua, vis); ++#endif + if (!L) + return; + vis->lua = L; +diff -up vis-v0.9/vis-lua.h.lua55 vis-v0.9/vis-lua.h +--- vis-v0.9/vis-lua.h.lua55 2026-03-16 16:13:13.657846463 -0400 ++++ vis-v0.9/vis-lua.h 2026-03-16 16:15:26.159364325 -0400 +@@ -14,6 +14,19 @@ typedef void* lua_CFunction; + #include "vis.h" + #include "vis-subprocess.h" + ++#if LUA_VERSION_NUM >= 505 ++ ++#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) ++#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) ++#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) ++#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) ++#define luaL_optunsigned(L,a,d) \ ++ ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) ++#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) ++ ++#endif ++ ++ + /* add a directory to consider when loading lua files */ + bool vis_lua_path_add(Vis*, const char *path); + /* get semicolon separated list of paths to load lua files diff --git a/vis.spec b/vis.spec index 9768222..0bde034 100644 --- a/vis.spec +++ b/vis.spec @@ -13,6 +13,7 @@ Summary: A vim-like editor with structural regex from plan9 License: ISC AND MIT AND CC0-1.0 URL: https://git.sr.ht/~martanne/%{name} Source0: https://git.sr.ht/~martanne/%{name}/archive/v%{version}.tar.gz +Patch0: vis-0.9-lua-5.5.patch BuildRequires: make BuildRequires: gcc @@ -22,6 +23,7 @@ BuildRequires: pkgconfig(tre) BuildRequires: pkgconfig(lua) >= 5.2 BuildRequires: libacl-devel BuildRequires: pkgconfig(libselinux) +BuildRequires: lua-penlight Requires: lua-lpeg >= 0.12 Requires: xsel @@ -39,7 +41,7 @@ BuildArch: noarch %{summary} %prep -%autosetup -n vis-v%{version} +%autosetup -n vis-v%{version} -p1 %build %configure