Subject: [bug#44177] [PATCH] gnu: benchmark: Update to 1.5.2

From: Malte Frank Gerdes <[email-masked]>
Date: Fri, 23 Oct 2020 15:21:16 +0200

Hi,

this updates benchmark to version 1.5.2 - i noticed that there was a
patch to "unbundle" googletest from benchmark. I don't know what the
intention was, but benchmark searches for googletest in
$BUILD_DIR/googletest which doesn't exist. So googletest isn't actually
bundled as it seems to me. So i removed that patch.

Malte

>From bcacd4e0bc4058b698be6a798adcd668d7ef1002 Mon Sep 17 00:00:00 2001
From: Malte Frank Gerdes <[email-masked]>
Date: Fri, 23 Oct 2020 15:11:52 +0200
Subject: [PATCH] gnu: benchmark: Update to 1.5.2

* gnu/packages/benchmark.scm (benchmark): Update to 1.5.2
[native-inputs]: Add googletest-source.
[arguments]: Add phase 'unpack-googletest.
* gnu/packages/patches/benchmark-unbundle-googletst.patch: Delete file.
* gnu/packages/local.mk: Remove benchmark-unbundle-googletest.patch.
---
 gnu/local.mk                                  |  1 -
 gnu/packages/benchmark.scm                    | 21 ++++--
 .../benchmark-unbundle-googletest.patch       | 69 -------------------
 3 files changed, 15 insertions(+), 76 deletions(-)
 delete mode 100644 gnu/packages/patches/benchmark-unbundle-googletest.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 31385d0db6..013bc58db7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -825,7 +825,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/beets-werkzeug-compat.patch		\
   %D%/packages/patches/behave-skip-a-couple-of-tests.patch	\
   %D%/packages/patches/beignet-correct-file-names.patch		\
-  %D%/packages/patches/benchmark-unbundle-googletest.patch	\
   %D%/packages/patches/biber-fix-encoding-write.patch		\
   %D%/packages/patches/biber-sortinithash.patch			\
   %D%/packages/patches/bidiv-update-fribidi.patch		\
diff --git a/gnu/packages/benchmark.scm b/gnu/packages/benchmark.scm
index f9648b5f7c..8a8309ce52 100644
--- a/gnu/packages/benchmark.scm
+++ b/gnu/packages/benchmark.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2019 Gábor Boskovits <[email-masked]>
 ;;; Copyright © 2019 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2020 Vincent Legoll <[email-masked]>
+;;; Copyright © 2020 malte Frank Gerdes <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -213,7 +214,7 @@ This can give a much better understanding of the command's performance.")
 (define-public benchmark
   (package
     (name "benchmark")
-    (version "1.5.0")
+    (version "1.5.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -222,16 +223,24 @@ This can give a much better understanding of the command's performance.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0r9dbg4cbk47gwmayys31a83m3y67k0kh1f6pl8i869rbd609ndh"))
-              (patches (search-patches "benchmark-unbundle-googletest.patch"))))
+                "13rxagpzw6bal6ajlmrxlh9kgfvcixn6j734b2bvfqz7lch8n0pa"))))
     (build-system cmake-build-system)
     (native-inputs
-     `(("googletest" ,googletest)))
+     `(("googletest-source" ,(package-source googletest))
+       ("googletest" ,googletest)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unpack-googletest
+           (lambda* (#:key inputs #:allow-other-keys)
+             (copy-recursively (assoc-ref inputs "googletest-source")
+                               "googletest")
+             #t)))))
     (home-page "https://github.com/google/benchmark")
     (synopsis "Microbenchmark support library")
     (description
-     "Benchmark is a library to benchmark code snippets,
-similar to unit tests.")
+     "Benchmark is a library to benchmark code snippets, similar to unit
+tests.")
     (license license:asl2.0)))
 
 (define-public bonnie++
diff --git a/gnu/packages/patches/benchmark-unbundle-googletest.patch b/gnu/packages/patches/benchmark-unbundle-googletest.patch
deleted file mode 100644
index 4dce8f59f1..0000000000
--- a/gnu/packages/patches/benchmark-unbundle-googletest.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 5eb306618196ea78b8c9390e22ea2edce20760fe Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <[email-masked]>
-Date: Fri, 14 Jun 2019 22:15:49 +0200
-Subject: [PATCH] Remove googletest lookup from build system.
-
----
- cmake/GoogleTest.cmake    | 18 +++++++++---------
- cmake/GoogleTest.cmake.in | 12 ++++++------
- 2 files changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/cmake/GoogleTest.cmake b/cmake/GoogleTest.cmake
-index fb7c6be..a6c473b 100644
---- a/cmake/GoogleTest.cmake
-+++ b/cmake/GoogleTest.cmake
-@@ -27,15 +27,15 @@ endif()
- # settings on Windows
- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
- 
--include(${GOOGLETEST_PREFIX}/googletest-paths.cmake)
-+#include(${GOOGLETEST_PREFIX}/googletest-paths.cmake)
- 
- # Add googletest directly to our build. This defines
- # the gtest and gtest_main targets.
--add_subdirectory(${GOOGLETEST_SOURCE_DIR}
--                 ${GOOGLETEST_BINARY_DIR}
--                 EXCLUDE_FROM_ALL)
--
--set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest,INTERFACE_INCLUDE_DIRECTORIES>)
--set_target_properties(gtest_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest_main,INTERFACE_INCLUDE_DIRECTORIES>)
--set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock,INTERFACE_INCLUDE_DIRECTORIES>)
--set_target_properties(gmock_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock_main,INTERFACE_INCLUDE_DIRECTORIES>)
-+#add_subdirectory(${GOOGLETEST_SOURCE_DIR}
-+#                 ${GOOGLETEST_BINARY_DIR}
-+#                 EXCLUDE_FROM_ALL)
-+
-+#set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest,INTERFACE_INCLUDE_DIRECTORIES>)
-+#set_target_properties(gtest_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest_main,INTERFACE_INCLUDE_DIRECTORIES>)
-+#set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock,INTERFACE_INCLUDE_DIRECTORIES>)
-+#set_target_properties(gmock_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock_main,INTERFACE_INCLUDE_DIRECTORIES>)
-diff --git a/cmake/GoogleTest.cmake.in b/cmake/GoogleTest.cmake.in
-index 28818ee..13b0888 100644
---- a/cmake/GoogleTest.cmake.in
-+++ b/cmake/GoogleTest.cmake.in
-@@ -31,7 +31,7 @@ if(EXISTS "${GOOGLETEST_PATH}"            AND IS_DIRECTORY "${GOOGLETEST_PATH}"
-   )
- else()
-   if(NOT ALLOW_DOWNLOADING_GOOGLETEST)
--    message(SEND_ERROR "Did not find Google Test sources! Either pass correct path in GOOGLETEST_PATH, or enable ALLOW_DOWNLOADING_GOOGLETEST, or disable BENCHMARK_ENABLE_GTEST_TESTS / BENCHMARK_ENABLE_TESTING.")
-+    message(WARNING "Did not find Google Test sources! Either pass correct path in GOOGLETEST_PATH, or enable ALLOW_DOWNLOADING_GOOGLETEST, or disable BENCHMARK_ENABLE_GTEST_TESTS / BENCHMARK_ENABLE_TESTING.")
-   else()
-     message(WARNING "Did not find Google Test sources! Fetching from web...")
-     ExternalProject_Add(
-@@ -51,8 +51,8 @@ else()
-   endif()
- endif()
- 
--ExternalProject_Get_Property(googletest SOURCE_DIR BINARY_DIR)
--file(WRITE googletest-paths.cmake
--"set(GOOGLETEST_SOURCE_DIR \"${SOURCE_DIR}\")
--set(GOOGLETEST_BINARY_DIR \"${BINARY_DIR}\")
--")
-+#ExternalProject_Get_Property(googletest SOURCE_DIR BINARY_DIR)
-+#file(WRITE googletest-paths.cmake
-+#"set(GOOGLETEST_SOURCE_DIR \"${SOURCE_DIR}\")
-+#set(GOOGLETEST_BINARY_DIR \"${BINARY_DIR}\")
-+#")
--- 
-2.22.0
-
-- 
2.28.0