aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2013-11-08 01:35:36 +0800
committerbapt <bapt@FreeBSD.org>2013-11-08 01:35:36 +0800
commitb1bc7f6715218b675dfa1b2668ffa92a55c85db4 (patch)
treec0c556d0fd3e66734e7e459b827c9da4892df183 /Mk
parent974076ed857aaea015b4d74379599f43fddece27 (diff)
downloadfreebsd-ports-gnome-b1bc7f6715218b675dfa1b2668ffa92a55c85db4.tar.gz
freebsd-ports-gnome-b1bc7f6715218b675dfa1b2668ffa92a55c85db4.tar.zst
freebsd-ports-gnome-b1bc7f6715218b675dfa1b2668ffa92a55c85db4.zip
Allow base clang to be used if version is >= 3.3
This gives 2 new variables to the porters: ALT_COMPILER_TYPE which can be empty, clang or cc depending on what ${CC} is ALT_COMPILER_VERSION which will give the porter a 2 digit version of the alternative compiler Requested by: many
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/compiler.mk22
1 files changed, 22 insertions, 0 deletions
diff --git a/Mk/Uses/compiler.mk b/Mk/Uses/compiler.mk
index 3b5e256536c8..ae071415961e 100644
--- a/Mk/Uses/compiler.mk
+++ b/Mk/Uses/compiler.mk
@@ -59,6 +59,22 @@ COMPILER_TYPE= clang
COMPILER_TYPE= gcc
.endif
+ALT_COMPILER_VERSION= 0
+ALT_COMPILER_TYPE= none
+_ALTCCVERSION=
+.if ${COMPILER_TYPE} == gcc && exists(/usr/bin/clang)
+_ALTCCVERSION!= /usr/bin/clang --version
+.elif ${COMPILER_TYPE} == clang && exists(/usr/bin/gcc)
+_ALTCCVERSION!= /usr/bin/gcc --version
+.endif
+
+ALT_COMPILER_VERSION= ${_ALTCCVERSION:M[0-9].[0-9]*:C/([0-9]).([0-9]).*/\1\2/g}
+.if ${_ALTCCVERSION:Mclang}
+ALT_COMPILER_TYPE= clang
+.elif !empty(_ALTCCVERSION)
+ALT_COMPILER_TYPE= gcc
+.endif
+
.if ${_COMPILER_ARGS:Mopenmp}
.if ${COMPILER_TYPE} == clang
USE_GCC= yes
@@ -101,6 +117,11 @@ USE_GCC= yes
.if defined(FAVORITE_COMPILER) && ${FAVORITE_COMPILER} == gcc
USE_GCC= yes
.elif (${COMPILER_TYPE} == clang && ${COMPILER_VERSION} < 33) || ${COMPILER_TYPE} == gcc
+.if ${ALT_COMPILER_TYPE} == clang && ${ALT_COMPILER_VERSION} >= 33
+CPP= clang-cpp
+CC= clang
+CXX= clang++
+.else
BUILD_DEPENDS+= ${LOCALBASE}/bin/clang33:${PORTSDIR}/lang/clang33
CPP= ${LOCALBASE}/bin/clang-cpp33
CC= ${LOCALBASE}/bin/clang33
@@ -108,6 +129,7 @@ CXX= ${LOCALBASE}/bin/clang++33
.endif
.endif
.endif
+.endif
.if ${_COMPILER_ARGS:Mc11}
.if !${COMPILER_FEATURES:Mc11}