summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-3.2.20/build-scripts/test-versioning.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/SDL-3.2.20/build-scripts/test-versioning.sh')
-rwxr-xr-xsrc/contrib/SDL-3.2.20/build-scripts/test-versioning.sh170
1 files changed, 170 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/build-scripts/test-versioning.sh b/src/contrib/SDL-3.2.20/build-scripts/test-versioning.sh
new file mode 100755
index 0000000..55e29a3
--- /dev/null
+++ b/src/contrib/SDL-3.2.20/build-scripts/test-versioning.sh
@@ -0,0 +1,170 @@
1#!/bin/sh
2# Copyright 2022 Collabora Ltd.
3# SPDX-License-Identifier: Zlib
4
5set -eu
6
7cd `dirname $0`/..
8
9ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL3/SDL_version.h)
10ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL3/SDL_version.h)
11ref_micro=$(sed -ne 's/^#define SDL_MICRO_VERSION *//p' include/SDL3/SDL_version.h)
12ref_version="${ref_major}.${ref_minor}.${ref_micro}"
13
14tests=0
15failed=0
16
17ok () {
18 tests=$(( tests + 1 ))
19 echo "ok - $*"
20}
21
22not_ok () {
23 tests=$(( tests + 1 ))
24 echo "not ok - $*"
25 failed=1
26}
27
28version=$(sed -Ene 's/^.* version ([0-9.]*)$/\1/p' include/SDL3/SDL.h)
29
30if [ "$ref_version" = "$version" ]; then
31 ok "SDL.h $version"
32else
33 not_ok "SDL.h $version disagrees with SDL_version.h $ref_version"
34fi
35
36version=$(sed -Ene 's/^project\(SDL[0-9]+ LANGUAGES C VERSION "([0-9.]*)"\)$/\1/p' CMakeLists.txt)
37
38if [ "$ref_version" = "$version" ]; then
39 ok "CMakeLists.txt $version"
40else
41 not_ok "CMakeLists.txt $version disagrees with SDL_version.h $ref_version"
42fi
43
44major=$(sed -ne 's/.*SDL_MAJOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
45minor=$(sed -ne 's/.*SDL_MINOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
46micro=$(sed -ne 's/.*SDL_MICRO_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
47version="${major}.${minor}.${micro}"
48
49if [ "$ref_version" = "$version" ]; then
50 ok "SDLActivity.java $version"
51else
52 not_ok "android-project/app/src/main/java/org/libsdl/app/SDLActivity.java $version disagrees with SDL_version.h $ref_version"
53fi
54
55tuple=$(sed -ne 's/^ *FILEVERSION *//p' src/core/windows/version.rc | tr -d '\r')
56ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
57
58if [ "$ref_tuple" = "$tuple" ]; then
59 ok "version.rc FILEVERSION $tuple"
60else
61 not_ok "version.rc FILEVERSION $tuple disagrees with SDL_version.h $ref_tuple"
62fi
63
64tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' src/core/windows/version.rc | tr -d '\r')
65
66if [ "$ref_tuple" = "$tuple" ]; then
67 ok "version.rc PRODUCTVERSION $tuple"
68else
69 not_ok "version.rc PRODUCTVERSION $tuple disagrees with SDL_version.h $ref_tuple"
70fi
71
72tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/core/windows/version.rc | tr -d '\r')
73ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
74
75if [ "$ref_tuple" = "$tuple" ]; then
76 ok "version.rc FileVersion $tuple"
77else
78 not_ok "version.rc FileVersion $tuple disagrees with SDL_version.h $ref_tuple"
79fi
80
81tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/core/windows/version.rc | tr -d '\r')
82
83if [ "$ref_tuple" = "$tuple" ]; then
84 ok "version.rc ProductVersion $tuple"
85else
86 not_ok "version.rc ProductVersion $tuple disagrees with SDL_version.h $ref_tuple"
87fi
88
89version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist)
90
91if [ "$ref_version" = "$version" ]; then
92 ok "Info-Framework.plist CFBundleShortVersionString $version"
93else
94 not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_version.h $ref_version"
95fi
96
97version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist)
98
99if [ "$ref_version" = "$version" ]; then
100 ok "Info-Framework.plist CFBundleVersion $version"
101else
102 not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version"
103fi
104
105version=$(sed -Ene 's/Title SDL (.*)/\1/p' Xcode/SDL/pkg-support/SDL.info)
106
107if [ "$ref_version" = "$version" ]; then
108 ok "SDL.info Title $version"
109else
110 not_ok "SDL.info Title $version disagrees with SDL_version.h $ref_version"
111fi
112
113marketing=$(sed -Ene 's/.*MARKETING_VERSION = (.*);/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
114
115ref="$ref_version
116$ref_version"
117
118if [ "$ref" = "$marketing" ]; then
119 ok "project.pbxproj MARKETING_VERSION is consistent"
120else
121 not_ok "project.pbxproj MARKETING_VERSION is inconsistent, expected $ref, got $marketing"
122fi
123
124# For simplicity this assumes we'll never break ABI before SDL 3.
125dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
126
127case "$ref_minor" in
128 (*[02468])
129 major="$(( ref_minor * 100 + 1 ))"
130 minor="0"
131 ;;
132 (*)
133 major="$(( ref_minor * 100 + ref_micro + 1 ))"
134 minor="0"
135 ;;
136esac
137
138ref="${major}.${minor}.0
139${major}.${minor}.0"
140
141if [ "$ref" = "$dylib_compat" ]; then
142 ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
143else
144 not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
145fi
146
147dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
148
149case "$ref_minor" in
150 (*[02468])
151 major="$(( ref_minor * 100 + 1 ))"
152 minor="$ref_micro"
153 ;;
154 (*)
155 major="$(( ref_minor * 100 + ref_micro + 1 ))"
156 minor="0"
157 ;;
158esac
159
160ref="${major}.${minor}.0
161${major}.${minor}.0"
162
163if [ "$ref" = "$dylib_cur" ]; then
164 ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
165else
166 not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
167fi
168
169echo "1..$tests"
170exit "$failed"