Re: git: 04e074c6fd45 - main - devel/llvm14: Update to 14.0.0 release

From: Ashish SHUKLA <ashish_at_FreeBSD.ORG>
Date: Sat, 26 Mar 2022 15:30:07 UTC
On Fri, Mar 25, 2022 at 10:50:27PM +0000, Brooks Davis wrote:
> The branch main has been updated by brooks:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=04e074c6fd452983ccfd931de0c43263d27fe1f3
> 
> commit 04e074c6fd452983ccfd931de0c43263d27fe1f3
> Author:     Brooks Davis <brooks@FreeBSD.org>
> AuthorDate: 2022-03-25 22:49:58 +0000
> Commit:     Brooks Davis <brooks@FreeBSD.org>
> CommitDate: 2022-03-25 22:49:58 +0000
> 
>     devel/llvm14: Update to 14.0.0 release
>     
>     Avoid a dependency of libunwind on sufficently recent systems where
>     the installed unwind.h can be found.
>     
>     PR:             262707
>     Reported by:    pkubaj
> ---
>  devel/llvm14/Makefile | 11 +++++++----
>  devel/llvm14/distinfo |  6 +++---
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/devel/llvm14/Makefile b/devel/llvm14/Makefile
> index 73d459cc20f6..a62a794187db 100644
> --- a/devel/llvm14/Makefile
> +++ b/devel/llvm14/Makefile
> @@ -1,5 +1,5 @@
>  PORTNAME=	llvm
> -DISTVERSION=	14.0.0rc4
> +DISTVERSION=	14.0.0
>  PORTREVISION=	0
>  CATEGORIES=	devel lang
>  MASTER_SITES=	https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
> @@ -134,9 +134,6 @@ CLANG_SUB_LIST=		XCC=clang${LLVM_SUFFIX} \
>  			X_COMPILER_TYPE=clang
>  CLANG_USE=		GNOME=libxml2
>  COMPILER_RT_DESC=	Sanitizer libraries
> -# An unwind.h is require to build.  I think an in-tree one should be used
> -# but this seems to work as a workaround...
> -COMPILER_RT_BUILD_DEPENDS=	libunwind>0:devel/libunwind
>  COMPILER_RT_CMAKE_ON=	-DCOMPILER_RT_INSTALL_PATH=${LLVM_PREFIX}/lib/clang/${LLVM_RELEASE}
>  # Allow unwind.h to be found reliably
>  COMPILER_RT_USES=	localbase
> @@ -273,6 +270,12 @@ MLIR_PATTERN=	${MLIR_COMMANDS:S/^/bin./:tW:C/  */|/g}|mlir|libMLIR|obj.MLIRCAP
>  
>  .include <bsd.port.options.mk>
>  
> +.if ${OSVERSION} < 1300525
> +# An unwind.h is require to build.  I think an in-tree one should be used
> +# but this seems to work as a workaround...
> +COMPILER_RT_BUILD_DEPENDS=	libunwind>0:devel/libunwind
> +.endif
> +

This is ineffective as the evaluation/processing of `${OPTION_NAME}_BUILD_DEPENDS` variables happen in the bsd.port.options.mk, which is already included before this gets defined, and so it results in a build error on 13-RELEASE:

====================================================================
/usr/local/libexec/ccache/c++ -DHAVE_RPC_XDR_H=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm14/work/.build/projects/compiler-rt/lib/sanitizer_common -I/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0.src/compiler-rt/lib/sanitizer_common -I/wrkdirs/usr/ports/devel/llvm14/work/.build/include -I/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0.src/llvm/include -I/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0.src/compiler-rt/lib/sanitizer_common/.. -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -nostdinc++ -Wno-format -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -std=c++14 -MD -MT projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.i386.dir/sanitizer_unwind_linux_libcdep.cpp.o -MF projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.i386.dir/sanitizer_unwind_linux_libcdep.cpp.o.d -o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.i386.dir/sanitizer_unwind_linux_libcdep.cpp.o -c /wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0.src/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0.src/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:26:10: fatal error: 'unwind.h' file not found
#include <unwind.h>
^~~~~~~~~~
1 error generated.                                                                                                                                                                                                                         
====================================================================

Following should fix this:

====================================================================
diff --git a/devel/llvm14/Makefile b/devel/llvm14/Makefile
index 8e3bb67aa2b8..9527e359961e 100644
--- a/devel/llvm14/Makefile
+++ b/devel/llvm14/Makefile
@@ -273,7 +273,9 @@ MLIR_PATTERN=	${MLIR_COMMANDS:S/^/bin./:tW:C/  */|/g}|mlir|libMLIR|obj.MLIRCAP
 .if ${OSVERSION} < 1300525
 # An unwind.h is require to build.  I think an in-tree one should be used
 # but this seems to work as a workaround...
-COMPILER_RT_BUILD_DEPENDS=	libunwind>0:devel/libunwind
+.if ${PORT_OPTIONS:MCOMPILER_RT}
+BUILD_DEPENDS+=	libunwind>0:devel/libunwind
+.endif
 .endif
 
 .if defined(PPC_ABI) && ${PPC_ABI} == ELFv2
====================================================================

Before diff:

====================================================================
# make -C devel/llvm14 -V PORT_OPTIONS
 BE_AMDGPU BE_STANDARD BE_WASM CLANG COMPILER_RT DOCS EXTRAS FLANG GOLD LIT LLD LLDB MLIR OPENMP PYCLANG
# make -C /usr/ports/devel/llvm14 -V BUILD_DEPENDS
py38-sphinx-markdown-tables>=0:textproc/py-sphinx-markdown-tables@py38  py38-recommonmark>=0.0.20180530:textproc/py-recommonmark@py38 /usr/local/bin/ld.gold:devel/binutils swig:devel/swig /usr/local/bin/cmake:devel/cmake ninja:devel/ninja /usr/local/bin/python3.8:lang/python38 perl5>=5.32.r0<5.33:lang/perl5.32
====================================================================

After diff:

====================================================================
# make -C /usr/ports/devel/llvm14 -V BUILD_DEPENDS
py38-sphinx-markdown-tables>=0:textproc/py-sphinx-markdown-tables@py38  py38-recommonmark>=0.0.20180530:textproc/py-recommonmark@py38 /usr/local/bin/ld.gold:devel/binutils swig:devel/swig libunwind>0:devel/libunwind /usr/local/bin/cmake:devel/cmake ninja:devel/ninja /usr/local/bin/python3.8:lang/python38 perl5>=5.32.r0<5.33:lang/perl5.32
====================================================================

HTH
-- 
Ashish SHUKLA | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0

"If I destroy you, what business is it of yours ?" (Dark Forest, Liu Cixin)