File abseil-cpp-opt.spec of Package abseil-cpp-opt
#
# spec file for package abseil-cpp-opt
#
# Copyright (c) 2025 Dmitry Ivanov
#
# 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/
#
# OpenSUSE Leap by default ships with gcc which is too old to build
# abseil-cpp, so require gcc-13
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse} && 0%{?gcc_version} < 13
%define with_gcc 13
%endif
# Disable generation of debuginfo package for Fedora >= 41
%if 0%{?fedora_version} >= 41
%global debug_package %{nil}
%endif
Name: abseil-cpp-opt
Version: 20240722.0
Release: 0
Summary: Collection of C++ libraries designed to augment the C++ standard library
License: Apache-2.0
URL: https://abseil.io/
Source0: %{name}-%{version}.tar.gz
Patch1: remove_time_tests.patch
BuildRequires: bash
BuildRequires: binutils
BuildRequires: gcc%{?with_gcc}
BuildRequires: gcc%{?with_gcc}-c++
BuildRequires: cmake
%if 0%{?fedora_version}
BuildRequires: ninja-build
%else
BuildRequires: ninja
%endif
# OpenSUSE Leap ships with gtest ang gmock which are too old to build
# abseil-cpp tests, so require newer versions of these packages installed
# to /opt/googletest
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
BuildRequires: gtest-opt-devel
BuildRequires: gmock-opt-devel
%else
BuildRequires: gtest
BuildRequires: gmock
%endif
%if 0%{?fedora_version}
BuildRequires: gtest-devel
BuildRequires: gmock-devel
%endif
ExclusiveArch: x86_64
%description
Abseil is an open-source collection of C++ library code designed to augment the C++ standard library.
%package lib
Summary: Collection of C++ libraries designed to augment the C++ standard library
Group: Development/Libraries/C and C++
%description lib
Abseil is an open-source collection of C++ library code designed to augment the C++ standard library.
%package devel
Summary: Development files for %{name}
Requires: abseil-cpp-opt-lib = %{version}-%{release}
%description devel
Files for developing applications that use %{name}.
%prep
%autosetup -p1
%build
%if 0%{?with_gcc}
export CXX=g++-%{with_gcc}
export CC=gcc-%{with_gcc}
%endif
%define __builder ninja
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
%cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_INSTALL_PREFIX=/opt/abseil-cpp -DBUILD_TESTING=ON -DABSL_BUILD_TESTING=ON -DABSL_USE_EXTERNAL_GOOGLETEST=ON -DABSL_FIND_GOOGLETEST=ON -DABSL_BUILD_TEST_HELPERS=ON -DGTest_DIR=/opt/googletest/%{_lib}/cmake/GTest
%else
%cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_INSTALL_PREFIX=/opt/abseil-cpp -DBUILD_TESTING=ON -DABSL_BUILD_TESTING=ON -DABSL_USE_EXTERNAL_GOOGLETEST=ON -DABSL_FIND_GOOGLETEST=ON -DABSL_BUILD_TEST_HELPERS=ON
%endif
%cmake_build
%check
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
export LD_LIBRARY_PATH=/opt/googletest/%{_lib}
%endif
%ctest
%install
%cmake_install
for l in %{buildroot}/opt/abseil-cpp/%{_lib}/*.so.*; do strip $l; done
%post lib -p /sbin/ldconfig
%postun lib -p /sbin/ldconfig
%files lib
%defattr(-,root,root)
%dir /opt/abseil-cpp
%dir /opt/abseil-cpp/%{_lib}
/opt/abseil-cpp/%{_lib}/libabsl_*.so.*
%files devel
%defattr(-,root,root)
%dir /opt/abseil-cpp/include
%dir /opt/abseil-cpp/%{_lib}/cmake
%dir /opt/abseil-cpp/%{_lib}/pkgconfig
/opt/abseil-cpp/include/absl
/opt/abseil-cpp/%{_lib}/cmake/absl
/opt/abseil-cpp/%{_lib}/libabsl_*.so
/opt/abseil-cpp/%{_lib}/pkgconfig/absl_*
%changelog
* Tue Jan 14 2025 Dmitry Ivanov <dm.vl.ivanov@gmail.com>
- Initial version