Skip to content

Commit

Permalink
Fixed test-versioning.sh on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed May 25, 2022
1 parent 326b099 commit 11fca9b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test-versioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

set -eu

# Needed so sed doesn't report illegal byte sequences on macOS
export LC_CTYPE=C

ref_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' include/SDL_mixer.h)
ref_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' include/SDL_mixer.h)
ref_micro=$(sed -ne 's/^#define SDL_MIXER_PATCHLEVEL *//p' include/SDL_mixer.h)
Expand Down Expand Up @@ -34,9 +37,9 @@ else
not_ok "configure.ac $version disagrees with SDL_mixer.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)
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)
version="${major}.${minor}.${micro}"

if [ "$ref_version" = "$version" ]; then
Expand Down Expand Up @@ -74,7 +77,7 @@ for rcfile in version.rc VisualC/Version.rc; do
not_ok "$rcfile PRODUCTVERSION $tuple disagrees with SDL_mixer.h $ref_tuple"
fi

tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]+)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"

if [ "$ref_tuple" = "$tuple" ]; then
Expand All @@ -83,7 +86,7 @@ for rcfile in version.rc VisualC/Version.rc; do
not_ok "$rcfile FileVersion $tuple disagrees with SDL_mixer.h $ref_tuple"
fi

tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]+)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')

if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile ProductVersion $tuple"
Expand Down

0 comments on commit 11fca9b

Please sign in to comment.