aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias C. Berner <tcberner@FreeBSD.org>2023-07-10 18:57:28 +0000
committerTobias C. Berner <tcberner@FreeBSD.org>2023-09-13 05:16:58 +0000
commit4df0e66a3662ac9d427c2dcd79eb8555236083dd (patch)
tree57ef97f22c3ff70f8ae50efb4a9100d8c7aee9f5
parentd3f22d319918c1dda4dbfbc5d85678c91ed13590 (diff)
downloadports-4df0e66a3662ac9d427c2dcd79eb8555236083dd.tar.gz
ports-4df0e66a3662ac9d427c2dcd79eb8555236083dd.zip
llvm.mk: add export/noexport to handle CC/CXX/CPP exports
Reviewed by: bofh Differential Revision: https://reviews.freebsd.org/D37747
-rw-r--r--CHANGES7
-rw-r--r--Mk/Uses/llvm.mk26
2 files changed, 33 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 2f6c9a61499d..bc1188ea4016 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,13 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
+20230823:
+AUTHOR: tcberner@FreeBSD.org
+
+ USES=llvm.mk now supports 'export' (default) and 'noexport' arguments.
+ When export is set, CC, CXX and CPP will be set to the path corresponding
+ to the chosen llvm-version.
+
20230821:
AUTHOR: jhale@FreeBSD.org
diff --git a/Mk/Uses/llvm.mk b/Mk/Uses/llvm.mk
index 931ad99156f8..54cd2364255b 100644
--- a/Mk/Uses/llvm.mk
+++ b/Mk/Uses/llvm.mk
@@ -14,6 +14,10 @@
# min=number: use specified min if ${LLVM_DEFAULT} is lower
# max=number: use specified max if ${LLVM_DEFAULT} is higher
#
+# * environment
+# export: do export CC, CXX,... variables [default]
+# noexport: do not export CC,CXX,... variables
+#
# An example usage might be:
# USES= llvm
# or
@@ -35,6 +39,7 @@ _INCLUDE_USES_LLVM_MK= YES
_LLVM_MK_VALID_VERSIONS= 10 11 12 13 14 15 16
_LLVM_MK_VALID_CONSTRAINTS= min max
_LLVM_MK_VALID_MODES= build run lib
+_LLVM_MK_VALID_EXPORTS= export noexport
# === parse mode arguments ===
_LLVM_MK_MODES= # empty
@@ -66,6 +71,21 @@ _LLVM_MK_VERSION= ${LLVM_DEFAULT}
. endif
. endif
+# === parse environment arguments ===
+_LLVM_MK_EXPORT= # empty
+. for _export in ${_LLVM_MK_VALID_EXPORTS}
+. if ${llvm_ARGS:M${_export}}
+. if !empty(_LLVM_MK_EXPORT)
+BROKEN= USES=llvm:${llvm_ARGS} contains multiple export definitions
+. else
+_LLVM_MK_EXPORT= ${_export}
+. endif
+. endif
+. endfor
+. if empty(_LLVM_MK_EXPORT)
+_LLVM_MK_EXPORT= export
+. endif
+
# === handle constraints ===
. for _constraint in ${_LLVM_MK_VALID_CONSTRAINTS}
_version= ${llvm_ARGS:M${_constraint}=[0-9]*:S/${_constraint}=//}
@@ -115,4 +135,10 @@ LLVM_LIBLLVM= ${_LLVM_MK_LIBLLVM}
LLVM_VERSION= ${_LLVM_MK_VERSION}
LLVM_PREFIX= ${_LLVM_MK_PREFIX}
+. if empty(_LLVM_MK_EXPORT:Mnoexport)
+CC= ${LLVM_PREFIX}/bin/clang
+CXX= ${LLVM_PREFIX}/bin/clang++
+CPP= ${LLVM_PREFIX}/bin/clang-cpp
+. endif
+
.endif