git: 128f72b23891 - main - devel/llvm11: don't build gold plugin when disabled

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Tue, 09 Dec 2025 16:05:56 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/ports/commit/?id=128f72b23891bd1ad91699e25e3b54dc91bd7c52

commit 128f72b23891bd1ad91699e25e3b54dc91bd7c52
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-12-09 16:04:29 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-12-09 16:05:37 +0000

    devel/llvm11: don't build gold plugin when disabled
    
    Disabling the GOLD option didn't actually disable building the plugin,
    it just didn't install it in the package.  Actually stop traversing into
    the directory when the option disabled so we don't end up needing
    devel/binutils.
    
    PR:             291247
    Sponsored by:   DARPA, AFRL
---
 devel/llvm11/Makefile                                 |  3 ++-
 devel/llvm11/files/gold-off-llvm_tools_CMakeLists.txt | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/devel/llvm11/Makefile b/devel/llvm11/Makefile
index 4d0aa2bb347e..d8e04fb7cdaf 100644
--- a/devel/llvm11/Makefile
+++ b/devel/llvm11/Makefile
@@ -117,8 +117,9 @@ EXTRAS_EXTRA_PATCHES=	${PATCHDIR}/extras
 EXTRAS_IMPLIES=		CLANG
 EXTRAS_DISTFILES=	clang-tools-extra-${DISTVERSION}.src${EXTRACT_SUFX}
 GOLD_DESC=		Build the LLVM Gold plugin for LTO
-GOLD_CMAKE_ON=		-DLLVM_BINUTILS_INCDIR=${LOCALBASE}/include
 GOLD_BUILD_DEPENDS=	${LOCALBASE}/bin/ld.gold:devel/binutils
+GOLD_CMAKE_ON=		-DLLVM_BINUTILS_INCDIR=${LOCALBASE}/include
+GOLD_EXTRA_PATCHES_OFF=	${PATCHDIR}/gold-off-llvm_tools_CMakeLists.txt
 LIT_DESC=		Install lit and FileCheck test tools
 LIT_VARS=		_USES_PYTHON=python
 LLD_DESC=		Install lld, the LLVM linker
diff --git a/devel/llvm11/files/gold-off-llvm_tools_CMakeLists.txt b/devel/llvm11/files/gold-off-llvm_tools_CMakeLists.txt
new file mode 100644
index 000000000000..d7bb05f50eb6
--- /dev/null
+++ b/devel/llvm11/files/gold-off-llvm_tools_CMakeLists.txt
@@ -0,0 +1,10 @@
+--- tools/CMakeLists.txt.orig
++++ tools/CMakeLists.txt
+@@ -29,7 +29,6 @@
+ # requires targets specified in DEPENDS to exist before the call to
+ # ExternalProject_Add.
+ add_llvm_tool_subdirectory(lto)
+-add_llvm_tool_subdirectory(gold)
+ add_llvm_tool_subdirectory(llvm-ar)
+ add_llvm_tool_subdirectory(llvm-config)
+ add_llvm_tool_subdirectory(llvm-lto)