llvm.mk: add export/noexport to handle CC/CXX/CPP exports

Reviewed by:	bofh
Differential Revision:	https://reviews.freebsd.org/D37747
This commit is contained in:
Tobias C. Berner 2023-07-10 20:57:28 +02:00
parent d3f22d3199
commit 4df0e66a36
2 changed files with 33 additions and 0 deletions

View file

@ -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

View file

@ -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