build-scripts: Added update-version.sh Fixes #6171.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
diff --git a/build-scripts/update-version.sh b/build-scripts/update-version.sh
new file mode 100755
index 0000000..d703695
--- /dev/null
+++ b/build-scripts/update-version.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+#set -x
+
+cd `dirname $0`/..
+
+ARGSOKAY=1
+if [ -z $1 ]; then
+ ARGSOKAY=0
+fi
+if [ -z $2 ]; then
+ ARGSOKAY=0
+fi
+if [ -z $3 ]; then
+ ARGSOKAY=0
+fi
+
+if [ "x$ARGSOKAY" = "x0" ]; then
+ echo "USAGE: $0 <major> <minor> <patch>" 1>&2
+ exit 1
+fi
+
+MAJOR="$1"
+MINOR="$2"
+PATCH="$3"
+NEWVERSION="$MAJOR.$MINOR.$PATCH"
+
+echo "Updating version to '$NEWVERSION' ..."
+
+# !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file.
+perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist
+
+DYVER=`expr $MINOR \* 100 + 1`
+perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+
+# Set compat to major.minor.0 by default.
+perl -w -pi -e 's/(DYLIB_COMPATIBILITY_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+
+# non-zero patch?
+if [ "x$PATCH" != "x0" ]; then
+ if [ `expr $MINOR % 2` = "0" ]; then
+ # If patch is not zero, but minor is even, it's a bugfix release.
+ perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.'$PATCH'.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+
+ else
+ # If patch is not zero, but minor is odd, it's a development prerelease.
+ DYVER=`expr $MINOR \* 100 + $PATCH + 1`
+ perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+ perl -w -pi -e 's/(DYLIB_COMPATIBILITY_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+ fi
+fi
+
+perl -w -pi -e 's/\A(SDL_MAJOR_VERSION=)\d+/${1}'$MAJOR'/;' configure.ac
+perl -w -pi -e 's/\A(SDL_MINOR_VERSION=)\d+/${1}'$MINOR'/;' configure.ac
+perl -w -pi -e 's/\A(SDL_MICRO_VERSION=)\d+/${1}'$PATCH'/;' configure.ac
+
+perl -w -pi -e 's/\A(set\(SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' CMakeLists.txt
+perl -w -pi -e 's/\A(set\(SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' CMakeLists.txt
+perl -w -pi -e 's/\A(set\(SDL_MICRO_VERSION\s+)\d+/${1}'$PATCH'/;' CMakeLists.txt
+
+perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.os2
+perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.os2
+perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.os2
+
+perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.w32
+perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.w32
+perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.w32
+
+perl -w -pi -e 's/(\#define SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' include/SDL_version.h
+perl -w -pi -e 's/(\#define SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' include/SDL_version.h
+perl -w -pi -e 's/(\#define SDL_PATCHLEVEL\s+)\d+/${1}'$PATCH'/;' include/SDL_version.h
+
+perl -w -pi -e 's/(FILEVERSION\s+)\d+,\d+,\d+/${1}'$MAJOR','$MINOR','$PATCH'/;' src/main/windows/version.rc
+perl -w -pi -e 's/(PRODUCTVERSION\s+)\d+,\d+,\d+/${1}'$MAJOR','$MINOR','$PATCH'/;' src/main/windows/version.rc
+perl -w -pi -e 's/(VALUE "FileVersion", ")\d+, \d+, \d+/${1}'$MAJOR', '$MINOR', '$PATCH'/;' src/main/windows/version.rc
+perl -w -pi -e 's/(VALUE "ProductVersion", ")\d+, \d+, \d+/${1}'$MAJOR', '$MINOR', '$PATCH'/;' src/main/windows/version.rc
+
+echo "Regenerating configure script with new version..."
+./autogen.sh |grep -v 'Now you are ready to run ./configure'
+
+echo "Running test/versioning.sh to verify changes..."
+./test/versioning.sh
+
+echo "All done."
+echo "Run 'git diff' and make sure this looks correct, before 'git commit'."
+
+exit 0
+
diff --git a/docs/release_checklist.md b/docs/release_checklist.md
index 7fb9c57..0c9e501 100644
--- a/docs/release_checklist.md
+++ b/docs/release_checklist.md
@@ -4,27 +4,10 @@
* Update `WhatsNew.txt`
-* Bump version number to 2.EVEN.0 in all these locations:
-
- * `configure.ac`, `CMakeLists.txt`: `SDL_*_VERSION`
- * `Xcode/SDL/Info-Framework.plist`: `CFBundleShortVersionString`,
- `CFBundleVersion`
- * `Makefile.os2`: `VERSION`
- * `Makefile.w32`: `*_VERSION`
- * `include/SDL_version.h`: `SDL_*_VERSION`, `SDL_PATCHLEVEL`
- * `src/main/windows/version.rc`: `FILEVERSION`, `PRODUCTVERSION`,
- `FileVersion`, `ProductVersion`
-
-* Bump ABI version information
-
- * `Xcode/SDL/SDL.xcodeproj/project.pbxproj`:
- `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION`
- * set first number in `DYLIB_CURRENT_VERSION` to
- (100 * *minor*) + 1
- * set second number in `DYLIB_CURRENT_VERSION` to 0
- * set `DYLIB_COMPATIBILITY_VERSION` to the same value
+* Bump version number to 2.EVEN.0:
-* Regenerate `configure`
+ * `./build-scripts/update-version.sh 2 EVEN 0`
+ * (spaces between each component of the version, and `EVEN` will be a real number in real life.
* Run test/versioning.sh to verify that everything is consistent
@@ -38,16 +21,8 @@
* Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is even)
- * Same places as listed above
-
-* Bump ABI version information
-
- * `Xcode/SDL/SDL.xcodeproj/project.pbxproj`:
- `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION`
- * set second number in `DYLIB_CURRENT_VERSION` to *patchlevel*
- * Leave `DYLIB_COMPATIBILITY_VERSION` unchanged
-
-* Regenerate `configure`
+ * `./build-scripts/update-version.sh 2 Y Z+1`
+ * (spaces between each component of the version, and `Y` and `Z+1` will be real numbers in real life.
* Run test/versioning.sh to verify that everything is consistent
@@ -59,12 +34,8 @@
* Bump version number to 2.ODD.0 for next development branch
- * Same places as listed above
-
-* Bump ABI version information
-
- * Same places as listed above
- * Assume that the next feature release will contain new API/ABI
+ * `./build-scripts/update-version.sh 2 ODD 0`
+ * (spaces between each component of the version, and `ODD` will be a real number in real life.
* Run test/versioning.sh to verify that everything is consistent
@@ -72,16 +43,8 @@
* Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is odd)
- * Same places as listed above
-
-* Bump ABI version information
-
- * `Xcode/SDL/SDL.xcodeproj/project.pbxproj`:
- `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION`
- * set first number in `DYLIB_CURRENT_VERSION` to
- (100 * *minor*) + *patchlevel* + 1
- * set second number in `DYLIB_CURRENT_VERSION` to 0
- * set `DYLIB_COMPATIBILITY_VERSION` to the same value
+ * `./build-scripts/update-version.sh 2 Y Z+1`
+ * (spaces between each component of the version, and `Y` and `Z+1` will be real numbers in real life.
* Regenerate `configure`