libcxx: misc cleanup

- try to restore SunOS patches which were left obviously broken (untested)
- reduce compiler requirement
- delint
This commit is contained in:
tnn 2022-08-13 09:38:09 +00:00
parent 772dff651c
commit 3024cd834e
7 changed files with 109 additions and 21 deletions

View file

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.12 2022/08/12 08:43:58 pin Exp $
# $NetBSD: Makefile,v 1.13 2022/08/13 09:38:09 tnn Exp $
.include "../../lang/llvm/version.mk"
PKGREVISION= 1
DISTNAME= libcxx-${LLVM_VERSION}.src
PKGNAME= ${DISTNAME:S/.src//}
@ -15,20 +16,22 @@ LICENSE= apache-2.0
# libcxx's includes to build, so we have this unholy extra distfiles thing
# in both of them to get them to build against each other without causing
# circular dependencies. This must be kept in sync with libcxxabi/Makefile.
LIBCXXABI= libcxxabi-${LLVM_VERSION}.src
LLVMDIST= llvm-${LLVM_VERSION}.src
_EXTRA_DIST= ${LIBCXXABI}${EXTRACT_SUFX} ${LLVMDIST}${EXTRACT_SUFX}
SITES.${LIBCXXABI}${EXTRACT_SUFX}= ${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
SITES.${LLLVMDIST}${EXTRACT_SUFX}= ${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
LIBCXXABI= libcxxabi-${LLVM_VERSION}.src
LLVMDIST= llvm-${LLVM_VERSION}.src
EXTRA_DIST= ${LIBCXXABI}${EXTRACT_SUFX} ${LLVMDIST}${EXTRACT_SUFX}
DISTFILES= ${DEFAULT_DISTFILES} ${_EXTRA_DIST}
SITES.${LIBCXXABI}${EXTRACT_SUFX}= \
${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
SITES.${LLLVMDIST}${EXTRACT_SUFX}= \
${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
CONFIGURE_DIRS= ${WRKDIR}/build
DISTFILES= ${DEFAULT_DISTFILES} ${EXTRA_DIST}
CONFIGURE_DIRS= build
CMAKE_ARG_PATH= ${WRKSRC}
USE_LANGUAGES= c c++
USE_LANGUAGES= c c++17
USE_CMAKE= yes
GCC_REQD+= 12
SSP_SUPPORTED= no
CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
@ -43,8 +46,11 @@ CMAKE_ARGS+= -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
# avoid conflict with stddef.h
CXXFLAGS.NetBSD+= -D__DEFINED_max_align_t=1
# Avoid GCC < 11 error https://github.com/llvm/llvm-project/issues/54018
CXXFLAGS+= -std=c++17 -D_LIBCPP_STD_VER=17
post-extract:
${MKDIR} ${WRKDIR}/build
${MKDIR} ${WRKSRC}/build
${LN} -f -s ${WRKDIR}/${LIBCXXABI} ${WRKDIR}/libcxxabi
${LN} -f -s ${WRKDIR}/${LLVMDIST} ${WRKDIR}/llvm

View file

@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.6 2022/08/12 08:43:58 pin Exp $
# $NetBSD: buildlink3.mk,v 1.7 2022/08/13 09:38:09 tnn Exp $
BUILDLINK_TREE+= libcxx
@ -8,7 +8,6 @@ LIBCXX_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.libcxx+= libcxx>=14.0.0
BUILDLINK_PKGSRCDIR.libcxx?= ../../lang/libcxx
.include "../../lang/llvm/buildlink3.mk"
.endif # LIBCXX_BUILDLINK3_MK
BUILDLINK_TREE+= -libcxx

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.18 2022/08/12 08:43:58 pin Exp $
$NetBSD: distinfo,v 1.19 2022/08/13 09:38:09 tnn Exp $
BLAKE2s (libcxx-14.0.6.src.tar.xz) = e77dfac79fb977adf84345b7e4c2762b3fa89f3d1f611baa8f8fa6831d1bc68a
SHA512 (libcxx-14.0.6.src.tar.xz) = c39bb01317e8ae7e5b23a677754a866953b6c45188c194d3d76fbd276de9565df8bcbcab8cf6606584af7dd30a61f39376c0e2de6b8c32c69f7fc592587e710d
@ -10,5 +10,7 @@ BLAKE2s (llvm-14.0.6.src.tar.xz) = 2d44946453add45426569fd4187654f83881341c5c010
SHA512 (llvm-14.0.6.src.tar.xz) = 6461bdde27aac17fa44c3e99a85ec47ffb181d0d4e5c3ef1c4286a59583e3b0c51af3c8081a300f45b99524340773a3011380059e3b3a571c3b0a8733e96fc1d
Size (llvm-14.0.6.src.tar.xz) = 49660136 bytes
SHA1 (patch-include_____config) = 01793dc2ec7db8f51d042fd0114649223036b089
SHA1 (patch-src_charconv.cpp) = b8569ae77df4a5a7b627b3a9cb6691be73699dca
SHA1 (patch-src_filesystem_filesystem__common.h) = 7b088ae8e577b482e05906434b510daed40469ae
SHA1 (patch-src_support_solaris_xlocale.cpp) = 027777a2945ce4aea89da59cb48426f2857d57d7
SHA1 (patch-src_include_to__chars__floating__point.h) = f7f880905609b87830ea657c7510fb3987448a09
SHA1 (patch-src_support_solaris_xlocale.cpp) = 51fc7940a60a4e288a1ccb65f1ea0502f6006490

View file

@ -0,0 +1,21 @@
$NetBSD: patch-src_charconv.cpp,v 1.1 2022/08/13 09:38:09 tnn Exp $
#if out some code that doesn't compile with GCC < 11 for now
--- src/charconv.cpp.orig 2022-06-22 16:46:24.000000000 +0000
+++ src/charconv.cpp
@@ -152,6 +152,7 @@ __u64toa(uint64_t value, char* buffer) n
// This implementation is dedicated to the memory of Mary and Thavatchai.
+#if _LIBCPP_STD_VER > 17
to_chars_result to_chars(char* __first, char* __last, float __value) {
return _Floating_to_chars<_Floating_to_chars_overload::_Plain>(__first, __last, __value, chars_format{}, 0);
}
@@ -192,5 +193,6 @@ to_chars_result to_chars(char* __first,
return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(
__first, __last, static_cast<double>(__value), __fmt, __precision);
}
+#endif
_LIBCPP_END_NAMESPACE_STD

View file

@ -1,10 +1,10 @@
$NetBSD: patch-src_filesystem_directory__iterator.cpp,v 1.2 2019/10/19 13:59:07 adam Exp $
$NetBSD: patch-src_filesystem_filesystem__common.h,v 1.1 2022/08/13 09:38:09 tnn Exp $
Support POSIX file modes.
--- src/filesystem/directory_iterator.cpp.orig 2019-02-01 23:52:17.000000000 +0000
+++ src/filesystem/directory_iterator.cpp
@@ -28,7 +28,21 @@ namespace {
--- src/filesystem/filesystem_common.h.orig 2022-06-22 16:46:24.000000000 +0000
+++ src/filesystem/filesystem_common.h
@@ -538,7 +538,21 @@ bool set_file_times(const path& p, std::
#if defined(DT_BLK)
template <class DirEntT, class = decltype(DirEntT::d_type)>
static file_type get_file_type(DirEntT* ent, int) {

View file

@ -0,0 +1,60 @@
$NetBSD: patch-src_include_to__chars__floating__point.h,v 1.1 2022/08/13 09:38:09 tnn Exp $
#if out some code that doesn't compile with GCC < 11 for now
--- src/include/to_chars_floating_point.h.orig 2022-06-22 16:46:24.000000000 +0000
+++ src/include/to_chars_floating_point.h
@@ -90,6 +90,7 @@ struct _Floating_type_traits<double> {
// ^^^^^^^^^^ DERIVED FROM corecrt_internal_fltintrn.h ^^^^^^^^^^
+#if _LIBCPP_STD_VER > 17
// FUNCTION to_chars (FLOATING-POINT TO STRING)
template <class _Floating>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI
@@ -329,7 +330,9 @@ to_chars_result _Floating_to_chars_hex_p
// We've already printed '-' if necessary, so uint32_t _Absolute_exponent avoids testing that again.
return _VSTD::to_chars(_First, _Last, _Absolute_exponent);
}
+#endif
+#if _LIBCPP_STD_VER > 17
template <class _Floating>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI
to_chars_result _Floating_to_chars_hex_shortest(
@@ -456,6 +459,7 @@ to_chars_result _Floating_to_chars_hex_s
// We've already printed '-' if necessary, so static_cast<uint32_t> avoids testing that again.
return _VSTD::to_chars(_First, _Last, static_cast<uint32_t>(_Unbiased_exponent));
}
+#endif
// For general precision, we can use lookup tables to avoid performing trial formatting.
@@ -828,6 +832,7 @@ struct _General_precision_tables<double>
0x7FEFFFFFFFFFFFFFu};
};
+#if _LIBCPP_STD_VER > 17
template <class _Floating>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI
to_chars_result _Floating_to_chars_general_precision(
@@ -980,9 +985,11 @@ to_chars_result _Floating_to_chars_gener
return {_First, errc{}};
}
+#endif
enum class _Floating_to_chars_overload { _Plain, _Format_only, _Format_precision };
+#if _LIBCPP_STD_VER > 17
template <_Floating_to_chars_overload _Overload, class _Floating>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI
to_chars_result _Floating_to_chars(
@@ -1068,6 +1075,7 @@ to_chars_result _Floating_to_chars(
}
}
}
+#endif
// clang-format on

View file

@ -1,4 +1,4 @@
$NetBSD: patch-src_support_solaris_xlocale.cpp,v 1.2 2022/08/12 08:43:58 pin Exp $
$NetBSD: patch-src_support_solaris_xlocale.cpp,v 1.3 2022/08/13 09:38:09 tnn Exp $
don't try to use sys/localedef.h on SunOS if nonexistent
OpenIndiana doesn't seem to ship the header.
@ -12,7 +12,7 @@ https://illumos.topicbox.com/groups/developer/T6cfd2e6cd87f3485-M30dac0cb6fffae6
//===----------------------------------------------------------------------===//
-#ifdef __sun__
+#ifdef(__sun__) && __has_include(<sys/localedef.h>)
+#if defined(__sun__) && __has_include(<sys/localedef.h>)
#include "__support/solaris/xlocale.h"
#include <stdarg.h>