git: 782745a8ef20 - main - devel/creduce: add crutch for using libc++ 14 with clang++ 8
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 13 Feb 2022 18:57:49 UTC
The branch main has been updated by dim (src committer):
URL: https://cgit.FreeBSD.org/ports/commit/?id=782745a8ef207fdaaaa6020ed51aea65f0b17437
commit 782745a8ef207fdaaaa6020ed51aea65f0b17437
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-02-13 14:05:12 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-02-13 18:50:06 +0000
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
---
devel/creduce/Makefile | 10 +++++++++-
devel/creduce/files/builtin_is_constant_evaluated.h | 1 +
2 files changed, 10 insertions(+), 1 deletion(-)
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; }