From f3e64125947ddcdd128238255502b568e2afab50 Mon Sep 17 00:00:00 2001 From: he Date: Sun, 26 Dec 2021 21:52:11 +0000 Subject: Allow overriding the pthread library selection via PKGSRC_LLVM_PTHREADLIB. LLVM insists on 64-bit atomics, and on NetBSD/powerpc we don't have that natively, so have to rely on -latomic from gcc. This library is linked with -lpthread, so the cmake logic to detect whether -lpthread is included in the C library says "yes", leading to later breakage when clang is being built. On NetBSD, set PKGSRC_LLVM_PTHREADLIB to -lpthread. OK'ed by wiz@, bump PKGREVISION. --- lang/llvm/Makefile | 8 ++++++-- lang/llvm/distinfo | 4 ++-- lang/llvm/patches/patch-cmake_config-ix.cmake | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'lang/llvm') diff --git a/lang/llvm/Makefile b/lang/llvm/Makefile index 879583ec09a..ba240895695 100644 --- a/lang/llvm/Makefile +++ b/lang/llvm/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.67 2021/12/08 16:05:21 adam Exp $ +# $NetBSD: Makefile,v 1.68 2021/12/26 21:52:11 he Exp $ # # when updating this, please also update: # devel/include-what-you-use @@ -21,7 +21,7 @@ # Always update all */buildlink3.mk to require the latest stable release # version in BUILDLINK_API_DEPENDS, as there is no backwards compatibility -PKGREVISION= 1 +PKGREVISION= 2 .include "version.mk" DISTNAME= llvm-${LLVM_VERSION}.src @@ -109,6 +109,10 @@ CFLAGS+= -mlongcall CXXFLAGS+= -mlongcall .endif +.if ${OPSYS} == "NetBSD" +CMAKE_ARGS+= -DPKGSRC_LLVM_PTHREADLIB=-lpthread +.endif + .include "options.mk" # replacing config.guess is required even for cmake. diff --git a/lang/llvm/distinfo b/lang/llvm/distinfo index dd211992983..7576a43f5f3 100644 --- a/lang/llvm/distinfo +++ b/lang/llvm/distinfo @@ -1,10 +1,10 @@ -$NetBSD: distinfo,v 1.32 2021/11/23 20:55:44 wiz Exp $ +$NetBSD: distinfo,v 1.33 2021/12/26 21:52:11 he Exp $ BLAKE2s (llvm-13.0.0.src.tar.xz) = ffdfed33e870715f2e8c0efdc2c29566a2bffe5a6efce90ea7ca4990c9067f0f SHA512 (llvm-13.0.0.src.tar.xz) = c307500a5fdc2bf6d768a808cf879d33914e24437f4f794361eccedb28ac6a98ebc41ca6140d09364c9bdec565fabd049e364d3f5b39f1751ecff51b687c4eff Size (llvm-13.0.0.src.tar.xz) = 45471992 bytes SHA1 (patch-CMakeLists.txt) = 78e2dab2bf73f7e466ca2788fe6444e39b4ebd80 -SHA1 (patch-cmake_config-ix.cmake) = 0c89e208e9e101a6d80aaa5007126eefb0d3647c +SHA1 (patch-cmake_config-ix.cmake) = 72d15d43d6d8eb3bd8b2c1ff7d416bd6b2421908 SHA1 (patch-cmake_modules_AddLLVM.cmake) = 148897aeba8c29b9cf55eade62554710ae0f63f3 SHA1 (patch-include_llvm-c_DataTypes.h) = 790c9458d6590a0d6985fdcbd8785da340b9779b SHA1 (patch-include_llvm_Analysis_ConstantFolding.h) = 56b9374da236c346565897977040255b9766cab8 diff --git a/lang/llvm/patches/patch-cmake_config-ix.cmake b/lang/llvm/patches/patch-cmake_config-ix.cmake index e469325eee2..4deaa15c1aa 100644 --- a/lang/llvm/patches/patch-cmake_config-ix.cmake +++ b/lang/llvm/patches/patch-cmake_config-ix.cmake @@ -1,10 +1,24 @@ -$NetBSD: patch-cmake_config-ix.cmake,v 1.5 2021/07/12 18:41:02 adam Exp $ +$NetBSD: patch-cmake_config-ix.cmake,v 1.6 2021/12/26 21:52:11 he Exp $ Do not generate invalid llvm-config in pkgsrc. +Allow override of pthread library selection via PKGSRC_LLVM_PTHREADLIB. --- cmake/config-ix.cmake.orig 2021-04-06 16:38:18.000000000 +0000 +++ cmake/config-ix.cmake -@@ -175,7 +175,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memor +@@ -113,7 +113,11 @@ if(HAVE_LIBPTHREAD) + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + set(THREADS_HAVE_PTHREAD_ARG Off) + find_package(Threads REQUIRED) +- set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) ++ if(PKGSRC_LLVM_PTHREADLIB) ++ set(LLVM_PTHREAD_LIB ${PKGSRC_LLVM_PTHREADLIB}) ++ else() ++ set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) ++ endif() + endif() + + if(LLVM_ENABLE_ZLIB) +@@ -176,7 +180,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memor set(MAYBE_REQUIRED) endif() if(LLVM_ENABLE_TERMINFO) -- cgit v1.2.3