SDL/build-scripts/updaterev.sh
Sam Lantinga 0a48abc860 Switch header convention from #include "SDL.h" to #include <SDL3/SDLh>
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```

I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
   if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
        find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
    else
        find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
    fi
done
```

Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00

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/SDL3/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.txt"
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