SHA256
10
0
forked from pool/lua-mpack

Make the package buildable with LuaJIT.

Removed upstreamed patches:
  - lua51-mpack-fix-compilation.patch
  - lua51-mpack-fix-gcc7.patch
Add luajit-build.patch to make the source compatible with Lua
  API < 5.2.
This commit is contained in:
2025-10-13 15:29:56 +02:00
parent 9eb1539311
commit 348da6a4b4
9 changed files with 54 additions and 51 deletions

1
.gitattributes vendored
View File

@@ -21,3 +21,4 @@
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*.changes merge=merge-changes

5
.gitignore vendored
View File

@@ -1 +1,6 @@
.osc
*.obscpio
*.osc
_build.*
.pbuild
lua*-mpack-*-build/

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66811e30b316b53d1e3c4225248d4813b8b852c3e19121ba5ad47a9d4537d1ae
size 14557

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Oct 13 13:21:48 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Make the package buildable with LuaJIT.
- Removed upstreamed patches:
- lua51-mpack-fix-compilation.patch
- lua51-mpack-fix-gcc7.patch
- Add luajit-build.patch to make the source compatible with Lua
API < 5.2 (gh#libmpack/libmpack-lua!34).
-------------------------------------------------------------------
Thu Feb 22 09:55:44 UTC 2024 - Michael Vetter <mvetter@suse.com>

View File

@@ -19,24 +19,22 @@
%define flavor @BUILD_FLAVOR@
%define libmpack_version 1.0.5
%define mod_name mpack
Version: 1.0.6
Version: 1.0.12
Release: 0
Summary: Implementation of MessagePack for Lua 5.1
License: MIT
Group: Development/Libraries/Other
URL: https://github.com/libmpack/libmpack-lua
Source: https://github.com/libmpack/libmpack-lua/archive/%{version}.tar.gz
# libmpack source is necessary to build lua-mpack, next release should build
# fine against system version
# The latest source can be downloaded from: https://github.com/libmpack/libmpack
Source1: https://github.com/libmpack/libmpack/archive/%{libmpack_version}/libmpack-%{libmpack_version}.tar.gz
# PATCH-FIX-UPSTREAM lua51-mpack-fix-gcc7.patch gh#libmpack/libmpack-lua#3 -- Fix compilation error when using GCC7.
Patch0: lua51-mpack-fix-gcc7.patch
# PATCH-FIX-UPSTREAM lua51-mpack-fix-compilation.patch gh#libmpack/libmpack-lua#2 -- Fix compilation error when using `USE_SYSTEM_LUA=1`.
Patch1: lua51-mpack-fix-compilation.patch
Source: https://github.com/libmpack/libmpack-lua/archive/refs/tags/%{version}.tar.gz#/%{mod_name}-%{version}.tar.gz
# libmpack source is necessary to build lua-mpack, need to package mpack to Factory
Source1: https://github.com/libmpack/libmpack/archive/refs/tags/%{libmpack_version}.tar.gz#/libmpack-%{libmpack_version}.tar.gz
# PATCH-FIX-UPSTREAM luajit-build.patch gh#libmpack/libmpack-lua!34 mcepl@suse.com
# Add #define to mask Lua API 5.1 / 5.2 incompatibility
Patch2: luajit-build.patch
BuildRequires: %{flavor}-devel
BuildRequires: gcc
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: lua-macros
Requires: %{flavor}
%lua_provides
@@ -54,12 +52,8 @@ and msgpack-rpc specifications.
%prep
%autosetup -p1 -n libmpack-lua-%{version}
# Extract the libmpack source to the right directory.
mkdir -p mpack-src
pushd mpack-src
cp %{SOURCE1} ./
tar --strip-components=1 -xzf libmpack-%{libmpack_version}.tar.gz
popd
( mkdir -p "mpack-src" && cd "mpack-src"
tar --extract --strip-components=1 --file %{SOURCE1} )
# Fix lua directory.
sed -i 's|LUA_CMOD_INSTALLDIR :=.*|LUA_CMOD_INSTALLDIR := $(shell echo "%{lua_archdir}")|g' Makefile
@@ -67,15 +61,16 @@ sed -i 's|LUA_CMOD_INSTALLDIR :=.*|LUA_CMOD_INSTALLDIR := $(shell echo "%{lua_ar
%build
make %{?_make_output_sync} %{?_smp_mflags} \
USE_SYSTEM_LUA=yes \
MPACK_LUA_VERSION=%{lua_version} \
CFLAGS="%{optflags} -fPIC"
USE_SYSTEM_MPACK=no \
LUA_IMPL="lua" \
CFLAGS="%{optflags} -fPIC %(pkgconf --cflags --libs lua)"
%install
%make_install USE_SYSTEM_LUA=yes
%make_install USE_SYSTEM_LUA=yes \
LUA_CMOD_INSTALLDIR="%{lua_archdir}"
%files
%doc mpack-src/LICENSE-MIT README.md
%dir %{lua_archdir}
%{lua_archdir}/*
%{lua_archdir}/mpack.so
%changelog

View File

@@ -1,13 +0,0 @@
Index: libmpack-lua-1.0.6/Makefile
===================================================================
--- libmpack-lua-1.0.6.orig/Makefile
+++ libmpack-lua-1.0.6/Makefile
@@ -99,7 +99,7 @@ $(MPACK): $(LUAROCKS) mpack-src lmpack.c
$(LUAROCKS) make CFLAGS='$(CFLAGS)'
else
$(MPACK): mpack-src lmpack.c
- $(CC) -shared $(CFLAGS) $(INCLUDES) $(LDFLAGS) $^ -o $@ $(LIBS)
+ $(CC) -shared $(CFLAGS) $(INCLUDES) $(LDFLAGS) lmpack.c -o $@ $(LIBS)
endif
$(BUSTED): $(LUAROCKS)

View File

@@ -1,14 +0,0 @@
Index: libmpack-lua-1.0.6/lmpack.c
===================================================================
--- libmpack-lua-1.0.6.orig/lmpack.c
+++ libmpack-lua-1.0.6/lmpack.c
@@ -689,6 +689,7 @@ static void lmpack_unparse_enter(mpack_p
node->tok = mpack_pack_nil();
break;
}
+ /* Fallthrough */
default:
luaL_error(L, "can't serialize object");
}
%changelog

19
luajit-build.patch Normal file
View File

@@ -0,0 +1,19 @@
---
lmpack.c | 4 ++++
1 file changed, 4 insertions(+)
Index: libmpack-lua-1.0.12/lmpack.c
===================================================================
--- libmpack-lua-1.0.12.orig/lmpack.c 2024-02-07 00:28:09.000000000 +0100
+++ libmpack-lua-1.0.12/lmpack.c 2025-10-13 15:00:35.793539104 +0200
@@ -54,6 +54,10 @@
#define luaL_reg luaL_Reg
#endif
+#if LUA_VERSION_NUM < 502
+# define luaL_reg luaL_Reg
+#endif
+
#if LUA_VERSION_NUM > 501
#ifndef luaL_register
#define luaL_register(L,n,f) luaL_setfuncs(L,f,0)

BIN
mpack-1.0.12.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.