mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-24 11:23:35 +08:00
4ca5ea5b7e
Downstream distributors can use this to mark a version with their preferred version information, like a Linux distribution package version or the Steam revision it was built to be bundled into, or just to mark it with the vendor it was built by or the environment it's intended to be used in. For instance, in Debian I'd use this by configuring with: --enable-vendor-info="${DEB_VENDOR} ${DEB_VERSION}" to get a SDL_REVISION like: release-2.24.1-0-ga1d1946dc (Debian 2.24.1+dfsg-2) which gives a Debian user enough information to track down the patches and build-time configuration that were used for package revision 2. In Autotools and CMake, this is a configure-time option like any other, and will go into both SDL_REVISION (via SDL_revision.h) and SDL_GetRevision(). In other build systems (MSVC, Xcode, etc.), defining the SDL_VENDOR_INFO macro will get it into the output of SDL_GetRevision(), although not SDL_REVISION. Resolves: https://github.com/libsdl-org/SDL/issues/6418 Signed-off-by: Simon McVittie <smcv@collabora.com>
50 lines
1.2 KiB
Bash
Executable File
50 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Generate a header file with the current source revision
|
|
|
|
outdir=`pwd`
|
|
cd `dirname $0`
|
|
srcdir=..
|
|
header=$outdir/include/SDL_revision.h
|
|
dist=
|
|
vendor=
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
(--dist)
|
|
dist=yes
|
|
shift
|
|
;;
|
|
(--vendor)
|
|
vendor="$2"
|
|
shift 2
|
|
;;
|
|
(*)
|
|
echo "$0: Unknown option: $1" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
rev=`sh showrev.sh 2>/dev/null`
|
|
if [ "$rev" != "" ]; then
|
|
if [ -n "$dist" ]; then
|
|
echo "$rev" > "$outdir/VERSION"
|
|
fi
|
|
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
|
|
if [ -n "$vendor" ]; then
|
|
echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new"
|
|
fi
|
|
echo "#ifdef SDL_VENDOR_INFO" >>"$header.new"
|
|
echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new"
|
|
echo "#else" >>"$header.new"
|
|
echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new"
|
|
echo "#endif" >>"$header.new"
|
|
echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
|
|
if diff $header $header.new >/dev/null 2>&1; then
|
|
rm "$header.new"
|
|
else
|
|
mv "$header.new" "$header"
|
|
fi
|
|
fi
|