File libtorrent-rasterbar-custom.spec of Package libtorrent-rasterbar-custom

#
# spec file for package qbittorrent
#
# Copyright (c) 2025 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define _name       libtorrent
%define source_name libtorrent-rasterbar
%define libver      2_0
%define sover       2.0


Name:           libtorrent-rasterbar-custom
Version:        2.0.11
Release:        0
Summary:        Efficient feature-complete C++ BitTorrent implementation

License:        BSD-2-Clause
URL:            https://www.libtorrent.org/
Source0:        https://github.com/arvidn/libtorrent/releases/download/v%{version}/%{source_name}-%{version}.tar.gz

# BUILD REQUIREMENTS for SUSE Leap 15.6 Only
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
BuildRequires:  boost-custom-devel
BuildRequires:  cmake
BuildRequires:  gcc13  gcc13-c++  libstdc++6-devel-gcc13
BuildRequires:  glibc  glibc-devel
BuildRequires:  make
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
# BuildRequires:  pkgconfig(python3)
# BuildRequires:  python3-setuptools
%endif
#
# BUILD REQUIREMENTS for SUSE Leap 16.0 / SUSE TumbleWeed
%if 0%{?suse_version} >= 1600 && 0%{?is_opensuse}
BuildRequires:  boost-custom-devel
BuildRequires:  cmake
BuildRequires:  gcc  gcc-c++
# BUILD REQUIREMENTS for SUSE TumbleWeed Only
%if 0%{?suse_version} > 1600 && 0%{?is_opensuse}
BuildRequires:  gcc-devel
%endif
#
BuildRequires:  glibc  glibc-devel
BuildRequires:  make
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
# BuildRequires:  pkgconfig(python3)
# BuildRequires:  python3-setuptools
%endif
#
# BUILD REQUIREMENTS for FEDORA
%if 0%{?fedora}
BuildRequires:  boost-custom-devel
BuildRequires:  cmake
BuildRequires:  gcc  gcc-c++  gcc-plugin-devel
BuildRequires:  glibc  glibc-devel
BuildRequires:  make
BuildRequires:  ninja-build
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
# BuildRequires:  pkgconfig(python3)
# BuildRequires:  python3-setuptools
%endif
#
# BUILD REQUIREMENTS for MAGEIA
%if 0%{?mageia}
BuildRequires:  boost-custom-devel
BuildRequires:  cmake
BuildRequires:  gcc  gcc-c++
BuildRequires:  glibc  glibc-devel
BuildRequires:  ninja
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
# BuildRequires:  pkgconfig(python3)
# BuildRequires:  python3-setuptools
%endif
#

Requires:       %{source_name}%{libver} = %{version}

# PROVIDING REQUIREMENTS for SUSE / FEDORA
Provides:       %{source_name} = %{version}
Provides:       rb_%{_name}    = %{version}
#
# PROVIDING REQUIREMENTS for MAGEIA
%if 0%{?mageia}
%ifarch %ix86
Provides:       %{source_name}%{sover} = %{version}
%else
Provides:       lib64torrent-rasterbar%{sover} = %{version}
%endif
%endif
#
# CONFLICTING REQUIREMENTS for SUSE / FEDORA
Conflicts:      %{source_name}
Conflicts:      rb_%{_name}
#
# CONFLICTING REQUIREMENTS for MAGEIA
%if 0%{?mageia}
%ifarch %ix86
Conflicts:      %{source_name}%{sover}
%else
Conflicts:      lib64torrent-rasterbar%{sover}
%endif
%endif
#
# OBSOLETING REQUIREMENTS for SUSE / FEDORA
Obsoletes:      %{source_name} < %{version}
Obsoletes:      rb_%{_name}    < %{version}
#
# OBSOLETING REQUIREMENTS for MAGEIA
%if 0%{?mageia}
%ifarch %ix86
Obsoletes:      %{source_name}%{sover} < %{version}
%else
Obsoletes:      lib64torrent-rasterbar%{sover} < %{version}
%endif
%endif
#

%description
LibTorrent Rasterbar is a high-performance,
feature-rich C++ library implementing the BitTorrent protocol,
along with support for the most popular protocol extensions.
Designed for both real-world deployments and embedded systems,
LibTorrent Rasterbar provides a
flexible and efficient solution for peer-to-peer file distribution.

The library is highly configurable and can be integrated into
both client and server applications.
Its main goals are efficiency, scalability, and ease of use.
LibTorrent Rasterbarr includes advanced features such as
DHT (Distributed Hash Table), uTP (Micro Transport Protocol),
support for magnet links, IPv6, and robust extension mechanisms.

With a comprehensive API and thorough documentation,
LibTorrent Rasterbar enables developers to build modern BitTorrent
applications with minimal effort while maintaining optimal
resource usage and performance.

%package -n %{source_name}%{libver}
Summary:        Efficient feature-complete C++ BitTorrent implementation; Library version 2_0

Provides:       %{name}%{libver}          = %{version}

Conflicts:      %{source_name}%{libver}

Obsoletes:      %{source_name}%{libver}   < %{version}

%description -n %{source_name}%{libver}
LibTorrent Rasterbar is a high-performance,
feature-rich C++ library implementing the BitTorrent protocol,
along with support for the most popular protocol extensions.
Designed for both real-world deployments and embedded systems,
LibTorrent Rasterbar provides a
flexible and efficient solution for peer-to-peer file distribution.

The library is highly configurable and can be integrated into
both client and server applications.
Its main goals are efficiency, scalability, and ease of use.
LibTorrent Rasterbarr includes advanced features such as
DHT (Distributed Hash Table), uTP (Micro Transport Protocol),
support for magnet links, IPv6, and robust extension mechanisms.

With a comprehensive API and thorough documentation,
LibTorrent Rasterbar enables developers to build modern BitTorrent
applications with minimal effort while maintaining optimal
resource usage and performance.

%package devel
Summary:        Development files and Headers for LibTorrent-Rasterbar

# DEVEL BUILD REQUIREMENTS for SUSE Leap 15.6 Only
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
Requires:  boost-custom-devel
Requires:  gcc13  gcc13-c++  libstdc++6-devel-gcc13
Requires:  glibc  glibc-devel
Requires:  pkgconfig
Requires:  pkgconfig(openssl)
Requires:  %{source_name}%{libver} = %{version}
%endif
#
# DEVEL BUILD REQUIREMENTS for SUSE Leap 16.0 / SUSE TumbleWeed
%if 0%{?suse_version} >= 1600 && 0%{?is_opensuse}
Requires:  boost-custom-devel
Requires:  gcc  gcc-c++
# DEVEL BUILD REQUIREMENTS for SUSE TumbleWeed Only
%if 0%{?suse_version} > 1600 && 0%{?is_opensuse}
Requires:  gcc-devel
%endif
#
Requires:  glibc  glibc-devel
Requires:  pkgconfig
Requires:  pkgconfig(openssl)
Requires:  %{source_name}%{libver} = %{version}
%endif
#
# DEVEL BUILD REQUIREMENTS for FEDORA
%if 0%{?fedora}
Requires:  gcc  gcc-c++  gcc-plugin-devel
Requires:  glibc  glibc-devel
Requires:  libstdc++  libstdc++-devel
Requires:  pkgconfig
Requires:  pkgconfig(openssl)
Requires:  %{source_name}%{libver} = %{version}
%endif
#
# DEVEL BUILD REQUIREMENTS for MAGEIA
%if 0%{?mageia}
Requires:  gcc  gcc-c++
Requires:  glibc  glibc-devel
Requires:  libstdc++  libstdc++-devel
Requires:  pkgconfig
Requires:  pkgconfig(openssl)
Requires:  %{source_name}%{libver} = %{version}
%endif
#

# PROVIDING REQUIREMENTS for SUSE / FEDORA
Provides:       %{source_name}-devel = %{version}
Provides:       rb_%{_name}-devel    = %{version}
#
# PROVIDING REQUIREMENTS for MAGEIA
%if 0%{?mageia}
%ifarch %ix86
Provides:       %{source_name}-devel         = %{version}
%else
Provides:       lib64torrent-rasterbar-devel = %{version}
%endif
%endif
#
# CONFLICTING REQUIREMENTS for SUSE / FEDORA
Conflicts:      %{source_name}-devel
Conflicts:      rb_%{_name}-devel
#
# CONFLICTING REQUIREMENTS for MAGEIA
%if 0%{?mageia}
%ifarch %ix86
Conflicts:      %{source_name}-devel
%else
Conflicts:      lib64torrent-rasterbar-devel
%endif
%endif
#
# OBSOLETING REQUIREMENTS for SUSE / FEDORA
Obsoletes:       %{source_name}-devel < %{version}
Obsoletes:       rb_%{_name}-devel    < %{version}
#
# OBSOLETING REQUIREMENTS for MAGEIA
%if 0%{?mageia}
%ifarch %ix86
Obsoletes:       %{source_name}-devel         < %{version}
%else
Obsoletes:       lib64torrent-rasterbar-devel < %{version}
%endif
%endif
#

%description devel
Development files such are headers, pkg-config,
CMake files and symlinks for LibTorrent Rasterbar.


%prep
%autosetup -n %{source_name}-%{version}

%build
# Set GCC Version 13 Instead of GCC Version 7 (Default) for SUSE Leap 15.6
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
export  CC="%{_bindir}/gcc-13"
export CXX="%{_bindir}/g++-13"
%endif
#
# Export necessary FLAGS for PYTHON Bindings
# export CPPFLAGS="$CPPFLAGS $(python%%{python3_version}-config --includes)"
# export LDFLAGS="$LDFLAGS -L%%{_builddir}/libtorrent-rasterbar-%%{version}/build/src/.libs"
# export PYTHON="/usr/bin/python%%{python3_version}"
# export PYTHON_LDFLAGS="$PYTHON_LDFLAGS $(python%%{python3_version}-config --libs)"
#

%cmake \
    -GNinja                 \
    -Dbuild_examples='ON'   \
    -Dbuild_tests='OFF'     \
    -Dbuild_tools='ON'      \
    -Dpython-bindings='OFF' \
    -Dpython-egg-info='OFF' \
    -Dpython-install-system-dir='OFF'

# BUILDs for SUSE Only
%if 0%{?suse_version} && 0%{?is_opensuse} || 0%{?sle_version} && 0%{?is_opensuse}
%ninja_build
%endif
#
# BUILDs for FEDORA Only
%if 0%{?fedora}
%ninja_build -C "redhat-linux-build/"
%endif
#
# BUILDs for MAGEIA Only
%if 0%{?mageia}
%ninja_build -C "build/"
%endif
#

%install
# INSTALLATIONS for SUSE / MAGEIA
%if 0%{?suse_version} && 0%{?is_opensuse} || 0%{?sle_version} && 0%{?is_opensuse} || 0%{?mageia}
%ninja_install -C "build/"
%endif
#
# INSTALLATIONS for FEDORA Only
%if 0%{?fedora}
%ninja_install -C "redhat-linux-build/"
%endif
#

%check
# To run tests, uncomment if you have CMake test dependencies ENABLED
# For SUSE / FEDORA
# %%if 0%%{?suse_version} && 0%%{?is_opensuse} || 0%%{?sle_version} && 0%%{?is_opensuse} || 0%%{?fedora}
# %%ctest --verbose --exclude-regex "(test_flags|test_upnp)"
#
# For MAGEIA
# %%else
# cd 'build' &&
# '/usr/bin/ctest' --verbose --exclude-regex "(test_flags|test_upnp)" --output-on-failure --force-new-ctest-process -j${RPM_BUILD_NCPUS}  ;
# cd '..'
#
# %%endif
#

%post -n %{source_name}%{libver}
# Update the dynamic linker cache to reflect the current set of shared libraries installed on the SYSTEM (postin)
ldconfig
#

%postun -n %{source_name}%{libver}
# Update the dynamic linker cache to reflect the current set of shared libraries installed on the SYSTEM (postun)
ldconfig
#

%files
%doc     ChangeLog "README.rst"

%license COPYING

%files -n %{source_name}%{libver}

%{_libdir}/%{source_name}.so.*

%files devel

     "%{_datadir}/cmake/Modules/FindLibtorrentRasterbar.cmake"

%dir "%{_includedir}/%{_name}/"
      %{_includedir}/%{_name}/*

     "%{_libdir}/%{source_name}.so"
     "%{_libdir}/pkgconfig/%{source_name}.pc"
     "%{_libdir}/cmake/LibtorrentRasterbar/"

%changelog
openSUSE Build Service is sponsored by