git: 59e9d5118dc6 - main - emulators/rpcs3: unbreak build with libc++ 19

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Wed, 30 Oct 2024 18:05:03 UTC
The branch main has been updated by jbeich:

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

commit 59e9d5118dc65497327518f97f252569c034f800
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-10-28 10:45:23 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-10-30 18:03:38 +0000

    emulators/rpcs3: unbreak build with libc++ 19
    
    In file included from rpcs3/Emu/cache_utils.cpp:1:
    In file included from rpcs3/stdafx.h:3:
    In file included from rpcs3/util/types.hpp:8:
    In file included from /usr/include/c++/v1/chrono:969:
    In file included from /usr/include/c++/v1/__chrono/formatter.h:25:
    In file included from /usr/include/c++/v1/__chrono/ostream.h:33:
    In file included from /usr/include/c++/v1/__format/format_functions.h:19:
    In file included from /usr/include/c++/v1/__format/format_arg_store.h:25:
    /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned int>'
      static_assert(is_same<_CharT, typename traits_type::char_type>::value,
                                             ^
    rpcs3/Emu/Cell/PPUAnalyser.h:184:25: note: in instantiation of template class 'std::basic_string<unsigned int>' requested here
            std::basic_string<u32> applied_patches;
                                   ^
    /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
    struct _LIBCPP_TEMPLATE_VIS char_traits;
                                ^
    
    Reported by:    pkg-fallout
---
 emulators/rpcs3/Makefile | 17 +++++++++++++++++
 emulators/rpcs3/distinfo |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/emulators/rpcs3/Makefile b/emulators/rpcs3/Makefile
index 952ed67842b7..70eabfc5093f 100644
--- a/emulators/rpcs3/Makefile
+++ b/emulators/rpcs3/Makefile
@@ -97,4 +97,21 @@ post-patch:
 		-e '/GIT_VERSION/s/local_build/${GH_TAGNAME:C/[^-]*-//}/' \
 		${WRKSRC}/${PORTNAME}/git-version.cmake
 
+# https://github.com/RPCS3/rpcs3/issues/16259 (don't forget distinfo)
+.if exists(/usr/include/c++/v1/__thread/support.h)
+# XXX Move into separate port and standardize via USES
+GH_TUPLE+=	llvm:llvm-project:llvmorg-18.1.8:libcxx
+CXXFLAGS+=	-nostdinc++ -isystem${WRKDIR}/libcxx_prefix/include/c++/v1
+# Don't link against new libc++ as it's not necessary
+#LDFLAGS+=	-nostdlib++ -L${WRKDIR}/libcxx_prefix/lib -l:libc++.a -lcxxrt
+
+pre-configure:	bundled-libcxx
+bundled-libcxx:
+	@${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} \
+		-DLIBCXX_INCLUDE_BENCHMARKS:BOOL=OFF \
+		-DCMAKE_INSTALL_PREFIX:PATH=${WRKDIR}/libcxx_prefix \
+		-B ${WRKDIR}/libcxx_build -S ${WRKSRC_libcxx}/libcxx
+	@${DO_MAKE_BUILD:NDESTDIR*} install -C ${WRKDIR}/libcxx_build
+.endif # exists(/usr/include/c++/v1/__thread/support.h)
+
 .include <bsd.port.mk>
diff --git a/emulators/rpcs3/distinfo b/emulators/rpcs3/distinfo
index a0c9de72f4bd..cdf31e3819e9 100644
--- a/emulators/rpcs3/distinfo
+++ b/emulators/rpcs3/distinfo
@@ -29,3 +29,5 @@ SHA256 (wolfSSL-wolfssl-v5.7.2-stable_GH0.tar.gz) = 0f2ed82e345b833242705bbc4b08
 SIZE (wolfSSL-wolfssl-v5.7.2-stable_GH0.tar.gz) = 23591507
 SHA256 (thestk-rtmidi-6.0.0_GH0.tar.gz) = ef7bcda27fee6936b651c29ebe9544c74959d0b1583b716ce80a1c6fea7617f0
 SIZE (thestk-rtmidi-6.0.0_GH0.tar.gz) = 515502
+SHA256 (llvm-llvm-project-llvmorg-18.1.8_GH0.tar.gz) = 09c08693a9afd6236f27a2ebae62cda656eba19021ef3f94d59e931d662d4856
+SIZE (llvm-llvm-project-llvmorg-18.1.8_GH0.tar.gz) = 205562783