From 5ec73dee498e39109f4c2d8b31d382764166535f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 5 Sep 2022 12:22:11 -0700
Subject: [PATCH] Fixed handling of DYLIB_COMPATIBILITY_VERSION
Also make sure we test the version in configure
---
CMakeLists.txt | 2 -
Xcode/SDL_net.xcodeproj/project.pbxproj | 4 +-
cmake/PrivateSdlFunctions.cmake | 1 +
release_checklist.md | 19 +++----
test-versioning.sh | 75 +++++++++++++++----------
5 files changed, 57 insertions(+), 44 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 138f88c..9035ab2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,8 +8,6 @@ set(MINOR_VERSION 3)
set(MICRO_VERSION 0)
set(SDL_REQUIRED_VERSION 2.0.4)
-set(DYLIB_COMPATIBILITY_VERSION "1")
-
include(PrivateSdlFunctions)
sdl_calculate_derived_version_variables()
diff --git a/Xcode/SDL_net.xcodeproj/project.pbxproj b/Xcode/SDL_net.xcodeproj/project.pbxproj
index 4cb3127..0428a0b 100644
--- a/Xcode/SDL_net.xcodeproj/project.pbxproj
+++ b/Xcode/SDL_net.xcodeproj/project.pbxproj
@@ -426,7 +426,7 @@
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
COPY_PHASE_STRIP = NO;
- DYLIB_COMPATIBILITY_VERSION = 1.0.0;
+ DYLIB_COMPATIBILITY_VERSION = 301.0.0;
DYLIB_CURRENT_VERSION = 301.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_TESTABILITY = YES;
@@ -456,7 +456,7 @@
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
DEPLOYMENT_POSTPROCESSING = YES;
- DYLIB_COMPATIBILITY_VERSION = 1.0.0;
+ DYLIB_COMPATIBILITY_VERSION = 301.0.0;
DYLIB_CURRENT_VERSION = 301.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/$(PLATFORM)\"";
diff --git a/cmake/PrivateSdlFunctions.cmake b/cmake/PrivateSdlFunctions.cmake
index 398770b..b22af5c 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 3b4dade..080f242 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_net.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 26d3b43..35bc778 100755
--- a/test-versioning.sh
+++ b/test-versioning.sh
@@ -38,6 +38,35 @@ else
not_ok "configure.ac $version disagrees with SDL_net.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_net.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)
+sdl_req=$(sed -ne 's/^set(SDL_REQUIRED_VERSION \([0-9.]*\))$/\1/p' CMakeLists.txt)
+version="${major}.${minor}.${micro}"
+
+if [ "$ref_version" = "$version" ]; then
+ ok "CMakeLists.txt $version"
+else
+ not_ok "CMakeLists.txt $version disagrees with SDL_net.h $ref_version"
+fi
+
+if [ "$ref_sdl_req" = "$sdl_req" ]; then
+ ok "CMakeLists.txt SDL_REQUIRED_VERSION is consistent"
+else
+ not_ok "CMakeLists.txt SDL_REQUIRED_VERSION=$sdl_req disagrees with configure.ac SDL_VERSION=$ref_sdl_req"
+fi
+
major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2)
minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2)
micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2)
@@ -103,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_net.xcodeproj/project.pbxproj)
-ref='1.0.0
-1.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_net.xcodeproj/project.pbxproj)
@@ -131,33 +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"
-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)
-sdl_req=$(sed -ne 's/^set(SDL_REQUIRED_VERSION \([0-9.]*\))$/\1/p' CMakeLists.txt)
-dylib_cmake=$(sed -ne 's/^set(DYLIB_COMPATIBILITY_VERSION "\([0-9]*\)")$/\1/p' CMakeLists.txt)
-ref='1'
-version="${major}.${minor}.${micro}"
-
-if [ "$ref_version" = "$version" ]; then
- ok "CMakeLists.txt $version"
-else
- not_ok "CMakeLists.txt $version disagrees with SDL_image.h $ref_version"
-fi
-
-if [ "$ref_sdl_req" = "$sdl_req" ]; then
- ok "CMakeLists.txt SDL_REQUIRED_VERSION is consistent"
-else
- not_ok "CMakeLists.txt SDL_REQUIRED_VERSION=$sdl_req disagrees with configure.ac SDL_VERSION=$ref_sdl_req"
-fi
-
-if [ "$ref" = "$dylib_cmake" ]; then
- ok "CMakeLists.txt DYLIB_COMPATIBILITY_VERSION is consistent"
-else
- not_ok "CMakeLists.txt DYLIB_COMPATIBILITY_VERSION is inconsistent"
+ not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
fi
sdl_req=$(sed -ne 's/\$sdl2_version = "\([0-9.]*\)"$/\1/p' .github/fetch_sdl_vc.ps1)