File boost.spec of Package boost
# #
# 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 CMake Flags for DEB-Based Linux Distributions; ADD: `-ffat-lto-objects` for GCC
# For 32-bit BUILDs
%ifarch %{ix86} armv7hl
%define _arch_32bits 32
%define _cmake_flags_32_bit -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -flto -ffat-lto-objects -g" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -flto -ffat-lto-objects -g" -DCMAKE_SHARED_LINKER_FLAGS="-lc" -DCMAKE_STRIP="/bin/true"
#
# For 64-bit BUILDs
%else
%define _arch_64bits 64
%define _cmake_flags_64_bit -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_LIBDIR=lib64 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -flto -ffat-lto-objects -g" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -flto -ffat-lto-objects -g" -DCMAKE_SHARED_LINKER_FLAGS="-lc" -DCMAKE_STRIP="/bin/true"
#
%endif
#
Name: boost
Version: 1.88.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/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}-cmake.tar.xz#/%{name}-%{version}.tar.xz
#
# CMake Error at libs/context/CMakeLists.txt:30 (math):
# math cannot parse the expression: "*8": syntax error, unexpected exp_TIMES
Patch0: boost-build.patch
#
# BUILDs for SUSE Leap 15.6 / Leap 15.5 (Only) - Specify GCC Version 12
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse} || 0%{?sle_version} == 150600 && 0%{?is_opensuse}
BuildRequires: cmake
BuildRequires: cmake-full
BuildRequires: fdupes
BuildRequires: gcc12
BuildRequires: gcc12-c++
BuildRequires: glibc
BuildRequires: make
BuildRequires: (openssl-devel or libopenssl-devel)
BuildRequires: python3
%endif
#
# BUILDs for SUSE Leap 16 and SUSE TumbleWeed +
%if 0%{?suse_version} == 1600 && 0%{?is_opensuse} || 0%{?suse_version} > 1600
BuildRequires: cmake
BuildRequires: cmake-full
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc
BuildRequires: make
BuildRequires: (openssl-devel or libopenssl-devel)
BuildRequires: python3-devel
%endif
#
# BUILDs for Fedora + Mageia
%if 0%{?fedora} || 0%{?mageia}
BuildRequires: cmake
BuildRequires: cmake-rpm-macros
BuildRequires: extra-cmake-modules
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc
BuildRequires: make
BuildRequires: (openssl-devel or libopenssl-devel or lib64openssl-devel)
BuildRequires: (python3-devel or libpython3-devel or lib64python3-devel)
%endif
#
# BUILDs for DebBuild - Debian + Ubuntu
%if "%{_vendor}" == "debbuild"
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: g++
BuildRequires: make
BuildRequires: openssl
BuildRequires: python3-dev
%endif
#
Provides: boost-libs
%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 %{name}
Requires: %{name} = %{version}-%{release}
%description devel
This package contains the development headers and libraries for Boost.
%prep
%autosetup -p1
%build
# Set GCC Version 12 Instead of GCC Version 7 (Default) for SUSE Leap 15.6 / Leap 15.5 Only
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse} || 0%{?sle_version} == 150600 && 0%{?is_opensuse}
export CC="%{_bindir}/gcc-12"
export CXX="%{_bindir}/g++-12"
%endif
#
# CMake for RPM-Based Linux Distributions
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse} || 0%{?sle_version} == 150600 && 0%{?is_opensuse} || 0%{?suse_version} == 1600 && 0%{?is_opensuse} || 0%{?suse_version} > 1600 || 0%{?fedora} || 0%{?mageia}
# 32-bit
%ifarch %{ix86} armv7hl
%cmake %{?_cmake_flags_32_bit}
%cmake_build
#
# 64-bit
%else
%cmake %{?_cmake_flags_64_bit}
%cmake_build
%endif
#
%endif
#
# CMake for DEB-Based Linux Distributions
# 32-bit
%if "%{_vendor}" == "debbuild"
%ifarch %{ix86} armv7hl
cmake %{?_cmake_flags_32_bit} \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DLIB_INSTALL_DIR:PATH="/usr/lib/" \
-S "." -B "./build/"
cmake --build "./build/" --parallel
#
# 64-bit
%else
cmake %{?_cmake_flags_64_bit} \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DLIB_INSTALL_DIR:PATH="/usr/lib64/" \
-S "." -B "./build/"
cmake --build "./build/" --parallel
%endif
#
%endif
#
%install
# CMake INSTALL for DEB-Based Linux Distributions
%if "%{_vendor}" == "debbuild"
cmake --install "./build/"
#
# CMake INSTALL for RPM-Based Linux Distributions
%else
%cmake_install
#
%endif
# Fix executable permissions for shell scripts
chmod +x "%{buildroot}/%{_includedir}/%{name}/pool/detail/pool_construct.sh"
chmod +x "%{buildroot}/%{_includedir}/%{name}/pool/detail/pool_construct_simple.sh"
#
# Remove unnecessary headers directory and .gitkeep
rm -fdr "%{buildroot}/%{_includedir}/%{name}/headers/"
find %{buildroot}/%{_includedir}/%{name} -name '.gitkeep' -delete
#
%check
# Look for Duplicated Files
# For DEB-Based Linux Distributions
%if "%{_vendor}" == "debbuild"
fdupes -rs %{buildroot}/
#
# For RPM-Based Linux Distributions
%else
%fdupes %{buildroot}/
#
%endif
#
%post
# Update the dynamic linker cache to reflect the current set of shared libraries installed on the SYSTEM
ldconfig
#
%postun
# Update the dynamic linker cache to reflect the current set of shared libraries installed on the SYSTEM
ldconfig
#
%files
%license "LICENSE_1_0.txt"
%doc "README.md"
%{_libdir}/libboost_*.so.*
%files devel
%dir "%{_includedir}/%{name}/"
%{_includedir}/%{name}/*
%dir "%{_libdir}/cmake/"
%{_libdir}/cmake/*
"%{_libdir}/libboost_test_exec_monitor.a"
%{_libdir}/libboost_*.so
%changelog