File boost-custom.spec of Package boost-custom

# #
# spec file for package boost
#
# 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 original_name Boost
%define source_name   boost


Name:           boost-custom
Version:        1.89.0
Release:        0
Summary:        Free peer-reviewed portable C++ source libraries

License:        BSL-1.0
URL:            https://www.boost.org/
# We use CMake variant for these BUILDs
Source0:        https://github.com/boostorg/%{source_name}/releases/download/%{source_name}-%{version}/%{source_name}-%{version}-cmake.tar.xz#/%{source_name}-%{version}.tar.xz
Source1:        https://github.com/boostorg/%{source_name}/releases/download/%{source_name}-%{version}/%{source_name}-%{version}-cmake.tar.xz.txt#/%{source_name}-%{version}.tar.xz.sha256sum.txt
#
# CMake Error at libs/context/CMakeLists.txt:30 (math):
#  math cannot parse the expression: "*8": syntax error, unexpected exp_TIMES
Patch0:         %{name}-BUILD.patch
#

# REQUIREMENTS for SUSE Leap 15.6 Only
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
BuildRequires:  cmake  cmake-full
BuildRequires:  fdupes
BuildRequires:  gcc13  gcc13-c++  libstdc++6-devel-gcc13
BuildRequires:  glibc  glibc-devel
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  python3  python3-devel
%endif
#
# REQUIREMENTS for SUSE Leap 16.0 / SUSE TumbleWeed
%if 0%{?suse_version} >= 1600 && 0%{?is_opensuse}
BuildRequires:  cmake  cmake-full
BuildRequires:  fdupes
BuildRequires:  gcc  gcc-c++
# REQUIREMENTS for SUSE TumbleWeed Only
%if 0%{?suse_version} > 1600 && 0%{?is_opensuse}
BuildRequires:  gcc-devel
%endif
#
BuildRequires:  glibc  glibc-devel
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  python3  python3-devel
%endif
#
# REQUIREMENTS for FEDORA
%if 0%{?fedora}
BuildRequires:  cmake  cmake-rpm-macros  extra-cmake-modules
BuildRequires:  fdupes
BuildRequires:  gcc  gcc-c++  gcc-plugin-devel
BuildRequires:  glibc  glibc-devel
BuildRequires:  libstdc++  libstdc++-devel
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  python3  python3-devel
%endif
#
# REQUIREMENTS for MAGEIA
%if 0%{?mageia}
BuildRequires:  cmake  cmake-rpm-macros  extra-cmake-modules
BuildRequires:  fdupes
BuildRequires:  gcc  gcc-c++
BuildRequires:  glibc  glibc-devel
BuildRequires:  libstdc++  libstdc++-devel
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  python3
BuildRequires:  (libpython3-devel  or  lib64python3-devel)
%endif
#

Provides:       %{source_name} = %{version}

Conflicts:      %{source_name}

Obsoletes:      %{source_name} < %{version}

%description
Boost is a set of libraries for the C++ programming language that
provides support for tasks and structures such as
linear algebra, pseudo-random number generation, multithreading,
image processing, regular expressions, and unit testing.


%package  devel
Summary:  Development files for %{source_name}

Requires:       %{name} = %{version}

Provides:       %{source_name}-devel = %{version}

Conflicts:      %{source_name}-devel

Obsoletes:      %{source_name}-devel < %{version}

%description devel
This package contains the development files and headers for the
Boost library.


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

# Remove unnecessary empty `.gitkeep` file
find  "." -name '.gitkeep' -delete
#

%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
#

%cmake \
      -DBOOST_EXCLUDE_LIBRARIES="test" \
      -DBOOST_TEST_STATIC_LINK="OFF"

%cmake_build

%install
%cmake_install

%check
# Commit `CTest`
# %%ctest
#
# Look for Duplicated Files
%fdupes    %{buildroot}/
#

%post
# Update the dynamic linker cache to reflect the current set of shared libraries installed on the SYSTEM (postin)
ldconfig
#

%postun
# Update the dynamic linker cache to reflect the current set of shared libraries installed on the SYSTEM (postun)
ldconfig
#

%files
%license "LICENSE_1_0.txt"

%doc     "README.md"

%{_libdir}/libboost_*.so.*

%files devel
%dir "%{_includedir}/%{source_name}/"
      %{_includedir}/%{source_name}/*

%dir "%{_libdir}/cmake/"
      %{_libdir}/cmake/%{source_name}_*
%dir "%{_libdir}/cmake/%{original_name}-%{version}/"
      %{_libdir}/cmake/%{original_name}-%{version}/*
      %{_libdir}/libboost_*.so

%changelog
openSUSE Build Service is sponsored by