git: 9e6098a91168 - stable/14 - Skip building libclang_rt when WITHOUT_CLANG is used

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 28 Apr 2024 08:04:47 UTC
The branch stable/14 has been updated by dim:

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

commit 9e6098a91168e4c90f6d38295f2876fe0e0fe190
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-04-25 15:05:29 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-04-28 08:03:37 +0000

    Skip building libclang_rt when WITHOUT_CLANG is used
    
    As noted in bug 277096, when building a pkgbase repository using
    WITHOUT_CROSS_COMPILER and WITHOUT_TOOLCHAIN (which sets WITHOUT_CLANG),
    the following residual files are left over:
    
    /usr/lib/clang/18/lib/freebsd/libclang_rt.asan-x86_64.so
    /usr/lib/clang/18/share/asan_ignore_list.txt
    /usr/lib/clang/18/share/cfi_ignore_list.txt
    /usr/lib/clang/18/share/msan_ignore_list.txt
    
    This is because the lib/libclang_rt directory is still descended into,
    even if WITHOUT_CLANG is used. Fix it by not descending into the
    libclang_rt directory in that case.
    
    PR:             277096
    Reported by:    Siva Mahadevan <me@svmhdvn.name>
    MFC after:      3 days
    
    (cherry picked from commit 514773a5486d1fa4f2d5acb5af1766965c20765b)
---
 lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Makefile b/lib/Makefile
index 6c0574e76afb..294e2b695bdc 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -179,7 +179,7 @@ SUBDIR.${MK_LDNS}+=	libldns
 SUBDIR.${MK_STATS}+=	libstats
 
 # The libraries under libclang_rt can only be built by clang.
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" && ${MK_CLANG} != "no"
 _libclang_rt=	libclang_rt
 .elif (${MK_ASAN} != "no" || ${MK_UBSAN} != "no") && make(all)
 .error Requested build with sanitizers but cannot build runtime libraries!