File boost-custom.spec.old 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

# 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_INCLUDE_SYSTEM_FLAG_CXX="-I"  -DCMAKE_INCLUDE_SYSTEM_FLAG_C="-I"  -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_INCLUDE_SYSTEM_FLAG_CXX="-I"  -DCMAKE_INCLUDE_SYSTEM_FLAG_C="-I"  -DCMAKE_SHARED_LINKER_FLAGS="-lc"  -DCMAKE_STRIP="/bin/true"
#
%endif
#


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:         boost-custom-build.patch
#

# BUILDs for SUSE
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse}
BuildRequires:  cmake  cmake-full
BuildRequires:  fdupes
# For SUSE Leap 15.6 Only
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
BuildRequires:  gcc13  gcc13-c++  libstdc++6-devel-gcc13
%endif
#
BuildRequires:  gcc  gcc-c++
# 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  or  python3-devel)
%endif
#
# BUILDs for FEDORA / MAGEIA
%if 0%{?fedora} || 0%{?mageia}
BuildRequires:  cmake  cmake-rpm-macros  extra-cmake-modules
BuildRequires:  fdupes
BuildRequires:  gcc  gcc-c++
BuildRequires:  libstdc++  libstdc++-devel
# For FEDORA Only
%if 0%{?fedora}
BuildRequires:  gcc-plugin-devel
%endif
#
BuildRequires:  glibc  glibc-devel
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  python3
# For FEDORA Only
%if 0%{?fedora}
BuildRequires:  python3-devel
%endif
#
# For MAGEIA Only
%if 0%{?mageia}
BuildRequires:  (libpython3-devel  or  lib64python3-devel)
%endif
#
%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:       %{source_name}        = %{version}
Provides:       %{source_name}-libs   = %{version}
Provides:       lib%{source_name}     = %{version}
Provides:       lib%{source_name}-all = %{version}

Conflicts:      %{source_name}
Conflicts:      %{source_name}-libs
Conflicts:      lib%{source_name}

Obsoletes:      %{source_name}        < %{version}
Obsoletes:      %{source_name}-libs   < %{version}
Obsoletes:      lib%{source_name}     < %{version}
Obsoletes:      lib%{source_name}-all < %{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}
Provides:       %{source_name}-libs-devel = %{version}
Provides:       lib%{source_name}-devel   = %{version}
Provides:       lib%{source_name}-all-dev = %{version}

Conflicts:      %{source_name}-devel
Conflicts:      %{source_name}-libs-devel
Conflicts:      lib%{source_name}-devel
Conflicts:      lib%{source_name}-all-dev

Obsoletes:      %{source_name}-devel      < %{version}
Obsoletes:      %{source_name}-libs-devel < %{version}
Obsoletes:      lib%{source_name}-devel   < %{version}
Obsoletes:      lib%{source_name}-all-dev < %{version}

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


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

# Fix executable permissions for shell scripts
chmod +x    "libs/pool/include/%{source_name}/pool/detail/pool_construct.sh"
chmod +x    "libs/pool/include/%{source_name}/pool/detail/pool_construct_simple.sh"
#
# 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 for RPM-Based Linux Distributions
%if 0%{?suse_version} && 0%{?is_opensuse} || 0%{?sle_version} && 0%{?is_opensuse} || 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=%{buildroot}/%{_prefix}/ \
      -DLIB_INSTALL_DIR:PATH="%{_prefix}/lib/"        \
      -S "." -B "./build/"

cmake --build   "./build/" --parallel
#

# 64-bit
%else
cmake %{?_cmake_flags_64_bit}                         \
      -DCMAKE_INSTALL_PREFIX=%{buildroot}/%{_prefix}/ \
      -DLIB_INSTALL_DIR:PATH="%{_prefix}/lib64/"      \
      -S "." -B "./build/"

cmake --build   "./build/" --parallel

%endif
#
%endif
#

%install
# CMake INSTALL for RPM-Based Linux Distributions
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse} || 0%{?fedora} || 0%{?mageia}
%cmake_install
#
# CMake INSTALL for DEB-Based Linux Distributions
%else
cmake --install "./build/"
#
%endif


%check
# Commit `CTest`
# For RPM-Based Linux Distributions
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse} || 0%{?fedora} || 0%{?mageia}
%ctest
#
# For DEB-Based Linux Distributions
%else
cd 'build' &&
'/usr/bin/ctest' --output-on-failure --force-new-ctest-process -j${RPM_BUILD_NCPUS}  ;
cd '..'
#
%endif
#
# Look for Duplicated Files
# For RPM-Based Linux Distributions
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse} || 0%{?fedora} || 0%{?mageia}
%fdupes    %{buildroot}/
#
# For DEB-Based Linux Distributions
%else
fdupes -rs %{buildroot}/
#
%endif
#

%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/*
     "%{_libdir}/libboost_test_exec_monitor.a"
      %{_libdir}/libboost_*.so

%changelog
openSUSE Build Service is sponsored by