build-scripts/updaterev.sh
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 6994 06f368666c6f
permissions -rwxr-xr-x
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2982
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
#!/bin/sh
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
#
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     3
# Generate a header file with the current source revision
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents: 4936
diff changeset
     5
outdir=`pwd`
2982
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     6
cd `dirname $0`
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     7
srcdir=..
5310
a9945ce48999 Made it possible to build SDL from a fresh checkout without any additional steps.
Sam Lantinga <slouken@libsdl.org>
parents: 4936
diff changeset
     8
header=$outdir/include/SDL_revision.h
2982
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     9
5345
0202f62906ca Added a better way to include build rules in the Makefile
Sam Lantinga <slouken@libsdl.org>
parents: 5310
diff changeset
    10
rev=`sh showrev.sh 2>/dev/null`
4936
e99358ca7a8d Don't overwrite SDL_revision.h with a bad revision if Mercurial isn't installed
Sam Lantinga <slouken@libsdl.org>
parents: 4419
diff changeset
    11
if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then
5359
d5fe4ed3a28d Added a revision number for easy compile-time tests.
Sam Lantinga <slouken@libsdl.org>
parents: 5345
diff changeset
    12
    revnum=`echo $rev | sed 's,hg-\([0-9]*\).*,\1,'`
6994
06f368666c6f Fix bug 1574 - updaterev.sh fails when path contains spaces
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 5359
diff changeset
    13
    echo "#define SDL_REVISION \"$rev\"" >"$header.new"
06f368666c6f Fix bug 1574 - updaterev.sh fails when path contains spaces
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 5359
diff changeset
    14
    echo "#define SDL_REVISION_NUMBER $revnum" >>"$header.new"
2982
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    15
    if diff $header $header.new >/dev/null 2>&1; then
6994
06f368666c6f Fix bug 1574 - updaterev.sh fails when path contains spaces
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 5359
diff changeset
    16
        rm "$header.new"
2982
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
    else
6994
06f368666c6f Fix bug 1574 - updaterev.sh fails when path contains spaces
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 5359
diff changeset
    18
        mv "$header.new" "$header"
2982
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    19
    fi
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
fi