SHA256
12
0
forked from pool/lua-mpack
lua-mpack/lua51-mpack.spec

82 lines
2.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package lua51-mpack
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
%define lua_archdir %{_libdir}/lua/%{lua_version}
%define libmpack_version 1.0.5
Name: lua51-mpack
Version: 1.0.6
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 lua51-mpack.
# The latest source can be downloaded from: https://github.com/libmpack/libmpack
Source1: 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
BuildRequires: gcc
BuildRequires: libtool
BuildRequires: lua51-devel
Requires: lua51
%description
mpack is a small binary serialization/RPC library that implements
both the msgpack and msgpack-rpc specifications.
%prep
%setup -q -n libmpack-lua-%{version}
%patch0 -p1
%patch1 -p1
# 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
# Fix lua directory.
sed -i 's|LUA_CMOD_INSTALLDIR :=.*|LUA_CMOD_INSTALLDIR := $(shell echo "%{_libdir}/lua/%{lua_version}")|g' Makefile
# Fix Lua 5.1 library name if we are building for Leap 42.3.
%if 0%{?leap_version} == 420300
sed -i 's|LUA_LIB :=.*|LUA_LIB := -llua|g' Makefile
%endif
%build
make %{?_smp_mflags} USE_SYSTEM_LUA=yes
%install
make USE_SYSTEM_LUA=yes \
DESTDIR=%{buildroot} \
install
%files
%defattr(-,root,root)
%doc mpack-src/LICENSE-MIT README.md
%dir %{lua_archdir}
%{lua_archdir}/*
%changelog