build-scripts/updaterev.sh
author Sam Lantinga <slouken@libsdl.org>
Wed, 16 Feb 2011 02:37:09 -0800
changeset 5310 a9945ce48999
parent 4936 e99358ca7a8d
child 5345 0202f62906ca
permissions -rwxr-xr-x
Made it possible to build SDL from a fresh checkout without any additional steps.

The trick is that if you're using configure and you don't want to have SDL_config.h and SDL_revision.h to show up as modified, you need to configure and build from a separate directory.

You also need to include SDL_revision.h directly if you want to use the SDL_REVISION constant, as a side effect of these changes.
slouken@2982
     1
#!/bin/sh
slouken@2982
     2
#
slouken@2982
     3
# Generate a header file with the current source revision
slouken@2982
     4
slouken@5310
     5
outdir=`pwd`
slouken@2982
     6
cd `dirname $0`
slouken@2982
     7
srcdir=..
slouken@5310
     8
header=$outdir/include/SDL_revision.h
slouken@2982
     9
slouken@2982
    10
rev=`sh showrev.sh`
slouken@4936
    11
if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then
icculus@4419
    12
    echo "#define SDL_REVISION \"$rev\"" >$header.new
slouken@2982
    13
    if diff $header $header.new >/dev/null 2>&1; then
slouken@2982
    14
        rm $header.new
slouken@2982
    15
    else
slouken@2982
    16
        mv $header.new $header
slouken@2982
    17
    fi
slouken@2982
    18
fi