#%{!?lua_version: %global lua_version %(lua -e "print(string.sub(_VERSION, 5))")}
%global lua_version 5.3
%global lua_libdir %{_libdir}/lua/%{lua_version}
%global lua_pkgdir %{_datadir}/lua/%{lua_version}
%global libmpack_version 1.0.5
BuildRequires: libtool
BuildRequires: lua >= 5.3
BuildRequires: lua-devel >= 5.3
Name: lua-mpack
Version: 1.0.7
Release: 2%{?dist}
License: MIT
Summary: Implementation of MessagePack for Lua
Url: https://github.com/libmpack/libmpack-lua
Requires: lua(abi) = %{lua_version}
Source0: https://github.com/libmpack/libmpack-lua/archive/%{version}/libmpack-lua-%{version}.tar.gz
Source1: https://github.com/libmpack/libmpack/archive/%{version}/libmpack-%{libmpack_version}.tar.gz
Source2: test_mpack.lua
%description
mpack is a small binary serialization/RPC library that implements
both the msgpack and msgpack-rpc specifications.
%prep
%autosetup -p1 -n libmpack-lua-%{version}
mkdir mpack-src
pushd mpack-src
tar xfz %{SOURCE1} --strip-components=1
popd
# hack to export flags
echo '#!/bin/sh' > ./configure
chmod +x ./configure
%build
%configure
make %{?_smp_mflags} \
USE_SYSTEM_MPACK=no \
USE_SYSTEM_LUA=yes \
LUA_INCLUDE="$(pkg-config --clfags lua)"
%install
make \
USE_SYSTEM_MPACK=no \
USE_SYSTEM_LUA=yes \
LUA_CMOD_INSTALLDIR=%{lua_libdir} \
DESTDIR=%{buildroot} \
install
%check
lua %{SOURCE2}
%files
%defattr(-,root,root)
%doc README.md
%{lua_libdir}/mpack.so
%changelog
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Fri Dec 08 2017 Andreas Schneider <asn@redhat.com> - 1.0.7-1
- Update to version 1.0.7
- Fix Building on 32bit platforms
* Wed Nov 08 2017 Andreas Schneider <asn@redhat.com> - 1.0.6-5
- Add a simple test for mpack
* Wed Nov 08 2017 Andreas Schneider <asn@redhat.com> - 1.0.6-4
- Update patch to compile with newer lua versions
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon May 08 2017 Andreas Schneider <asn@redhat.com> - 1.0.6-1
- Update to 1.0.6
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 01 2017 Andreas Schneider <asn@redhat.com> - 1.0.4-1
- resolves: #1417325 - Update to version 1.0.4
* Fri Nov 25 2016 Andreas Schneider <asn@redhat.com> - 1.0.3-5
- Add requirement on ABI version and do not package lua directory
* Thu Nov 24 2016 Andreas Schneider <asn@redhat.com> - 1.0.3-4
- Add the license correctly in the files section
* Tue Nov 15 2016 Andreas Schneider <asn@redhat.com> - 1.0.3-3
- Create a configure script so we export all flags
* Tue Nov 15 2016 Andreas Schneider <asn@redhat.com> - 1.0.3-2
- Removed Group:
- Removed BuildRoot:
* Mon Nov 14 2016 Andreas Schneider <asn@redhat.com> - 1.0.3-1
- Initial version 1.0.3