From 2a3bc153584022b7ed6cd74aee97cf2f23cadd69 Mon Sep 17 00:00:00 2001 From: rdobuilder Date: Jan 10 2022 19:42:53 +0000 Subject: Build google-benchmark 1.6.0 version It comes from https://src.fedoraproject.org/rpms/google-benchmark Related-to: https://review.rdoproject.org/r/q/I567cac2693d829663ae01e12b88a98df07119e2f --- diff --git a/.google-benchmark.metadata b/.google-benchmark.metadata new file mode 100644 index 0000000..f392b48 --- /dev/null +++ b/.google-benchmark.metadata @@ -0,0 +1 @@ +c4d1a9135e779c5507015ccc8c428cb4aca69cef SOURCES/google-benchmark-1.6.0.tar.gz diff --git a/SOURCES/google-benchmark-docs-installation.patch b/SOURCES/google-benchmark-docs-installation.patch new file mode 100644 index 0000000..a8fb580 --- /dev/null +++ b/SOURCES/google-benchmark-docs-installation.patch @@ -0,0 +1,46 @@ +From 1bd8098d3d5b7aa8e305e57b2451ab8f98a58965 Mon Sep 17 00:00:00 2001 +From: Vitaly Zaitsev +Date: Wed, 8 Sep 2021 19:40:25 +0200 +Subject: [PATCH] Optimized docs installation (#1225) + +* Use GNUInstallDirs to install docs. + +Signed-off-by: Vitaly Zaitsev + +* Added an option to disable docs installation. + +Signed-off-by: Vitaly Zaitsev +--- + CMakeLists.txt | 1 + + src/CMakeLists.txt | 8 +++++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 49f2ae2a0..d32dbd83d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,6 +25,7 @@ else() + set(BENCHMARK_BUILD_32_BITS OFF CACHE BOOL "Build a 32 bit version of the library - unsupported when using MSVC)" FORCE) + endif() + option(BENCHMARK_ENABLE_INSTALL "Enable installation of benchmark. (Projects embedding benchmark may want to turn this OFF.)" ON) ++option(BENCHMARK_INSTALL_DOCS "Enable installation of documentation." ON) + + # Allow unmet dependencies to be met using CMake's ExternalProject mechanics, which + # may require downloading the source code. +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 1df8a4aa8..19ff8857a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -118,7 +118,9 @@ if (BENCHMARK_ENABLE_INSTALL) + NAMESPACE "${namespace}" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + +- install( +- DIRECTORY "${PROJECT_SOURCE_DIR}/docs/" +- DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") ++ if (BENCHMARK_INSTALL_DOCS) ++ install( ++ DIRECTORY "${PROJECT_SOURCE_DIR}/docs/" ++ DESTINATION "${CMAKE_INSTALL_DOCDIR}") ++ endif() + endif() diff --git a/SOURCES/google-benchmark-packaged-gtest.patch b/SOURCES/google-benchmark-packaged-gtest.patch new file mode 100644 index 0000000..63b4f4c --- /dev/null +++ b/SOURCES/google-benchmark-packaged-gtest.patch @@ -0,0 +1,31 @@ +From e8619813072f8eb7cf2d0e30b331c791405f5fef Mon Sep 17 00:00:00 2001 +From: Vitaly Zaitsev +Date: Wed, 8 Sep 2021 19:41:07 +0200 +Subject: [PATCH] Added support of packaged GTest for running unit tests. + +Signed-off-by: Vitaly Zaitsev +--- + CMakeLists.txt | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 49f2ae2a0..0570d050d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -307,7 +307,15 @@ if (BENCHMARK_ENABLE_TESTING) + if (BENCHMARK_ENABLE_GTEST_TESTS AND + NOT (TARGET gtest AND TARGET gtest_main AND + TARGET gmock AND TARGET gmock_main)) +- include(GoogleTest) ++ find_package(GTest QUIET) ++ if (GTEST_FOUND) ++ add_library(gtest ALIAS GTest::gtest) ++ add_library(gtest_main ALIAS GTest::gtest_main) ++ add_library(gmock ALIAS GTest::gmock) ++ add_library(gmock_main ALIAS GTest::gmock_main) ++ else() ++ include(GoogleTest) ++ endif() + endif() + add_subdirectory(test) + endif() diff --git a/SPECS/google-benchmark.spec b/SPECS/google-benchmark.spec new file mode 100644 index 0000000..eaaf258 --- /dev/null +++ b/SPECS/google-benchmark.spec @@ -0,0 +1,135 @@ +%undefine __cmake_in_source_build + +%global intname benchmark +%global lbname lib%{intname} + +Name: google-benchmark +Version: 1.6.0 +Release: 1%{?dist} + +License: ASL 2.0 +Summary: A microbenchmark support library +URL: https://github.com/google/%{intname} +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +# https://github.com/google/benchmark/pull/1226 +Patch100: %{name}-packaged-gtest.patch + +# https://github.com/google/benchmark/pull/1225 +Patch101: %{name}-docs-installation.patch + +BuildRequires: gtest-devel +BuildRequires: gmock-devel +BuildRequires: ninja-build +BuildRequires: gcc-c++ +BuildRequires: cmake +BuildRequires: gcc + +%description +A library to support the benchmarking of functions, similar to unit-tests. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description devel +%{summary}. + +%package doc +Summary: Documentation for %{name} +BuildArch: noarch +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description doc +%{summary}. + +%prep +%autosetup -n %{intname}-%{version} -p1 +sed -e '/get_git_version/d' -e '/-Werror/d' -i CMakeLists.txt + +%build +%cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DGIT_VERSION=%{version} \ + -DBENCHMARK_ENABLE_TESTING:BOOL=ON \ + -DBENCHMARK_ENABLE_GTEST_TESTS:BOOL=ON \ + -DBENCHMARK_ENABLE_INSTALL:BOOL=ON \ + -DBENCHMARK_INSTALL_DOCS:BOOL=ON \ + -DBENCHMARK_DOWNLOAD_DEPENDENCIES:BOOL=OFF +%cmake_build + +%check +%ctest + +%install +%cmake_install + +%files +%doc CONTRIBUTING.md README.md +%license AUTHORS CONTRIBUTORS LICENSE +%{_libdir}/%{lbname}*.so.1* + +%files devel +%{_libdir}/%{lbname}*.so +%{_includedir}/%{intname}/ +%{_libdir}/cmake/%{intname}/ +%{_libdir}/pkgconfig/%{intname}.pc + +%files doc +%{_docdir}/%{intname}/ + +%changelog +* Sun Sep 12 2021 Vitaly Zaitsev - 1.6.0-1 +- Updated to version 1.6.0. + +* Thu Aug 12 2021 Vitaly Zaitsev - 1.5.6-1 +- Updated to version 1.5.6. + +* Thu Jul 22 2021 Fedora Release Engineering - 1.5.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Sat Jul 10 2021 Vitaly Zaitsev - 1.5.5-3 +- Rebuilt again for the same reason. + +* Sat Jul 10 2021 Vitaly Zaitsev - 1.5.5-2 +- Rebuilt due to glibc update. + +* Sat Jun 12 2021 Vitaly Zaitsev - 1.5.5-1 +- Updated to version 1.5.5. + +* Mon May 31 2021 Vitaly Zaitsev - 1.5.4-1 +- Updated to version 1.5.4. + +* Mon Apr 26 2021 Vitaly Zaitsev - 1.5.3-1 +- Updated to version 1.5.3. + +* Tue Jan 26 2021 Fedora Release Engineering - 1.5.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Oct 14 2020 Jeff Law - 1.5.2-2 +- Fix missing #include for gcc-11 + +* Sat Sep 12 2020 Vitaly Zaitsev - 1.5.2-1 +- Updated to version 1.5.2. + +* Tue Jul 28 2020 Fedora Release Engineering - 1.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sun Jul 19 2020 Vitaly Zaitsev - 1.5.1-1 +- Updated to version 1.5.1. +- Fixed RHBZ#1858127. + +* Wed Jan 29 2020 Fedora Release Engineering - 1.5.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 1.5.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue May 28 2019 Vitaly Zaitsev - 1.5.0-1 +- Updated to version 1.5.0. + +* Fri Feb 01 2019 Fedora Release Engineering - 1.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Oct 25 2018 Vitaly Zaitsev - 1.4.1-1 +- Initial SPEC release.