File libtorrent-rasterbar.spec of Package libtorrent-rasterbar

#
# spec file for package libtorrent-rasterbar
#
# 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 _name   libtorrent
%define sover   8
%define _version 1_0_9
%bcond_with examples
Name:           libtorrent-rasterbar
Version:        1.0.9
Release:        0
Summary:        Libtorrent is a C++ implementation of the BitTorrent protocol
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            http://rasterbar.com/products/libtorrent
Source:         https://github.com/arvidn/%{_name}/releases/download/%{_name}-%{_version}/%{name}-%{version}.tar.gz
BuildRequires:  boost-devel >= 1.36
BuildRequires:  gcc-c++
BuildRequires:  pkg-config
BuildRequires:  python-devel
BuildRequires:  pkgconfig(geoip)
BuildRequires:  pkgconfig(openssl)

%description
libtorrent-rasterbar is a C++ library that aims to be a good
alternative to all the other bittorrent implementations around.
It is a library and not a full featured client, although it comes
with a working example client.

The main goals of libtorrent-rasterbar are:
 * To be cpu efficient.
 * To be memory efficient.
 * To be very easy to use.

This package holds the sample client and example files for
libtorrent-rasterbar.

%package -n %{name}%{sover}
Summary:        Libtorrent is a C++ implementation of the BitTorrent protocol
Group:          System/Libraries

%description -n %{name}%{sover}
libtorrent-rasterbar is a C++ library that aims to be a good
alternative to all the other bittorrent implementations around.
It is a library and not a full featured client, although it comes
with a working example client.

The main goals of libtorrent-rasterbar are:
 * To be cpu efficient.
 * To be memory efficient.
 * To be very easy to use.

%package -n python-%{name}
Summary:        Python Bindings for libtorrent-rasterbar
Group:          Development/Libraries/Python

%description -n python-%{name}
Python Bindings for the libtorrent-rasterbar package.

%if %{with examples}
%package tools
Summary:        Example tools from libtorrent-rasterbar
Group:          Development/Libraries/C and C++

%description tools
Example tools from the libtorrent-rasterbar package.
%endif

%package devel
Summary:        Libtorrent is a C++ implementation of the BitTorrent protocol
Group:          Development/Libraries/C and C++
Requires:       %{name}%{sover} = %{version}
Requires:       boost-devel >= 1.36
Requires:       gcc-c++
Requires:       pkgconfig(geoip)
Requires:       pkgconfig(openssl)

%description devel
libtorrent-rasterbar is a C++ library that aims to be a good
alternative to all the other bittorrent implementations around.
It is a library and not a full featured client, although it comes
with a working example client.

The main goals of libtorrent-rasterbar are:
 * To be cpu efficient.
 * To be memory efficient.
 * To be very easy to use.

This package holds the development files for libtorrent-rasterbar.

%package doc
Summary:        Documentation for libtorrent-rasterbar
Group:          Documentation/HTML

%description doc
Documentation for the libtorrent-rasterbar package.

%prep
%setup -q

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="%{optflags} -lrt"

%configure \
  --disable-static               \
  --disable-silent-rules         \
  --with-libgeoip                \
  --with-boost-libdir=%{_libdir} \
%if %{with examples}
  --enable-examples              \
%endif
  --enable-python-binding        \
  --enable-encryption
make %{?_smp_mflags}

%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
# Move doc to a separate package.
mkdir -p %{buildroot}%{_docdir}/%{name}/
cp -r docs/* %{buildroot}%{_docdir}/%{name}/

%if %{with examples}
# Drop tests binaries from -tools subpackage.
rm -v %{buildroot}%{_bindir}/{client_test,connection_tester,enum_if,fragmentation_test} \
  %{buildroot}%{_bindir}/{parse_hash_fails,parse_request_log,rss_reader,upnp_test,utp_test}
%endif

%post -n %{name}%{sover} -p /sbin/ldconfig

%postun -n %{name}%{sover} -p /sbin/ldconfig

%if %{with examples}
%files tools
%defattr(-,root,root)
%{_bindir}/dump_torrent
%{_bindir}/make_torrent
%{_bindir}/simple_client
%endif

%files -n %{name}%{sover}
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING
%{_libdir}/%{name}.so.%{sover}*

%files -n python-%{name}
%defattr(-,root,root)
%{py_sitedir}/%{_name}.so
%{py_sitedir}/python_%{_name}-%{version}-py%{py_ver}.egg-info

%files devel
%defattr(-,root,root)
%{_includedir}/%{_name}/
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

%files doc
%defattr(-,root,root)
%doc %{_docdir}/%{name}/

%changelog