From a7a6e2a80a90dee272e8ed4a8a499dca15be2430 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 15 May 2024 12:55:08 -0700
Subject: [PATCH] Updated for SDL3 version changes
---
.wikiheaders-options | 2 +-
.../cmake/sdl3_mixer-config-version.cmake | 8 ++--
.../CMake/sdl3_mixer-config-version.cmake | 8 ++--
build-scripts/android-prefab.sh | 4 +-
build-scripts/test-versioning.sh | 2 +-
build-scripts/wikiheaders.pl | 12 ++---
external/SDL | 2 +-
include/SDL3_mixer/SDL_mixer.h | 46 +++----------------
release_checklist.md | 2 +-
src/mixer.c | 26 ++++-------
10 files changed, 36 insertions(+), 76 deletions(-)
diff --git a/.wikiheaders-options b/.wikiheaders-options
index f6bddf51..0d6d67bc 100644
--- a/.wikiheaders-options
+++ b/.wikiheaders-options
@@ -7,7 +7,7 @@ mainincludefname = SDL3_mixer/SDL_mixer.h
versionfname = include/SDL3_mixer/SDL_mixer.h
versionmajorregex = \A\#define\s+SDL_MIXER_MAJOR_VERSION\s+(\d+)\Z
versionminorregex = \A\#define\s+SDL_MIXER_MINOR_VERSION\s+(\d+)\Z
-versionpatchregex = \A\#define\s+SDL_MIXER_PATCHLEVEL\s+(\d+)\Z
+versionmicroregex = \A\#define\s+SDL_MIXER_MICRO_VERSION\s+(\d+)\Z
selectheaderregex = \ASDL_mixer\.h\Z
projecturl = https://libsdl.org/projects/SDL_mixer
wikiurl = https://wiki.libsdl.org/SDL_mixer
diff --git a/VisualC/pkg-support/cmake/sdl3_mixer-config-version.cmake b/VisualC/pkg-support/cmake/sdl3_mixer-config-version.cmake
index 16e61347..d6eefff6 100644
--- a/VisualC/pkg-support/cmake/sdl3_mixer-config-version.cmake
+++ b/VisualC/pkg-support/cmake/sdl3_mixer-config-version.cmake
@@ -13,10 +13,10 @@ string(REGEX MATCH "#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_maj
set(_sdl_major "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_mixer_h}")
set(_sdl_minor "${CMAKE_MATCH_1}")
-string(REGEX MATCH "#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)" _sdl_patch_re "${_sdl_mixer_h}")
-set(_sdl_patch "${CMAKE_MATCH_1}")
-if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re)
- set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}")
+string(REGEX MATCH "#define[ \t]+SDL_MIXER_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_mixer_h}")
+set(_sdl_micro "${CMAKE_MATCH_1}")
+if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
+ set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
else()
message(AUTHOR_WARNING "Could not extract version from SDL_mixer.h.")
return()
diff --git a/Xcode/pkg-support/resources/CMake/sdl3_mixer-config-version.cmake b/Xcode/pkg-support/resources/CMake/sdl3_mixer-config-version.cmake
index 753cbfe5..12a3c1ba 100644
--- a/Xcode/pkg-support/resources/CMake/sdl3_mixer-config-version.cmake
+++ b/Xcode/pkg-support/resources/CMake/sdl3_mixer-config-version.cmake
@@ -13,10 +13,10 @@ string(REGEX MATCH "#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_maj
set(_sdl_major "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_mixer_h}")
set(_sdl_minor "${CMAKE_MATCH_1}")
-string(REGEX MATCH "#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)" _sdl_patch_re "${_sdl_mixer_h}")
-set(_sdl_patch "${CMAKE_MATCH_1}")
-if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re)
- set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}")
+string(REGEX MATCH "#define[ \t]+SDL_MIXER_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_mixer_h}")
+set(_sdl_micro "${CMAKE_MATCH_1}")
+if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
+ set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
else()
message(AUTHOR_WARNING "Could not extract version from SDL_mixer.h.")
return()
diff --git a/build-scripts/android-prefab.sh b/build-scripts/android-prefab.sh
index df280686..626fac9c 100755
--- a/build-scripts/android-prefab.sh
+++ b/build-scripts/android-prefab.sh
@@ -44,8 +44,8 @@ android_stl="c++_shared"
sdlmixer_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
sdlmixer_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
-sdlmixer_patch=$(sed -ne 's/^#define SDL_MIXER_PATCHLEVEL *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
-sdlmixer_version="${sdlmixer_major}.${sdlmixer_minor}.${sdlmixer_patch}"
+sdlmixer_micro=$(sed -ne 's/^#define SDL_MIXER_MICRO_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
+sdlmixer_version="${sdlmixer_major}.${sdlmixer_minor}.${sdlmixer_micro}"
echo "Building Android prefab package for SDL_mixer version $sdlmixer_version"
if test ! -d "${sdl_build_root}"; then
diff --git a/build-scripts/test-versioning.sh b/build-scripts/test-versioning.sh
index fc35268d..89e29891 100755
--- a/build-scripts/test-versioning.sh
+++ b/build-scripts/test-versioning.sh
@@ -12,7 +12,7 @@ export LC_CTYPE=C
header=include/SDL3_mixer/SDL_mixer.h
ref_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' $header)
ref_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' $header)
-ref_micro=$(sed -ne 's/^#define SDL_MIXER_PATCHLEVEL *//p' $header)
+ref_micro=$(sed -ne 's/^#define SDL_MIXER_MICRO_VERSION *//p' $header)
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
tests=0
diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 185701b4..050dd3cb 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -16,7 +16,7 @@
my $versionfname = 'include/SDL_version.h';
my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z';
my $versionminorregex = '\A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z';
-my $versionpatchregex = '\A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z';
+my $versionmicroregex = '\A\#define\s+SDL_MICRO_VERSION\s+(\d+)\Z';
my $mainincludefname = 'SDL.h';
my $selectheaderregex = '\ASDL.*?\.h\Z';
my $projecturl = 'https://libsdl.org/';
@@ -92,7 +92,7 @@
$readmesubdir = $val, next if $key eq 'readmesubdir';
$versionmajorregex = $val, next if $key eq 'versionmajorregex';
$versionminorregex = $val, next if $key eq 'versionminorregex';
- $versionpatchregex = $val, next if $key eq 'versionpatchregex';
+ $versionmicroregex = $val, next if $key eq 'versionmicroregex';
$versionfname = $val, next if $key eq 'versionfname';
$mainincludefname = $val, next if $key eq 'mainincludefname';
$selectheaderregex = $val, next if $key eq 'selectheaderregex';
@@ -2036,19 +2036,19 @@ sub print_undocumented_section {
open(FH, '<', "$srcpath/$versionfname") or die("Can't open '$srcpath/$versionfname': $!\n");
my $majorver = 0;
my $minorver = 0;
- my $patchver = 0;
+ my $microver = 0;
while (<FH>) {
chomp;
if (/$versionmajorregex/) {
$majorver = int($1);
} elsif (/$versionminorregex/) {
$minorver = int($1);
- } elsif (/$versionpatchregex/) {
- $patchver = int($1);
+ } elsif (/$versionmicroregex/) {
+ $microver = int($1);
}
}
close(FH);
- my $fullversion = "$majorver.$minorver.$patchver";
+ my $fullversion = "$majorver.$minorver.$microver";
foreach (keys %headersyms) {
my $sym = $_;
diff --git a/external/SDL b/external/SDL
index 97d0e788..4b3b5fb5 160000
--- a/external/SDL
+++ b/external/SDL
@@ -1 +1 @@
-Subproject commit 97d0e78842ba362fa0666c7bc65630dcbf52fa4d
+Subproject commit 4b3b5fb56c3aab094e431d3620d6cc36200430b8
diff --git a/include/SDL3_mixer/SDL_mixer.h b/include/SDL3_mixer/SDL_mixer.h
index 3be0ceec..90acfa0d 100644
--- a/include/SDL3_mixer/SDL_mixer.h
+++ b/include/SDL3_mixer/SDL_mixer.h
@@ -38,43 +38,17 @@ extern "C" {
#endif
/**
- * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
+ * Printable format: "%d.%d.%d", MAJOR, MINOR, MICRO
*/
#define SDL_MIXER_MAJOR_VERSION 3
#define SDL_MIXER_MINOR_VERSION 0
-#define SDL_MIXER_PATCHLEVEL 0
-
-/**
- * This macro can be used to fill a version structure with the compile-time
- * version of the SDL_mixer library.
- */
-#define SDL_MIXER_VERSION(X) \
-{ \
- (X)->major = SDL_MIXER_MAJOR_VERSION; \
- (X)->minor = SDL_MIXER_MINOR_VERSION; \
- (X)->patch = SDL_MIXER_PATCHLEVEL; \
-}
-
-/* Backwards compatibility */
-#define MIX_MAJOR_VERSION SDL_MIXER_MAJOR_VERSION
-#define MIX_MINOR_VERSION SDL_MIXER_MINOR_VERSION
-#define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL
-#define MIX_VERSION(X) SDL_MIXER_VERSION(X)
-
-#if SDL_MIXER_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3
+#define SDL_MIXER_MICRO_VERSION 0
/**
* This is the version number macro for the current SDL_mixer version.
- *
- * In versions higher than 2.9.0, the minor version overflows into the
- * thousands digit: for example, 2.23.0 is encoded as 4300. This macro will
- * not be available in SDL 3.x or SDL_mixer 3.x.
- *
- * Deprecated, use SDL_MIXER_VERSION_ATLEAST or SDL_MIXER_VERSION instead.
*/
-#define SDL_MIXER_COMPILEDVERSION \
- SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL)
-#endif /* SDL_MIXER_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3 */
+#define SDL_MIXER_VERSION \
+ SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)
/**
* This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z.
@@ -82,22 +56,16 @@ extern "C" {
#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
((SDL_MIXER_MAJOR_VERSION >= X) && \
(SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION >= Y) && \
- (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION > Y || SDL_MIXER_PATCHLEVEL >= Z))
+ (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION > Y || SDL_MIXER_MICRO_VERSION >= Z))
/**
- * Query the version of SDL_mixer that the program is linked against.
- *
* This function gets the version of the dynamically linked SDL_mixer library.
- * This is separate from the SDL_MIXER_VERSION() macro, which tells you what
- * version of the SDL_mixer headers you compiled against.
- *
- * This returns static internal data; do not free or modify it!
*
- * \returns a pointer to the version information.
+ * \returns SDL_mixer version
*
* \since This function is available since SDL_mixer 3.0.0.
*/
-extern DECLSPEC const SDL_Version * SDLCALL Mix_Linked_Version(void);
+extern DECLSPEC int SDLCALL Mix_Version(void);
/**
* Initialization flags
diff --git a/release_checklist.md b/release_checklist.md
index b4a0dd96..3fe5e3c5 100644
--- a/release_checklist.md
+++ b/release_checklist.md
@@ -7,7 +7,7 @@
* Bump version number to 3.EVEN.0 in all these locations:
* `include/SDL3_mixer/SDL_mixer.h`:
- `SDL_MIXER_MAJOR_VERSION`, `SDL_MIXER_MINOR_VERSION`, `SDL_MIXER_PATCHLEVEL`
+ `SDL_MIXER_MAJOR_VERSION`, `SDL_MIXER_MINOR_VERSION`, `SDL_MIXER_MICRO_VERSION`
* `CMakeLists.txt`:
`MAJOR_VERSION`, `MINOR_VERSION`, `MICRO_VERSION`
* `version.rc`:
diff --git a/src/mixer.c b/src/mixer.c
index a1cd8a9d..e7a02639 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -37,28 +37,22 @@
#define FORM 0x4d524f46 /* "FORM" */
#define CREA 0x61657243 /* "Crea" */
-#if defined(SDL_BUILD_MAJOR_VERSION) && defined(SDL_COMPILE_TIME_ASSERT)
+#if defined(SDL_BUILD_MAJOR_VERSION)
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION,
SDL_MIXER_MAJOR_VERSION == SDL_BUILD_MAJOR_VERSION);
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MINOR_VERSION,
SDL_MIXER_MINOR_VERSION == SDL_BUILD_MINOR_VERSION);
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION,
- SDL_MIXER_PATCHLEVEL == SDL_BUILD_MICRO_VERSION);
+ SDL_MIXER_MICRO_VERSION == SDL_BUILD_MICRO_VERSION);
#endif
-#if defined(SDL_COMPILE_TIME_ASSERT)
+/* Limited by its encoding in SDL_VERSIONNUM */
SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MAJOR_VERSION_min, SDL_MIXER_MAJOR_VERSION >= 0);
-/* Limited only by the need to fit in SDL_Version */
-SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MAJOR_VERSION_max, SDL_MIXER_MAJOR_VERSION <= 255);
-
+SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MAJOR_VERSION_max, SDL_MIXER_MAJOR_VERSION <= 10);
SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MINOR_VERSION_min, SDL_MIXER_MINOR_VERSION >= 0);
-/* Limited only by the need to fit in SDL_Version */
-SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MINOR_VERSION_max, SDL_MIXER_MINOR_VERSION <= 255);
-
-SDL_COMPILE_TIME_ASSERT(SDL_MIXER_PATCHLEVEL_min, SDL_MIXER_PATCHLEVEL >= 0);
-/* Limited by its encoding in SDL_VERSIONNUM and in the ABI versions */
-SDL_COMPILE_TIME_ASSERT(SDL_MIXER_PATCHLEVEL_max, SDL_MIXER_PATCHLEVEL <= 99);
-#endif
+SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MINOR_VERSION_max, SDL_MIXER_MINOR_VERSION <= 999);
+SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MICRO_VERSION_min, SDL_MIXER_MICRO_VERSION >= 0);
+SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MICRO_VERSION_max, SDL_MIXER_MICRO_VERSION <= 999);
static int audio_opened = 0;
static SDL_AudioSpec mixer;
@@ -162,11 +156,9 @@ void add_chunk_decoder(const char *decoder)
}
/* rcg06192001 get linked library's version. */
-const SDL_Version *Mix_Linked_Version(void)
+int Mix_Version(void)
{
- static SDL_Version linked_version;
- SDL_MIXER_VERSION(&linked_version);
- return &linked_version;
+ return SDL_MIXER_VERSION;
}
/*