git: c4eb9478257e - main - devel/boost-{all,libs}: Adjust range of OSVERSION to use LLVM from ports

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Sun, 21 Apr 2024 01:18:14 UTC
The branch main has been updated by yasu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c4eb9478257e33a0e2c9de216fe4503127f3abef

commit c4eb9478257e33a0e2c9de216fe4503127f3abef
Author:     Yasuhiro Kimura <yasu@FreeBSD.org>
AuthorDate: 2024-04-21 01:14:18 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2024-04-21 01:14:18 +0000

    devel/boost-{all,libs}: Adjust range of OSVERSION to use LLVM from ports
    
    The reason to use LLVM from ports is that there is bug in Clang/LLVM
    of base system that causes assertion failure while building
    devel/boost-libs. The bug is already fixed with main, stable/14 and
    stable/13 branches of src repository. So we need to use LLVM from
    ports only with following ranges of OSVERSION.
    
    1. 1500000 <= OSVERSION < 1500017
    2. 1400000 <= OSVERSION < 1400509
    3. 1300000 <= OSVERSION < 1303502
    
    And commit 3b8c51bd37b0 adjusts the range as above.
    
    But there is a pitfall about it. The assertion failure happens only if
    base system is built with WITH_LLVM_ASSERTIONS variable set. By
    default it is set with main branch but not with stable/* and releng/*
    ones. So wheareas the failure happens with -CURRENT even if it is
    built with default variables settings, it doesn't happen with -STABLE
    and -RELEASE unless they are built with WITH_LLVM_ASSERTIONS set. IMHO
    majority of FreeBSD users use -RELEASE with official binary, and few
    -STABLE users set WITH_LLVM_ASSERTIONS. As a result adjustment with
    commit 3b8c51bd37b0 forces most -RELEASE and -STABLE users to build
    LLVM port unnecessarily.
    
    So adjust the range so LLVM from ports is used by default only if base
    system is -CURRENT with the assertion failure unfixed. And as a last
    resort for -STABLE and -RELEASE users who set WITH_LLVM_ASSERTIONS,
    add LLVM_FROM_PORTS option to devel/boost-libs that forces to use LLVM
    from ports.
    
    PR:             277856
    Approved by:    maintainer timeout
---
 devel/boost-all/compiled.mk |  5 +++--
 devel/boost-libs/Makefile   | 24 +++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/devel/boost-all/compiled.mk b/devel/boost-all/compiled.mk
index 6062ce1d7666..c81c2a006e58 100644
--- a/devel/boost-all/compiled.mk
+++ b/devel/boost-all/compiled.mk
@@ -45,8 +45,9 @@ MAKE_ARGS+=	pch=off
 
 .if ${OPSYS} == FreeBSD && \
 	((${OSVERSION} >= 1500000 && ${OSVERSION} < 1500017) || \
-	(${OSVERSION} >= 1400000 && ${OSVERSION} < 1400509) || \
-	(${OSVERSION} >= 1300000 && ${OSVERSION} < 1303502))
+	(${OSVERSION} >= 1400000 && ${OSVERSION} < 1400097)|| \
+	(${OSVERSION} >= 1300000 && ${OSVERSION} < 1300137) || \
+	${PORT_OPTIONS:MLLVM_FROM_PORTS})
 USES+=	llvm:build
 CHOSEN_COMPILER_TYPE=	clang
 .else
diff --git a/devel/boost-libs/Makefile b/devel/boost-libs/Makefile
index 5ce2aa66d57f..34abe110d84d 100644
--- a/devel/boost-libs/Makefile
+++ b/devel/boost-libs/Makefile
@@ -11,12 +11,34 @@ BROKEN_sparc64=	https://github.com/boostorg/context/commit/f2ef6326b6ed
 
 BUILD_DEPENDS+=	bjam:devel/boost-jam
 
-OPTIONS_DEFINE=		DEBUG OPTIMIZED_CFLAGS
+# Note about LLVM_FROM_PORTS option:
+# Build of this port fails with assertion failure of compiler due to
+# bug of LLVM/Clang in base system. The failure happens when all of
+# following conditions are satisfied.
+# * OSVERSION is included in either of following ranges.
+#   1. 1500000 <= OSVERSION < 1500017
+#   2. 1400000 <= OSVERSION < 1400509
+#   3. 1300000 <= OSVERSION < 1303502
+# * Base system is built with WITH_LLVM_ASSERTIONS variable set.
+# So if your base system fulfills them you need to use LLVM ports to
+# build this port.
+# By default WITH_LLVM_ASSERTIONS variable is set with -CURRENT but
+# not with -STABLE and -RELEASE. So whereas most -CURRENT users face
+# the build failure, few -STABLE and -RELEASE user faces it.
+# Therefore by default this port uses LLVM from ports only if base
+# system is -CURRENT and OSVERSION is included in above ranges. It
+# make it possible for most -STABLE and -RELEASE users to avoid to
+# build LLVM ports unnecessarily. But if someone uses -STABLE or
+# -RELEASE built with WITH_LLVM_ASSERTIONS set, then he can't build
+# this port successfully on such system. So provide LLVM_FROM_PORTS
+# option as a last resort for him.
+OPTIONS_DEFINE=		DEBUG LLVM_FROM_PORTS OPTIMIZED_CFLAGS
 OPTIONS_MULTI=		LOCALE
 OPTIONS_MULTI_LOCALE=	ICONV ICU
 OPTIONS_DEFAULT=	ICONV ICU
 ICONV_DESC=		Boost.Locale with iconv encoding support
 ICU_DESC=		Boost.Regex/Locale with ICU unicode support
+LLVM_FROM_PORTS_DESC=	Use LLVM from ports to build
 
 ICONV_USES=		iconv
 ICONV_MAKE_ARGS=	-sICONV_PATH=${ICONV_PREFIX}