File luabind.spec of Package luabind
#
# spec file for package luabind
#
# Copyright (c) 2016 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 base_version 0.9.1
%define sover %(echo "%{base_version}" | sed "s/\\./_/g")
Name: luabind
Version: %{base_version}+20150408
Release: 0
Summary: Lua C++ bindings
License: GPL-2.0
Group: Development/Libraries/C and C++
Url: https://github.com/rpavlik/luabind
Source: %{name}-%{version}.tar.xz
Source99: update.sh
Patch0: fix-cmake-lib-version.patch
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: pkgconfig(lua)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%package devel
Summary: Luabind headers
Group: Development/Libraries/C and C++
Requires: lib%{name}%{sover} = %{version}
Requires: lua-devel
%package -n lib%{name}%{sover}
Summary: Luabind Library
Group: Development/Libraries/C and C++
%description
Luabind is a library that helps you create bindings between C++ and Lua.
It has the ability to expose functions and classes, written in C++, to Lua.
%description devel
Luabind is a library that helps you create bindings between C++ and Lua.
It has the ability to expose functions and classes, written in C++, to Lua.
This package contains needed development files like headers.
%description -n lib%{name}%{sover}
Luabind is a library that helps you create bindings between C++ and Lua.
It has the ability to expose functions and classes, written in C++, to Lua.
This package contains the library.
%prep
%setup -q
%patch0 -p1
%build
%cmake -DBUILD_SHARED_LUABIND=ON -DLIB_DIR="%{_lib}"
FREEMEM="$(cat /proc/meminfo | grep -Po 'MemFree.*(\d+)' | grep -Po '\d+')"
N="$(nproc)"
# Needs about 350MB / Thread (or get killed because of oom)
if [ "$(($FREEMEM/350000))" -lt "$N" ]; then
N="$(($FREEMEM/350000))"
fi
[ "$N" -eq "0" ] && N=1
make -j$N
%install
%cmake_install
# Create a pkgconfig file
mkdir -p "%{buildroot}%{_libdir}/pkgconfig"
cat > "%{buildroot}%{_libdir}/pkgconfig/%{name}.pc" << EOF
prefix=%{_prefix}
exec_prefix=%{_exec_prefix}
includedir=%{_includedir}
libdir=%{_libdir}
Name: %{name}
Description: %{description}
Version: %{base_version}
Cflags: -I$${includedir}
Libs: -L$${libdir} -l%{name}
EOF
%post -n lib%{name}%{sover} -p /sbin/ldconfig
%postun -n lib%{name}%{sover} -p /sbin/ldconfig
%files devel
%defattr(-,root,root)
%{_includedir}/luabind
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/lib%{name}.so
%files -n lib%{name}%{sover}
%defattr(-,root,root)
%doc LICENSE
%{_libdir}/lib%{name}.so.*
%changelog