commit:     8136abfbeda3d5b792d2b8a388c466a1da4f7ad0
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  1 03:03:56 2020 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sat Feb  1 03:11:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8136abfb

games-emulation/mgba: Fixed build with USE="qt -sdl"

Thanks-to: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
Closes: https://bugs.gentoo.org/707578
Package-Manager: Portage-2.3.86, Repoman-2.3.20
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 games-emulation/mgba/files/mgba-0.8.0-no_sdl.patch | 50 ++++++++++++++++++++++
 games-emulation/mgba/mgba-0.8.0.ebuild             |  4 ++
 2 files changed, 54 insertions(+)

diff --git a/games-emulation/mgba/files/mgba-0.8.0-no_sdl.patch 
b/games-emulation/mgba/files/mgba-0.8.0-no_sdl.patch
new file mode 100644
index 00000000000..d89828976cd
--- /dev/null
+++ b/games-emulation/mgba/files/mgba-0.8.0-no_sdl.patch
@@ -0,0 +1,50 @@
+From aa3403401bfb7259795313603929586bee91ce1b Mon Sep 17 00:00:00 2001
+From: Vicki Pfau <v...@endrift.com>
+Date: Fri, 31 Jan 2020 18:09:58 -0800
+Subject: [PATCH] Qt: Fix non-SDL build (fixes #1656)
+
+---
+ CHANGES                             |  3 +++
+ src/platform/qt/InputController.cpp | 12 ++++++++++++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/CHANGES b/CHANGES
+index 7aac48d6..6418b059 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -1,3 +1,6 @@
++Misc:
++ - Qt: Fix non-SDL build (fixes mgba.io/i/1656)
++
+ 0.8.0: (2020-01-21)
+ Features:
+  - Improved logging configuration
+diff --git a/src/platform/qt/InputController.cpp 
b/src/platform/qt/InputController.cpp
+index 77ee0704..c6a598ce 100644
+--- a/src/platform/qt/InputController.cpp
++++ b/src/platform/qt/InputController.cpp
+@@ -271,9 +271,21 @@ void InputController::setPreferredGamepad(uint32_t type, 
int index) {
+       if (!m_config) {
+               return;
+       }
++#ifdef BUILD_SDL
+       char name[34] = {0};
++#if SDL_VERSION_ATLEAST(2, 0, 0)
+       
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_JoystickListGetPointer(&s_sdlEvents.joysticks,
 index)->joystick), name, sizeof(name));
++#else
++      const char* name = 
SDL_JoystickName(SDL_JoystickIndex(SDL_JoystickListGetPointer(&s_sdlEvents.joysticks,
 index)->joystick));
++      if (!name) {
++              return;
++      }
++#endif
+       mInputSetPreferredDevice(m_config->input(), "gba", type, m_playerId, 
name);
++#else
++      UNUSED(type);
++      UNUSED(index);
++#endif
+ }
+ 
+ mRumble* InputController::rumble() {
+-- 
+2.25.0
+

diff --git a/games-emulation/mgba/mgba-0.8.0.ebuild 
b/games-emulation/mgba/mgba-0.8.0.ebuild
index 3543aa68ebf..cc49129ae05 100644
--- a/games-emulation/mgba/mgba-0.8.0.ebuild
+++ b/games-emulation/mgba/mgba-0.8.0.ebuild
@@ -44,6 +44,10 @@ RDEPEND="
 "
 DEPEND="${RDEPEND}"
 
+PATCHES=(
+       "${FILESDIR}/${P}-no_sdl.patch" #707578
+)
+
 src_prepare() {
        xdg_environment_reset
        cmake_src_prepare

Reply via email to