File libmsgpack.spec of Package libmsgpack

%define realname msgpack
%define realver  3.0.1
%define srcext   tar.gz

%define so_ver   2

# Common info
Name:          libmsgpackc%{?so_ver}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         System/Libraries
URL:           http://msgpack.org/
Summary:       Extremely efficient object serialization library

# Install-time parameters
Provides:      libmsgpack%{?so_ver} = %{version}
Provides:      %{realname} = %{version}

# Build-time parameters
BuildRequires: cmake >= 2.8.12
BuildRequires: gcc-c++ libstdc++-devel boost-devel
BuildRequires: pkgconfig
BuildRequires: ruby
BuildRequires: zlib-devel
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://github.com/msgpack/msgpack-c/releases/download/cpp-%{realver}/%{realname}-%{realver}.tar.gz

%description
MessagePack is an efficient binary serialization format. It lets you exchange
data among multiple languages like JSON. But it's faster and smaller. Small
integers are encoded into a single byte, and typical short strings require only
one extra byte in addition to the strings themselves.

%package -n libmsgpackc-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}
Provides:      libmsgpack-devel %{realname}-devel

%description -n libmsgpackc-devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
%{__mkdir} build
cd build
cmake .. \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \
 -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all" \
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all" \
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all -shared" \
 -DCMAKE_SKIP_INSTALL_RPATH=YES \
 -DCMAKE_SKIP_RPATH=YES \
 -DCMAKE_VERBOSE_MAKEFILE=YES \
 \
%ifarch x86_64
 -DMSGPACK_32BIT=NO \
%else
 -DMSGPACK_32BIT=YES \
%endif
 -DMSGPACK_BOOST=YES \
 -DMSGPACK_BUILD_EXAMPLES=NO \
 -DMSGPACK_BUILD_TESTS=NO
%{__make} %{?_smp_mflags}

%install
%{__make} -C build install DESTDIR=%{buildroot}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc README.md COPYING LICENSE_1_0.txt NOTICE
%{_libdir}/libmsgpackc.so.%{?so_ver}*

# Development stuff
%files -n libmsgpackc-devel
%defattr(-,root,root)
%dir %{_libdir}/cmake/msgpack
%dir %{_libdir}/cmake
%{_libdir}/cmake/msgpack/*.cmake
%{_libdir}/pkgconfig/msgpack.pc
%{_includedir}/msgpack/
%{_includedir}/msgpack.h
%{_includedir}/msgpack.hpp
%{_libdir}/libmsgpackc.a
%{_libdir}/libmsgpackc.so
%if 0%{?suse_version} || 0%{?rhel} >= 7
%exclude %{_libdir}/libmsgpackc.la
%endif

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by