From 01b1ed56de8dcd0622782b07ef6c4658e47ef071 Mon Sep 17 00:00:00 2001 From: Tatsuki Makino Date: Thu, 23 Nov 2023 11:02:04 +0100 Subject: [PATCH] audio/audacity: Fix build in 12 and 13 Conditional workaround for the problem with old libc++ and the buggy implementation of std::conjunction Patch by tatsuki_makino@hotmail.com PR: 275192 --- audio/audacity/Makefile | 10 +++-- .../extra-libraries_lib-utility_TypeList.cpp | 23 +++++++++++ .../extra-libraries_lib-utility_TypeList.h | 39 +++++++++++++++++++ .../extra-libraries_lib-utility_TypeSwitch.h | 20 ++++++++++ 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 audio/audacity/files/extra-libraries_lib-utility_TypeList.cpp create mode 100644 audio/audacity/files/extra-libraries_lib-utility_TypeList.h create mode 100644 audio/audacity/files/extra-libraries_lib-utility_TypeSwitch.h diff --git a/audio/audacity/Makefile b/audio/audacity/Makefile index fd6239d386d40..5d441d67db128 100644 --- a/audio/audacity/Makefile +++ b/audio/audacity/Makefile @@ -8,9 +8,6 @@ MAINTAINER= xxjack12xx@gmail.com COMMENT= GUI editor for digital audio waveforms WWW= https://www.audacityteam.org/ -BROKEN_FreeBSD_13= compiler bug -BROKEN_FreeBSD_12= compiler bug - LICENSE= GPLv2+ LICENSE_FILE= ${WRKSRC}/LICENSE.txt @@ -153,6 +150,13 @@ CMAKE_ARGS+= -DHAVE_MMX:BOOL=OFF \ -DHAVE_SSE2:BOOL=OFF .endif +.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1302508 +# Workarounds for buggy libc++ std::conjunction +EXTRA_PATCHES= ${PATCHDIR}/extra-libraries_lib-utility_TypeList.cpp \ + ${PATCHDIR}/extra-libraries_lib-utility_TypeList.h \ + ${PATCHDIR}/extra-libraries_lib-utility_TypeSwitch.h +.endif + post-install: @${RM} ${STAGEDIR}${DOCSDIR}/LICENSE.txt #delete empty directories: https://github.com/audacity/audacity/issues/808 diff --git a/audio/audacity/files/extra-libraries_lib-utility_TypeList.cpp b/audio/audacity/files/extra-libraries_lib-utility_TypeList.cpp new file mode 100644 index 0000000000000..2575d8f5f7450 --- /dev/null +++ b/audio/audacity/files/extra-libraries_lib-utility_TypeList.cpp @@ -0,0 +1,23 @@ +--- libraries/lib-utility/TypeList.cpp.orig 2023-11-16 11:58:21 UTC ++++ libraries/lib-utility/TypeList.cpp +@@ -118,16 +118,16 @@ static_assert(Is_v); + static_assert(Is_v); + + static_assert(Every_v, Example>); +-static_assert(is_base_of_v, Example>>); ++static_assert(TypeList::is_base_of_v, Example>>); + static_assert(!Every_v, Example>); +-static_assert(is_base_of_v, ++static_assert(TypeList::is_base_of_v, + Every, Example>>); + + static_assert(Some_v, Example>); +-static_assert(is_base_of_v, ++static_assert(TypeList::is_base_of_v, + Some, Example>>); + static_assert(!Some_v, Example>); +-static_assert(is_base_of_v, Example>>); ++static_assert(TypeList::is_base_of_v, Example>>); + + static_assert(NotEvery_v, Example>); + static_assert(NotAny_v, Example>); diff --git a/audio/audacity/files/extra-libraries_lib-utility_TypeList.h b/audio/audacity/files/extra-libraries_lib-utility_TypeList.h new file mode 100644 index 0000000000000..dfc77dc2be3d8 --- /dev/null +++ b/audio/audacity/files/extra-libraries_lib-utility_TypeList.h @@ -0,0 +1,39 @@ +--- libraries/lib-utility/TypeList.h.orig 2023-11-16 11:58:21 UTC ++++ libraries/lib-utility/TypeList.h +@@ -54,6 +54,18 @@ namespace TypeList { + can make compound predicates out of simpler ones. + */ + ++template ++struct conjunction : std::true_type {}; ++ ++template ++struct conjunction<_Arg> : _Arg {}; ++ ++template ++struct conjunction<_Arg, _Args...> : std::conditional_t> {}; ++ ++template ++inline constexpr bool is_base_of_v = __is_base_of(_Bp, _Dp); ++ + //! standard in C++20; add a level of indirection to a type + template struct type_identity { using type = T; }; + +@@ -429,7 +441,7 @@ struct And { (private) + static constexpr bool value = Is_v, T>; + }; + public: +- template using typemap = typename std::conjunction< ++ template using typemap = typename TypeList::conjunction< + typename Predicate::template typemap, Rest + >; + }; +@@ -437,7 +449,7 @@ struct And { (private) + //! Derived from the Predicate, applied to the first of the types (often boolean + //! constant types), for which the value is false; or std::true_type + template struct Every +- : Apply_t> {}; ++ : Apply_t> {}; + //! The constant value in the corresponding type + template constexpr auto Every_v = + Every::value; diff --git a/audio/audacity/files/extra-libraries_lib-utility_TypeSwitch.h b/audio/audacity/files/extra-libraries_lib-utility_TypeSwitch.h new file mode 100644 index 0000000000000..f0291a0356a88 --- /dev/null +++ b/audio/audacity/files/extra-libraries_lib-utility_TypeSwitch.h @@ -0,0 +1,20 @@ +--- libraries/lib-utility/TypeSwitch.h.orig 2023-11-16 11:58:21 UTC ++++ libraries/lib-utility/TypeSwitch.h +@@ -127,7 +127,7 @@ struct Executor { + // Case 1: Compatible, and invocable on the next function, giving + // another function, that accepts BaseClass: + struct Case1_; +- using Case1 = std::conjunction; ++ using Case1 = TypeList::conjunction; + struct Case1_ { + static constexpr bool value = std::is_invocable_v< + std::invoke_result_t, BaseClass&, Args&&...>; +@@ -135,7 +135,7 @@ struct Executor { + }; + + // Case 2: Invocable directly on the object +- struct Case2 : std::conjunction< ++ struct Case2 : TypeList::conjunction< + Compatible, std::negation, + std::is_invocable + > {