aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-02-13 14:05:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-02-13 18:50:06 +0000
commit782745a8ef207fdaaaa6020ed51aea65f0b17437 (patch)
treeb6fdc7c4167f22e051c360894afeb02aed14a087
parentcf8d1a0e6c06f75117f54eb9bf8a28b850537d90 (diff)
downloadports-782745a8ef207fdaaaa6020ed51aea65f0b17437.tar.gz
ports-782745a8ef207fdaaaa6020ed51aea65f0b17437.zip
devel/creduce: add crutch for using libc++ 14 with clang++ 8
C-Reduce still depends on devel/llvm80, and this is no longer compatible with libc++ 14 or higher, since libc++ now requires support for the __builtin_is_constant_evaluated() builtin function (see https://github.com/llvm/llvm-project/commit/1123100a16a321d70508e2508ebc5d57ce7163dc ). As a crutch, add a small header which defines a constexpr __builtin_is_constant_evaluated() function, and include that at the top of every compiled file, using -include, whenever the base system clang version is 14 or higher. Approved by: swills (maintainer) MFH: 2022Q1
-rw-r--r--devel/creduce/Makefile10
-rw-r--r--devel/creduce/files/builtin_is_constant_evaluated.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/devel/creduce/Makefile b/devel/creduce/Makefile
index d0cf2295c97f..ec9dfa3a841c 100644
--- a/devel/creduce/Makefile
+++ b/devel/creduce/Makefile
@@ -26,7 +26,7 @@ CONFIGURE_ENV= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config${LLVM_VER} \
CXX=${LOCALBASE}/bin/clang++${LLVM_VER} \
CPP=${LOCALBASE}/bin/clang-cpp${LLVM_VER}
-USES= autoreconf gmake libtool perl5
+USES= autoreconf compiler gmake libtool perl5
CFLAGS_powerpc64= -mabi=elfv2
@@ -36,4 +36,12 @@ CFLAGS_powerpc64= -mabi=elfv2
LLD_UNSAFE= yes
.endif
+.include <bsd.port.pre.mk>
+
+# Detect base system libc++ >= 14 by checking for COMPILER_VERSION.
+# Not really the ideal way, but it should work.
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 140
+CXXFLAGS+= -include ${FILESDIR}/builtin_is_constant_evaluated.h
+.endif
+
.include <bsd.port.mk>
diff --git a/devel/creduce/files/builtin_is_constant_evaluated.h b/devel/creduce/files/builtin_is_constant_evaluated.h
new file mode 100644
index 000000000000..2775e8fa1bf3
--- /dev/null
+++ b/devel/creduce/files/builtin_is_constant_evaluated.h
@@ -0,0 +1 @@
+constexpr bool __builtin_is_constant_evaluated() { return false; }