File sleef.spec of Package failed_sleef

Name:           sleef
Version:        3.9.0
Release:        1.1
Summary:        SLEEF - Vectorized libm functions

License:        BSD-2-Clause
URL:            https://sleef.org
Source0:        sleef-3.9.0.tar.gz

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  fftw3-devel
BuildRequires:  gmp-devel
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  pkgconfig

%description
SLEEF provides vectorized implementations of libm functions.

%prep
%setup -q

%build
# Some toolchains (cross, riscv variants) may inject -flto=auto into
# the compiler/linker flags via the RPM optflags. LTO can cause
# "lto-wrapper: fatal error: target specific builtin not available"
# with these toolchains. Strip -flto* from flags here before invoking
# CMake so that no LTO is used during the build.
#
# We remove both "-flto=auto" and plain "-flto" occurrences.
CFLAGS="${CFLAGS//-flto=auto/}"
CFLAGS="${CFLAGS//-flto/}"
CXXFLAGS="${CXXFLAGS//-flto=auto/}"
CXXFLAGS="${CXXFLAGS//-flto/}"
LDFLAGS="${LDFLAGS//-flto=auto/}"
LDFLAGS="${LDFLAGS//-flto/}"
export CFLAGS CXXFLAGS LDFLAGS

# Also construct explicit CMAKE variables to ensure cmake does not pick up
# the -flto flags from RPM helper macros.
# Keep other optimization flags from the environment if present.
cmake \
  -GNinja \
  -DCMAKE_INSTALL_PREFIX:PATH=/usr \
  -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_C_FLAGS="${CFLAGS}" \
  -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
  -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
  -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
  -DBUILD_SHARED_LIBS:BOOL=ON \
  -DBUILD_STATIC_LIBS:BOOL=OFF \
  -DSHARE_INSTALL_PREFIX:PATH=/usr/share \
  -DSLEEF_ENABLE_TLFLOAT=OFF \
  .

%install
%cmake_install

%files
%license COPYING*
%doc README*
/usr/lib64/libsleef*.so*
/usr/include/sleef

%changelog
* Sun Aug 10 2025 Packager <packager@example.com> - 3.9.0-1.1
- Disable LTO flags during packaging to avoid lto-wrapper errors on some toolchains.
openSUSE Build Service is sponsored by