File cpp-netlib.spec of Package cpp-netlib

#
# spec file for package cpp-netlib
#
# 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/
#


%if %{suse_version} <= 1320
%define boost_devel boost_1_58_0-devel
%else
%define boost_devel boost-devel >= 1.54
%endif
%define so_suffix 0
Name:           cpp-netlib
Version:        0.12.0
Release:        0
Summary:        High level network programming libraries
License:        BSL-1.0
Group:          Development/Libraries/C and C++
Url:            http://cpp-netlib.org
Source:         http://downloads.cpp-netlib.org/%{version}/%{name}-%{version}-final.tar.bz2
# PATCH-FIX-UPSTREAM fix-pthreads-missing.patch -- Fix missing pthreads libraries (linker)
Patch0:         fix-pthreads-missing.patch
BuildRequires:  %{boost_devel}
BuildRequires:  cmake >= 2.8
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig(libssl)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The project aims to build upon the latest C++ standard (currently C++11)
to provide easy to use libraries for network programming.
We use the latest compiler versions and features with an eye on pushing
the boundaries on leveraging what's available in C++.

Currently the library contains an HTTP client and server implementation,
a stand-alone URI library, a network message framework, and some concurrency tools.

%package devel
Summary:        Development files for cpp-netlib
Requires:       libcppnetlib-client-connections%{so_suffix}
Requires:       libcppnetlib-server-parsers%{so_suffix}
Requires:       libcppnetlib-uri%{so_suffix}
Requires:       %{boost_devel}
Recommends:     cmake

%description devel
Development files for cpp-netlib, cpp-netlib is a collection of high level
network programming libraries.

%package -n libcppnetlib-client-connections%{so_suffix}
Summary:        Provides client part of cpp-netlib

%description -n libcppnetlib-client-connections%{so_suffix}
Client library of cpp-netlib, cpp-netlib is a collection of high level
network programming libraries.

%package -n libcppnetlib-server-parsers%{so_suffix}
Summary:        Provides server part of cpp-netlib

%description -n libcppnetlib-server-parsers%{so_suffix}
Server library of cpp-netlib, cpp-netlib is a collection of high level
network programming libraries.

%package -n libcppnetlib-uri%{so_suffix}
Summary:        Provides URI library of cpp-netlib

%description -n libcppnetlib-uri%{so_suffix}
URI library of cpp-netlib, cpp-netlib is a collection of high level
network programming libraries.

%prep
%setup -q -n %{name}-%{version}-final
%patch0 -p1

%build
%cmake \
	-DCPP-NETLIB_BUILD_SHARED_LIBS=ON \
	-DCPP-NETLIB_ENABLE_HTTPS=ON \
	-DCPP-NETLIB_BUILD_EXPERIMENTS=OFF \
	-DCPP-NETLIB_BUILD_EXAMPLES=OFF \
	-DCPP-NETLIB_BUILD_TESTS=OFF

# Memory exhausting if threads are more then one on OBS
make -j1 VERBOSE=1

# Does not work on OBS (need internet access)
#%%check
#cd build
#make test

%install
%cmake_install
mkdir -p %{buildroot}%{_docdir}/%{name}/
cp README.rst %{buildroot}%{_docdir}/%{name}/README
cp LICENSE_1_0.txt %{buildroot}%{_docdir}/%{name}/LICENSE

%post -n libcppnetlib-client-connections%{so_suffix}
/sbin/ldconfig

%postun -n libcppnetlib-client-connections%{so_suffix}
/sbin/ldconfig

%post -n libcppnetlib-server-parsers%{so_suffix}
/sbin/ldconfig

%postun -n libcppnetlib-server-parsers%{so_suffix}
/sbin/ldconfig

%post -n libcppnetlib-uri%{so_suffix}
/sbin/ldconfig

%postun -n libcppnetlib-uri%{so_suffix}
/sbin/ldconfig

%files -n libcppnetlib-client-connections%{so_suffix}
%defattr(-,root,root)
%{_libdir}/libcppnetlib-client-connections.so.*

%files -n libcppnetlib-server-parsers%{so_suffix}
%defattr(-,root,root)
%{_libdir}/libcppnetlib-server-parsers.so.*

%files -n libcppnetlib-uri%{so_suffix}
%defattr(-,root,root)
%{_libdir}/libcppnetlib-uri.so.*

%files devel
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%{_includedir}/boost/network/
%{_includedir}/boost/mime.hpp
%{_includedir}/boost/network.hpp
%{_libdir}/cmake/cppnetlib
%{_libdir}/libcppnetlib-client-connections.so
%{_libdir}/libcppnetlib-server-parsers.so
%{_libdir}/libcppnetlib-uri.so

%changelog