[packages/libmpack] build lua package

glen glen at pld-linux.org
Sat Sep 17 14:02:02 CEST 2016


commit d7f79747e0d4f331fb961c234e5d5a8f0d320f1d
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Sep 17 15:00:21 2016 +0300

    build lua package
    
    needs upstream commit for USE_SYSTEM_LUA:
    https://github.com/tarruda/libmpack/commit/0cc47f7e859b7124cf46483a6e59ed973bbe5e42

 libmpack.spec | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 lua.patch     | 18 ++++++++++++++++++
 2 files changed, 62 insertions(+), 1 deletion(-)
---
diff --git a/libmpack.spec b/libmpack.spec
index 176cc7d..2ce9ef8 100644
--- a/libmpack.spec
+++ b/libmpack.spec
@@ -1,3 +1,13 @@
+#
+# Conditional build:
+%bcond_without	lua		# build without tests
+
+%define	__lua	/usr/bin/lua5.1
+#define	luaver %(%{__lua} -e "print(string.sub(_VERSION, 5))")
+%define	luaver 5.1
+%define	lualibdir %{_libdir}/lua/%{luaver}
+%define	luapkgdir %{_datadir}/lua/%{luaver}
+
 Summary:	Simple implementation of msgpack in C
 Name:		libmpack
 Version:	1.0.2
@@ -6,10 +16,16 @@ License:	MIT
 Group:		Development/Libraries
 Source0:	https://github.com/tarruda/libmpack/archive/%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	a6320e37991bb56520d4670419edb43c
-Patch0:		https://patch-diff.githubusercontent.com/raw/tarruda/libmpack/pull/8.diff
+Patch0:		https://github.com/tarruda/libmpack/pull/8.diff
 # Patch0-md5:	91f4f18a5b74713465b392b3fe20d07a
+Patch1:		https://github.com/tarruda/libmpack/commit/0cc47f7e859b7124cf46483a6e59ed973bbe5e42.diff
+# Patch1-md5:	af5612df21a914fe0d06944196cfd274
+Patch2:		lua.patch
 URL:		https://github.com/tarruda/libmpack/
 BuildRequires:	libtool
+%if %{with lua}
+BuildRequires:	lua-devel >= %{luaver}
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -33,9 +49,20 @@ Requires:	%{name} = %{version}-%{release}
 %description devel
 Header files for %{name} library.
 
+%package -n lua-mpack
+Summary:	Lua binding to libmpack
+Group:		Development/Languages
+# does not link with libmpack.so
+#Requires:	%{name} = %{version}-%{release}
+
+%description -n lua-mpack
+Lua binding to libmpack.
+
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 %{__make} config=release \
@@ -46,6 +73,12 @@ Header files for %{name} library.
 	LIBDIR=%{_libdir} \
 	VERBOSE=1
 
+%if %{with lua}
+%{__make} -C binding/lua \
+	CC="%{__cc}" \
+	USE_SYSTEM_LUA=yes
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 %{__make} install \
@@ -53,6 +86,12 @@ rm -rf $RPM_BUILD_ROOT
 	LIBDIR=%{_libdir} \
 	DESTDIR=$RPM_BUILD_ROOT
 
+%if %{with lua}
+%{__make} -C binding/lua install \
+	USE_SYSTEM_LUA=yes \
+	DESTDIR=$RPM_BUILD_ROOT
+%endif
+
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libmpack.a
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libmpack.la
 
@@ -73,3 +112,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libmpack.so
 %{_includedir}/mpack.h
 %{_pkgconfigdir}/mpack.pc
+
+%files -n lua-mpack
+%defattr(644,root,root,755)
+%attr(755,root,root) %{lualibdir}/mpack.so
diff --git a/lua.patch b/lua.patch
new file mode 100644
index 0000000..f233cf3
--- /dev/null
+++ b/lua.patch
@@ -0,0 +1,18 @@
+--- libmpack-1.0.2/binding/lua/Makefile~	2016-09-17 14:54:37.000000000 +0300
++++ libmpack-1.0.2/binding/lua/Makefile	2016-09-17 14:54:46.623394052 +0300
+@@ -33,12 +33,12 @@
+ 	-Wstrict-prototypes -Wno-unused-parameter -pedantic
+ CFLAGS += -fPIC -DMPACK_DEBUG_REGISTRY_LEAK
+ 
+-LUA_INCLUDE := $(shell $(PKG_CONFIG) --cflags lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-I/usr/include/lua$(LUA_VERSION_MAJ_MIN)")
+-LUA_LIB := $(shell $(PKG_CONFIG) --libs lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-llua$(LUA_VERSION_MAJ_MIN)")
++LUA_INCLUDE := $(shell $(PKG_CONFIG) --cflags lua$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-I/usr/include/lua$(LUA_VERSION_MAJ_MIN)")
++LUA_LIB := $(shell $(PKG_CONFIG) --libs lua$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-llua$(LUA_VERSION_MAJ_MIN)")
+ INCLUDES = $(LUA_INCLUDE)
+ LIBS = $(LUA_LIB)
+ 
+-LUA_CMOD_INSTALLDIR := $(shell $(PKG_CONFIG) --variable=INSTALL_CMOD lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "/usr/lib/lua/$(LUA_VERSION_MAJ_MIN)")
++LUA_CMOD_INSTALLDIR := $(shell $(PKG_CONFIG) --variable=INSTALL_CMOD lua$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "/usr/lib/lua/$(LUA_VERSION_MAJ_MIN)")
+ 
+ 
+ # Misc
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libmpack.git/commitdiff/d7f79747e0d4f331fb961c234e5d5a8f0d320f1d



More information about the pld-cvs-commit mailing list