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.
     1 #!/bin/sh
     2 #
     3 # Generate a header file with the current source revision
     4 
     5 outdir=`pwd`
     6 cd `dirname $0`
     7 srcdir=..
     8 header=$outdir/include/SDL_revision.h
     9 
    10 rev=`sh showrev.sh`
    11 if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then
    12     echo "#define SDL_REVISION \"$rev\"" >$header.new
    13     if diff $header $header.new >/dev/null 2>&1; then
    14         rm $header.new
    15     else
    16         mv $header.new $header
    17     fi
    18 fi