From 2573d98c7ed462ca38563dd52168860f45cf27de Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sun, 11 Mar 2018 19:07:09 +1100 Subject: [PATCH] sdl_mixer: consolidate patches and don't touch configure.in --- src/sdl_mixer-1-fix-double-free.patch | 34 -------- src/sdl_mixer-1-fixes.patch | 84 +++++++++++++++++++ ...sdl_mixer-2-fix-static-ogg-detection.patch | 55 ------------ 3 files changed, 84 insertions(+), 89 deletions(-) delete mode 100644 src/sdl_mixer-1-fix-double-free.patch create mode 100644 src/sdl_mixer-1-fixes.patch delete mode 100644 src/sdl_mixer-2-fix-static-ogg-detection.patch diff --git a/src/sdl_mixer-1-fix-double-free.patch b/src/sdl_mixer-1-fix-double-free.patch deleted file mode 100644 index 4ee3a50d..00000000 --- a/src/sdl_mixer-1-fix-double-free.patch +++ /dev/null @@ -1,34 +0,0 @@ -This file is part of MXE. See LICENSE.md for licensing information. - -https://bugs.gentoo.org/show_bug.cgi?id=406739 -Nikos Chantziaras 2012-03-03 03:13:39 EST - -There's a bug in the current version of SDL_mixer where failing to load a WAV sample will result in freeing a resource twice, resulting in an application crash. There is an upstream fix for this: - -http://hg.libsdl.org/SDL_mixer/rev/ea53a85853dd - -Upstream bug: http://bugzilla.libsdl.org/show_bug.cgi?id=1418 - ---- a/mixer.c -+++ b/mixer.c -@@ -610,13 +610,15 @@ - break; - default: - SDL_SetError("Unrecognized sound file type"); -- return(0); -+ if ( freesrc ) { -+ SDL_RWclose(src); -+ } -+ loaded = NULL; -+ break; - } - if ( !loaded ) { -+ /* The individual loaders have closed src if needed */ - SDL_free(chunk); -- if ( freesrc ) { -- SDL_RWclose(src); -- } - return(NULL); - } - - diff --git a/src/sdl_mixer-1-fixes.patch b/src/sdl_mixer-1-fixes.patch new file mode 100644 index 00000000..bdf21ad2 --- /dev/null +++ b/src/sdl_mixer-1-fixes.patch @@ -0,0 +1,84 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony Theodore +Date: Sun, 11 Mar 2018 18:57:48 +1100 +Subject: [PATCH 1/2] fix double free + +https://bugs.gentoo.org/show_bug.cgi?id=406739 +Nikos Chantziaras 2012-03-03 03:13:39 EST + +There's a bug in the current version of SDL_mixer where failing to load +a WAV sample will result in freeing a resource twice, resulting in an +application crash. There is an upstream fix for this: + +http://hg.libsdl.org/SDL_mixer/rev/ea53a85853dd + +Upstream bug: http://bugzilla.libsdl.org/show_bug.cgi?id=1418 + +diff --git a/mixer.c b/mixer.c +index 1111111..2222222 100644 +--- a/mixer.c ++++ b/mixer.c +@@ -610,13 +610,15 @@ Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc) + break; + default: + SDL_SetError("Unrecognized sound file type"); +- return(0); ++ if ( freesrc ) { ++ SDL_RWclose(src); ++ } ++ loaded = NULL; ++ break; + } + if ( !loaded ) { ++ /* The individual loaders have closed src if needed */ + SDL_free(chunk); +- if ( freesrc ) { +- SDL_RWclose(src); +- } + return(NULL); + } + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony Theodore +Date: Sun, 11 Mar 2018 19:00:16 +1100 +Subject: [PATCH 2/2] fix ogg linking + +This patch has been taken from: https://hg.libsdl.org/SDL_mixer/rev/0aadc9b6daac + +Gabriel Jacobo 2012-09-20 16:01:32 PDT + +When --disable-music-ogg-shared the OGG tests fail when they should pass. +Attached is a crude patch that gets them working (though the changes done to +configure.in, inside AC_CHECK_LIB, will produce ugly status string such as +"checking for ov_open_callbacks in -lvorbisidec -logg", which is mostly a +aesthetic concern) + +Upstream bug: https://bugzilla.libsdl.org/show_bug.cgi?id=1604 + +diff --git a/configure b/configure +index 1111111..2222222 100755 +--- a/configure ++++ b/configure +@@ -13345,7 +13345,7 @@ if test "${ac_cv_lib_vorbisidec_ov_open_callbacks+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lvorbisidec $LIBS" ++LIBS="-lvorbisidec -logg $LIBS" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF +@@ -13576,7 +13576,7 @@ if test "${ac_cv_lib_vorbisfile_ov_open_callbacks+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lvorbisfile $LIBS" ++LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF diff --git a/src/sdl_mixer-2-fix-static-ogg-detection.patch b/src/sdl_mixer-2-fix-static-ogg-detection.patch deleted file mode 100644 index c262c276..00000000 --- a/src/sdl_mixer-2-fix-static-ogg-detection.patch +++ /dev/null @@ -1,55 +0,0 @@ -This file is part of MXE. See LICENSE.md for licensing information. - -This patch has been taken from: https://hg.libsdl.org/SDL_mixer/rev/0aadc9b6daac - -Gabriel Jacobo 2012-09-20 16:01:32 PDT - -When --disable-music-ogg-shared the OGG tests fail when they should pass. -Attached is a crude patch that gets them working (though the changes done to -configure.in, inside AC_CHECK_LIB, will produce ugly status string such as -"checking for ov_open_callbacks in -lvorbisidec -logg", which is mostly a -aesthetic concern) - -Upstream bug: https://bugzilla.libsdl.org/show_bug.cgi?id=1604 - ---- a/configure -+++ b/configure -@@ -13339,7 +13339,7 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lvorbisidec $LIBS" -+LIBS="-lvorbisidec -logg $LIBS" - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF -@@ -13570,7 +13570,7 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lvorbisfile $LIBS" -+LIBS="-lvorbisfile -lvorbis -logg -lm $LIBS" - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF - ---- a/configure.in -+++ b/configure.in -@@ -429,7 +429,7 @@ - if test x$enable_music_ogg = xyes; then - if test x$enable_music_ogg_tremor = xyes; then - AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes]) -- AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes]) -+ AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes], [-logg]) - if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then - case "$host" in - *-*-darwin*) -@@ -465,7 +465,7 @@ - fi - else - AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes]) -- AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes]) -+ AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes], [-lvorbis -logg -lm]) - if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then - case "$host" in - *-*-darwin*)