summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-3.2.20/build-scripts/showrev.sh
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-08-30 16:53:58 -0700
committer3gg <3gg@shellblade.net>2025-08-30 16:53:58 -0700
commit6aaedb813fa11ba0679c3051bc2eb28646b9506c (patch)
tree34acbfc9840e02cb4753e6306ea7ce978bf8b58e /src/contrib/SDL-3.2.20/build-scripts/showrev.sh
parent8f228ade99dd3d4c8da9b78ade1815c9adf85c8f (diff)
Update to SDL3
Diffstat (limited to 'src/contrib/SDL-3.2.20/build-scripts/showrev.sh')
-rwxr-xr-xsrc/contrib/SDL-3.2.20/build-scripts/showrev.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/build-scripts/showrev.sh b/src/contrib/SDL-3.2.20/build-scripts/showrev.sh
new file mode 100755
index 0000000..764d3a4
--- /dev/null
+++ b/src/contrib/SDL-3.2.20/build-scripts/showrev.sh
@@ -0,0 +1,48 @@
1#!/bin/sh
2#
3# Print the current source revision, if available
4
5SDL_ROOT=$(dirname $0)/..
6cd $SDL_ROOT
7
8if [ -e ./VERSION.txt ]; then
9 cat ./VERSION.txt
10 exit 0
11fi
12
13major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL3/SDL_version.h)
14minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL3/SDL_version.h)
15micro=$(sed -ne 's/^#define SDL_MICRO_VERSION *//p' include/SDL3/SDL_version.h)
16version="${major}.${minor}.${micro}"
17
18if [ -x "$(command -v git)" ]; then
19 rev="$(git describe --tags --long 2>/dev/null)"
20 if [ -n "$rev" ]; then
21 # e.g. release-2.24.0-542-g96361fc47
22 # or release-2.24.1-5-g36b987dab
23 # or prerelease-2.23.2-0-gcb46e1b3f
24 echo "$rev"
25 exit 0
26 fi
27
28 rev="$(git describe --always --tags --long 2>/dev/null)"
29 if [ -n "$rev" ]; then
30 # Just a truncated sha1, e.g. 96361fc47.
31 # Turn it into e.g. 2.25.0-g96361fc47
32 echo "${version}-g${rev}"
33 exit 0
34 fi
35fi
36
37if [ -x "$(command -v p4)" ]; then
38 rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')"
39 if [ $? = 0 ]; then
40 # e.g. 2.25.0-p7511446
41 echo "${version}-p${rev}"
42 exit 0
43 fi
44fi
45
46# best we can do
47echo "${version}-no-vcs"
48exit 0