From 900492070e9d7370aceea0a8e02153b209cf49d4 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 5 Sep 2022 12:01:05 -0700
Subject: [PATCH] Fixed handling of DYLIB_COMPATIBILITY_VERSION
Also make sure we test the version in configure
---
CMakeLists.txt | 3 ---
Xcode/SDL_mixer.xcodeproj/project.pbxproj | 4 +--
cmake/PrivateSdlFunctions.cmake | 1 +
release_checklist.md | 19 +++++++-------
test-versioning.sh | 31 ++++++++++++++++++++---
5 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 810e1856..aedda280 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,9 +8,6 @@ set(MINOR_VERSION 7)
set(MICRO_VERSION 0)
set(SDL_REQUIRED_VERSION 2.0.9)
-# For historical reasons this is 3.0.0 rather than the expected 1.0.0
-set(DYLIB_COMPATIBILITY_VERSION "3.0.0")
-
include(PrivateSdlFunctions)
sdl_calculate_derived_version_variables()
diff --git a/Xcode/SDL_mixer.xcodeproj/project.pbxproj b/Xcode/SDL_mixer.xcodeproj/project.pbxproj
index 4ff99293..0d6de2fb 100644
--- a/Xcode/SDL_mixer.xcodeproj/project.pbxproj
+++ b/Xcode/SDL_mixer.xcodeproj/project.pbxproj
@@ -764,7 +764,7 @@
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEPLOYMENT_POSTPROCESSING = YES;
- DYLIB_COMPATIBILITY_VERSION = 3.0.0;
+ DYLIB_COMPATIBILITY_VERSION = 701.0.0;
DYLIB_CURRENT_VERSION = 701.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/$(PLATFORM)\"";
@@ -813,7 +813,7 @@
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- DYLIB_COMPATIBILITY_VERSION = 3.0.0;
+ DYLIB_COMPATIBILITY_VERSION = 701.0.0;
DYLIB_CURRENT_VERSION = 701.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_TESTABILITY = YES;
diff --git a/cmake/PrivateSdlFunctions.cmake b/cmake/PrivateSdlFunctions.cmake
index cf087f79..ee8418ad 100644
--- a/cmake/PrivateSdlFunctions.cmake
+++ b/cmake/PrivateSdlFunctions.cmake
@@ -41,6 +41,7 @@ macro(sdl_calculate_derived_version_variables)
math(EXPR DYLIB_CURRENT_VERSION_MINOR "${LT_REVISION}")
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "${LT_MAJOR} + 1")
set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.0")
+ set(DYLIB_COMPATIBILITY_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.0.0")
endmacro()
macro(sdl_find_sdl2 TARGET VERSION)
diff --git a/release_checklist.md b/release_checklist.md
index cfbc2b69..7e0af65c 100644
--- a/release_checklist.md
+++ b/release_checklist.md
@@ -28,13 +28,12 @@
* set first number in `DYLIB_CURRENT_VERSION` to
(100 * *minor*) + 1
* set second number in `DYLIB_CURRENT_VERSION` to 0
- * if backwards compatibility has been broken,
- increase `DYLIB_COMPATIBILITY_VERSION` (?)
-
-* Run `./test-versioning.sh` to verify that everything is consistent
+ * set `DYLIB_COMPATIBILITY_VERSION` to the same value
* Regenerate `configure`
+* Run `./test-versioning.sh` to verify that everything is consistent
+
* Do the release
## New bugfix release
@@ -52,11 +51,12 @@
* `Xcode/SDL_mixer.xcodeproj/project.pbxproj`:
`DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION`
* set second number in `DYLIB_CURRENT_VERSION` to *patchlevel*
-
-* Run test/versioning.sh to verify that everything is consistent
+ * Leave `DYLIB_COMPATIBILITY_VERSION` unchanged
* Regenerate `configure`
+* Run test/versioning.sh to verify that everything is consistent
+
* Do the release
## After a feature release
@@ -89,11 +89,10 @@
* set first number in `DYLIB_CURRENT_VERSION` to
(100 * *minor*) + *patchlevel* + 1
* set second number in `DYLIB_CURRENT_VERSION` to 0
- * if backwards compatibility has been broken,
- increase `DYLIB_COMPATIBILITY_VERSION` (?)
-
-* Run test/versioning.sh to verify that everything is consistent
+ * set `DYLIB_COMPATIBILITY_VERSION` to the same value
* Regenerate `configure`
+* Run test/versioning.sh to verify that everything is consistent
+
* Do the release
diff --git a/test-versioning.sh b/test-versioning.sh
index 1431b66b..15a56035 100755
--- a/test-versioning.sh
+++ b/test-versioning.sh
@@ -38,6 +38,17 @@ else
not_ok "configure.ac $version disagrees with SDL_mixer.h $ref_version"
fi
+major=$(sed -ne 's/^MAJOR_VERSION=//p' configure)
+minor=$(sed -ne 's/^MINOR_VERSION=//p' configure)
+micro=$(sed -ne 's/^MICRO_VERSION=//p' configure)
+version="${major}.${minor}.${micro}"
+
+if [ "$ref_version" = "$version" ]; then
+ ok "configure $version"
+else
+ not_ok "configure $version disagrees with SDL_image.h $ref_version"
+fi
+
major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
minor=$(sed -ne 's/^set(MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
micro=$(sed -ne 's/^set(MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
@@ -121,13 +132,25 @@ fi
# For simplicity this assumes we'll never break ABI before SDL 3.
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL_mixer.xcodeproj/project.pbxproj)
-ref='3.0.0
-3.0.0'
+
+case "$ref_minor" in
+ (*[02468])
+ major="$(( ref_minor * 100 + 1 ))"
+ minor="0"
+ ;;
+ (*)
+ major="$(( ref_minor * 100 + ref_micro + 1 ))"
+ minor="0"
+ ;;
+esac
+
+ref="${major}.${minor}.0
+${major}.${minor}.0"
if [ "$ref" = "$dylib_compat" ]; then
ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
else
- not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent"
+ not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
fi
dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL_mixer.xcodeproj/project.pbxproj)
@@ -149,7 +172,7 @@ ${major}.${minor}.0"
if [ "$ref" = "$dylib_cur" ]; then
ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
else
- not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref"
+ not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
fi
if [ "$ref_sdl_req" = "$sdl_req" ]; then