# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 0} %global __tar /opt/freeware/bin/tar %global name gtest %global version 1.14.0 %global release 1 %global _libdir64 %{_prefix}/lib64 Summary: Google C++ testing framework Name: gtest Version: %{version} Release: %{release} License: BSD URL: https://github.com/google/googletest Source0: https://github.com/google/googletest/archive/refs/tags/v%{version}.tar.gz Patch1: gtest-1.14.0-cmakelists.patch BuildRequires: gcc >= 10 BuildRequires: gcc-c++ >= 10 BuildRequires: cmake BuildRequires: libstdc++-devel >= 10 Requires: libstdc++ >= 10 Requires: libgcc >= 10 %description Framework for writing C++ tests on a variety of platforms (GNU/Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation. %package -n gtest-devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} Requires: gmock = %{version}-%{release} %description -n gtest-devel This package contains development files for %{name}. %package -n gmock Summary: Google C++ Mocking Framework Requires: %{name} = %{version}-%{release} Requires: libstdc++ >= 10 Requires: libgcc >= 10 %description -n gmock Inspired by jMock, EasyMock, and Hamcrest, and designed with C++s specifics in mind, Google C++ Mocking Framework (or Google Mock for short) is a library for writing and using C++ mock classes. Google Mock: o lets you create mock classes trivially using simple macros, o supports a rich set of matchers and actions, o handles unordered, partially ordered, or completely ordered expectations, o is extensible by users, and o works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and Symbian. %package -n gmock-devel Summary: Development files for gmock Requires: gmock = %{version}-%{release} Requires: gtest = %{version}-%{release} %description -n gmock-devel This package contains development files for gmock. %prep %setup -n googletest-%{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" cmake . -DBUILD_SHARED_LIBS=ON \ -Dgtest_build_samples=ON \ -Dgtest_disable_pthreads=ON \ -Dgtest_build_tests=ON \ -DCMAKE_INSTALL_LIBDIR=lib64 \ -DCMAKE_INSTALL_PREFIX=%{_prefix} make #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 -Wl,-bmaxdata:0x80000000" cmake . -DBUILD_SHARED_LIBS=ON \ -Dgtest_build_samples=ON \ -Dgtest_disable_pthreads=ON \ -Dgtest_build_tests=ON \ -DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_INSTALL_PREFIX=%{_prefix} make %install cd 64bit make DESTDIR=$RPM_BUILD_ROOT install prefix=%{_prefix} cd ../32bit make DESTDIR=$RPM_BUILD_ROOT install prefix=%{_prefix} #archive 64bit libs into 32bit archives. /usr/bin/ar -X64 -q %{buildroot}%{_libdir}/libgtest.a %{_builddir}/googletest-%{version}/64bit/googletest/libgtest.so.%{version} /usr/bin/ar -X64 -q %{buildroot}%{_libdir}/libgtest_main.a %{_builddir}/googletest-%{version}/64bit/googletest/libgtest_main.so.%{version} /usr/bin/ar -X64 -q %{buildroot}%{_libdir}/libgmock.a %{_builddir}/googletest-%{version}/64bit/googlemock/libgmock.so.%{version} /usr/bin/ar -X64 -q %{buildroot}%{_libdir}/libgmock_main.a %{_builddir}/googletest-%{version}/64bit/googlemock/libgmock_main.so.%{version} %check cd 64bit ctest || true cd ../32bit ctest || true %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %doc 64bit/CONTRIBUTORS 64bit/README.md 64bit/LICENSE %{_libdir64}/libgtest.a %{_libdir64}/libgtest_main.a %{_libdir}/libgtest.a %{_libdir}/libgtest_main.a %files -n gtest-devel %doc 64bit/docs/ %doc 64bit/googletest/samples %{_includedir}/gtest/ %{_libdir64}/pkgconfig/gtest.pc %{_libdir64}/pkgconfig/gtest_main.pc %{_libdir64}/cmake/GTest/ %{_libdir}/pkgconfig/gtest.pc %{_libdir}/pkgconfig/gtest_main.pc %{_libdir}/cmake/GTest/ %files -n gmock %{_libdir64}/libgmock.a %{_libdir64}/libgmock_main.a %{_libdir}/libgmock.a %{_libdir}/libgmock_main.a %files -n gmock-devel %doc 64bit/docs/ %{_includedir}/gmock/ %{_libdir64}/pkgconfig/gmock.pc %{_libdir64}/pkgconfig/gmock_main.pc %{_libdir}/pkgconfig/gmock.pc %{_libdir}/pkgconfig/gmock_main.pc %changelog * Tue Aug 22 2023 Ranjit Ranjan - 1.14.0-1 - Port on AIX.