From 9649011e5f901f75de43d1f34ae941c7a5646693 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Fri, 31 Mar 2023 17:50:18 +0200 Subject: [PATCH] mgba: workaround crash on r1beta4 --- games-emulation/mgba/mgba-0.9.3.recipe | 17 +++++---- .../mgba/patches/mgba-0.9.3.patchset | 35 +++++++++++++++++++ 2 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 games-emulation/mgba/patches/mgba-0.9.3.patchset diff --git a/games-emulation/mgba/mgba-0.9.3.recipe b/games-emulation/mgba/mgba-0.9.3.recipe index cc41ac3d3..6ad27a187 100644 --- a/games-emulation/mgba/mgba-0.9.3.recipe +++ b/games-emulation/mgba/mgba-0.9.3.recipe @@ -12,10 +12,11 @@ and a modern feature set for emulators that older emulators may not support." HOMEPAGE="https://mgba.io/" COPYRIGHT="2013-2021 Jeffrey Pfau" LICENSE="MPL v2.0" -REVISION="1" +REVISION="2" SOURCE_URI="https://github.com/mgba-emu/mgba/archive/$portVersion.tar.gz" CHECKSUM_SHA256="692ff0ac50e18380df0ff3ee83071f9926715200d0dceedd9d16a028a59537a0" ADDITIONAL_FILES="mgba.rdef.in" +PATCHES="mgba-$portVersion.patchset" ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" @@ -41,12 +42,9 @@ REQUIRES=" lib:libQt5Multimedia$secondaryArchSuffix lib:libQt5Network$secondaryArchSuffix lib:libQt5Widgets$secondaryArchSuffix -# If you have come here to upgrade mGBA to use SDL2, know this: -# Haiku's SDL2 port is (at time of writing) TOTALLY INCOMPATIBLE with -# Qt and cannot be run in the same binary as it, as both create -# BApplication objects independent of the other. -# SDL1.2 checks if one already exists first, so it's OK. lib:libSDL_1.2$secondaryArchSuffix +# sound stuttering with SDL2 +# lib:libSDL2_2.0$secondaryArchSuffix lib:libsqlite3$secondaryArchSuffix lib:libswscale$secondaryArchSuffix lib:libz$secondaryArchSuffix @@ -69,6 +67,7 @@ BUILD_REQUIRES=" devel:libQt5Network$secondaryArchSuffix devel:libQt5Widgets$secondaryArchSuffix devel:libSDL_1.2$secondaryArchSuffix +# devel:libSDL2_2.0$secondaryArchSuffix devel:libsqlite3$secondaryArchSuffix devel:libswscale$secondaryArchSuffix devel:libz$secondaryArchSuffix @@ -85,19 +84,19 @@ BUILD_PREREQUIRES=" BUILD() { - cmake . $cmakeDirArgs \ + cmake -Bbuild $cmakeDirArgs \ -DCMAKE_BUILD_TYPE=Release \ -GNinja \ -DBUILD_GL=OFF \ -DBUILD_GLES2=OFF \ -DBUILD_GLES3=OFF \ -DUSE_DISCORD_RPC=OFF - ninja $jobArgs + ninja -C build $jobArgs } INSTALL() { - ninja install + ninja -C build install local APP_SIGNATURE="application/x-vnd.qt5-mgba" local MAJOR="`echo "$portVersion" | cut -d. -f1`" diff --git a/games-emulation/mgba/patches/mgba-0.9.3.patchset b/games-emulation/mgba/patches/mgba-0.9.3.patchset new file mode 100644 index 000000000..b846c2c85 --- /dev/null +++ b/games-emulation/mgba/patches/mgba-0.9.3.patchset @@ -0,0 +1,35 @@ +From c540a757aa411ad99fa28c84878d673eb586fceb Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 29 Mar 2023 20:55:37 +0200 +Subject: Haiku: disable locale support to workaround a crash in uselocale + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5413367..65f8f9c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -400,7 +400,7 @@ if(HAVE_LOCALTIME_R) + list(APPEND FUNCTION_DEFINES HAVE_LOCALTIME_R) + endif() + +-if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE) ++if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE AND NOT HAIKU) + list(APPEND FUNCTION_DEFINES HAVE_LOCALE) + if (HAVE_SNPRINTF_L) + list(APPEND FUNCTION_DEFINES HAVE_SNPRINTF_L) +diff --git a/include/mgba-util/formatting.h b/include/mgba-util/formatting.h +index 6eb01ff..1e70836 100644 +--- a/include/mgba-util/formatting.h ++++ b/include/mgba-util/formatting.h +@@ -15,7 +15,7 @@ CXX_GUARD_START + #ifdef HAVE_XLOCALE + #include + #elif !defined(HAVE_LOCALE) +-typedef const char* locale_t; ++typedef void* locale_t; + #endif + + int ftostr_l(char* restrict str, size_t size, float f, locale_t locale); +-- +2.37.3 +