git: d5af300a69f1 - main - Fix incremental builds after GoogleTest update

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 16 Aug 2023 17:39:38 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=d5af300a69f10e2cf9f1c03a317b7b49115927ed

commit d5af300a69f10e2cf9f1c03a317b7b49115927ed
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-08-15 21:14:26 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-08-16 17:39:22 +0000

    Fix incremental builds after GoogleTest update
    
    At the moment, several Makefiles under tests/ do not correctly generate
    .depend files, which can lead to link errors when doing incremental
    (e.g. WITHOUT_CLEAN) builds:
    
      ld: error: undefined symbol: testing::internal::g_linked_ptr_mutex
      >>> referenced by gtest-port.h:2137 (/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-port.h:2137)
      >>>               mockfs.o:(testing::internal::linked_ptr_internal::depart())
      >>> referenced by gtest-port.h:2139 (/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-port.h:2139)
      >>>               mockfs.o:(testing::internal::linked_ptr_internal::depart())
      >>> referenced by gtest-port.h:2139 (/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-port.h:2139)
      >>>               mockfs.o:(testing::internal::linked_ptr_internal::depart())
      >>> referenced 3 more times
    
    For the time being, put in a depend-cleanup.sh workaround for this.
    
    Reported by:    des
    Reviewed by:    emaste
    Fixes:          28f6c2f29280
    MFC after:      2 weeks
    Differential Revision: https://reviews.freebsd.org/D41476
---
 tools/build/depend-cleanup.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index 687f04f57f8c..6741c2285588 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -204,3 +204,10 @@ clean_dep   lib/libc        ffsll S
 clean_dep   lib/libc        fls   S
 clean_dep   lib/libc        flsl  S
 clean_dep   lib/libc        flsll S
+
+# 20230815  28f6c2f29280    GoogleTest update
+if [ -e "$OBJTOP"/tests/sys/fs/fusefs/mockfs.o ] && \
+    grep -q '_ZN7testing8internal18g_linked_ptr_mutexE' "$OBJTOP"/tests/sys/fs/fusefs/mockfs.o; then
+	echo "Removing stale fusefs GoogleTest objects"
+	run rm -rf "$OBJTOP"/tests/sys/fs/fusefs
+fi