author | Philipp Wiesemann <philipp.wiesemann@arcor.de> |
Sun, 02 Jun 2013 14:11:04 +0200 | |
changeset 7261 | df37802bf7db |
parent 6994 | 06f368666c6f |
permissions | -rwxr-xr-x |
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 |