From 7583cfe9b7628a912b3b19c88ff518bb75f700ad Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 10 Jun 2020 20:58:31 +0200
Subject: [PATCH] {android,win32}/build.py: enable the GME decoder plugin

Closes https://github.com/MusicPlayerDaemon/MPD/issues/891
---
 NEWS                 |  4 ++--
 android/build.py     |  1 +
 python/build/libs.py | 12 ++++++++++++
 win32/build.py       |  1 +
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index c6924f5aa..bda78362f 100644
--- a/NEWS
+++ b/NEWS
@@ -10,10 +10,10 @@ ver 0.21.24 (not yet released)
 * player
   - don't restart current song if seeking beyond end
 * Android
-  - enable the decoder plugins ModPlug and WildMidi
+  - enable the decoder plugins GME, ModPlug and WildMidi
   - fix build failure with Android NDK r21
 * Windows
-  - enable the decoder plugins ModPlug and WildMidi
+  - enable the decoder plugins GME, ModPlug and WildMidi
   - work around Meson bug breaking the Windows build with GCC 10
 * fix unit test failure
 
diff --git a/android/build.py b/android/build.py
index 8716fc1a9..5bee46304 100755
--- a/android/build.py
+++ b/android/build.py
@@ -170,6 +170,7 @@ thirdparty_libs = [
     libid3tag,
     libmodplug,
     wildmidi,
+    gme,
     ffmpeg,
     curl,
     libexpat,
diff --git a/python/build/libs.py b/python/build/libs.py
index c7b2250cd..e211a0107 100644
--- a/python/build/libs.py
+++ b/python/build/libs.py
@@ -135,6 +135,18 @@ wildmidi = CmakeProject(
     version='0.4.3',
 )
 
+gme = CmakeProject(
+    'https://bitbucket.org/mpyne/game-music-emu/downloads/game-music-emu-0.6.3.tar.xz',
+    'aba34e53ef0ec6a34b58b84e28bf8cfbccee6585cebca25333604c35db3e051d',
+    'lib/libgme.a',
+    [
+        '-DBUILD_SHARED_LIBS=OFF',
+        '-DENABLE_UBSAN=OFF',
+        '-DZLIB_INCLUDE_DIR=OFF',
+        '-DSDL2_DIR=OFF',
+    ],
+)
+
 ffmpeg = FfmpegProject(
     'http://ffmpeg.org/releases/ffmpeg-4.2.3.tar.xz',
     '9df6c90aed1337634c1fb026fb01c154c29c82a64ea71291ff2da9aacb9aad31',
diff --git a/win32/build.py b/win32/build.py
index 9e1b6e9e4..fb636ded5 100755
--- a/win32/build.py
+++ b/win32/build.py
@@ -98,6 +98,7 @@ thirdparty_libs = [
     liblame,
     libmodplug,
     wildmidi,
+    gme,
     ffmpeg,
     curl,
     libexpat,