build-scripts/updaterev.sh
author Sam Lantinga <slouken@libsdl.org>
Wed, 19 Sep 2012 18:08:37 -0700
changeset 6441 ada3545fed23
parent 5359 d5fe4ed3a28d
child 6994 06f368666c6f
permissions -rwxr-xr-x
Fixed bug 1600 - SDL_GetPlatform() returns "unknown os" on Android Pallav Nawani 2012-09-14 03:23:02 PDT Looking through the code for SDL_GetPlatform(), it is obvious that the case for Android platform doesn't exist. And hence SDL_GetPlatform() doesn't return a useful string on Android Phones.
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,'`
4419
5e7e1f1a4056 Changed revision details to be a string (an hg changeset) instead of an int.
Ryan C. Gordon <icculus@icculus.org>
parents: 2982
diff changeset
    13
    echo "#define SDL_REVISION \"$rev\"" >$header.new
5359
d5fe4ed3a28d Added a revision number for easy compile-time tests.
Sam Lantinga <slouken@libsdl.org>
parents: 5345
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
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
        rm $header.new
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
    else
b64c1d23039b Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
        mv $header.new $header
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