# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 0} %global __tar /opt/freeware/bin/tar %global name abseil-cpp %global version 20230802.0 %global release 1 %global _libdir64 %{_prefix}/lib64 %global sover 2308.0.0 Name: %{name} Version: %{version} Release: 1 Summary: Abseil Common Libraries (C++) License: Apache-2.0 URL: https://abseil.io Source0: https://github.com/abseil/abseil-cpp/archive/refs/tags/%{version}.tar.gz Patch1: abseil-cpp-20230802.0-strerror-test.patch BuildRequires: gcc >= 10 BuildRequires: gcc-c++ >= 10 BuildRequires: cmake >= 3.26.4 BuildRequires: gmock-devel >= 1.14.0 BuildRequires: gtest-devel >= 1.14.0 BuildRequires: findutils >= 4.9.0 BuildRequires: sed >= 4.8 BuildRequires: coreutils >= 9.0 Requires: gmock >= 1.14.0 Requires: gtest >= 1.14.0 %description Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives. In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you. Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel Development headers for %{name}. %prep %setup -n %{name}-%{version} %patch1 -p1 rm -rf /tmp/%{name}-%{version}-32bit cp -pr . /tmp/%{name}-%{version}-32bit rm -fr * mv /tmp/%{name}-%{version}-32bit 32bit cp -pr 32bit 64bit %build #64bit Build cd 64bit export OBJECT_MODE=64 export CC="gcc -maix64 -pthread " export CFLAGS="-I/opt/freeware/include -fPIC -O2 -I/usr/include" export CXX="g++ -maix64 -pthread " export CXXFLAGS="-I/opt/freeware/include -fPIC -O2 -I/usr/include" export LDFLAGS="-Wl,-bbigtoc -L/opt/freeware/lib/pthread -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib" cmake . -B build \ -DABSL_USE_EXTERNAL_GOOGLETEST:BOOL=ON \ -DABSL_FIND_GOOGLETEST:BOOL=ON \ -DABSL_BUILD_TEST_HELPERS=ON \ -DABSL_BUILD_TESTING:BOOL=ON \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_INSTALL_LIBDIR=lib64 \ -DABSL_ENABLE_INSTALL=ON \ -DCMAKE_INSTALL_PREFIX=%{_prefix} cmake --build build #32bit Build cd ../32bit export OBJECT_MODE=32 export CC="gcc -maix32 -pthread " export CFLAGS="-I/opt/freeware/include -fPIC -O2 -I/usr/include" export CXX="g++ -maix32 -pthread " export CXXFLAGS="-I/opt/freeware/include -fPIC -O2 -I/usr/include" export LDFLAGS="-Wl,-bbigtoc -latomic -L/opt/freeware/lib/pthread -L/opt/freeware/lib -L/usr/lib" cmake . -B build \ -DABSL_USE_EXTERNAL_GOOGLETEST:BOOL=ON \ -DABSL_FIND_GOOGLETEST:BOOL=ON \ -DABSL_BUILD_TEST_HELPERS=ON \ -DABSL_BUILD_TESTING:BOOL=ON \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_INSTALL_LIBDIR=lib \ -DABSL_ENABLE_INSTALL=ON \ -DCMAKE_INSTALL_PREFIX=%{_prefix} cmake --build build %install export DESTDIR=$RPM_BUILD_ROOT cd 64bit cmake --install build cd ../32bit cmake --install build #archives 64bit shared objects into 32bit archives cd %{_builddir}/%{name}-%{version}/64bit/build ABSL_LIB_LIST=`find * -name *.so.%{sover}` for file in $ABSL_LIB_LIST do filename=`echo $file | sed 's/\(.*\)\/\(.*\)\.\(.*\)$/\2/' | cut -d '.' -f 1` /usr/bin/ar -X64 -q %{buildroot}%{_libdir}/$filename.a %{_builddir}/%{name}-%{version}/64bit/build/$file done %check cd 64bit/build ctest || true cd ../../32bit/build ctest || true %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %doc 64bit/FAQ.md 64bit/README.md 64bit/UPGRADES.md 64bit/LICENSE %{_libdir64}/*.a %{_libdir}/*.a %files devel %{_includedir}/absl %{_libdir64}/pkgconfig/absl_*.pc %{_libdir64}/cmake/absl %{_libdir}/pkgconfig/absl_*.pc %{_libdir}/cmake/absl %changelog * Tue Aug 22 2023 Ranjit Ranjan - 20230802.0-1 - Port on AIX.