Make the current revision number available
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Jan 2009 05:08:12 +0000
changeset 2982b64c1d23039b
parent 2981 4bbb9de56029
child 2983 388c5a2daeac
Make the current revision number available
Makefile.in
build-scripts/showrev.sh
build-scripts/snapshot.sh
build-scripts/updaterev.sh
include/SDL_version.h
src/SDL.c
     1.1 --- a/Makefile.in	Sat Jan 03 21:01:02 2009 +0000
     1.2 +++ b/Makefile.in	Sun Jan 04 05:08:12 2009 +0000
     1.3 @@ -42,7 +42,7 @@
     1.4  
     1.5  DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode
     1.6  
     1.7 -HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
     1.8 +HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
     1.9  
    1.10  LT_AGE      = @LT_AGE@
    1.11  LT_CURRENT  = @LT_CURRENT@
    1.12 @@ -63,7 +63,10 @@
    1.13  $(objects):
    1.14  	$(SHELL) $(auxdir)/mkinstalldirs $@
    1.15  
    1.16 -.PHONY: all depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
    1.17 +update-revision:
    1.18 +	$(SHELL) $(auxdir)/updaterev.sh
    1.19 +
    1.20 +.PHONY: all update-revision depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
    1.21  depend:
    1.22  	@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
    1.23  	$(SHELL) $(auxdir)/makedep.sh
    1.24 @@ -75,7 +78,7 @@
    1.25  
    1.26  include $(depend)
    1.27  
    1.28 -$(objects)/$(TARGET): $(OBJECTS)
    1.29 +$(objects)/$(TARGET): update-revision $(OBJECTS)
    1.30  	$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
    1.31  
    1.32  $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
    1.33 @@ -153,6 +156,7 @@
    1.34  	$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
    1.35  	tar cf - $(DIST) | (cd $(distdir); tar xf -)
    1.36  	cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
    1.37 +	$(SHELL) $(distdir)/build-scripts/updaterev.sh
    1.38  	rm -rf `find $(distdir) -name .svn`
    1.39  	find $(distdir) \( \
    1.40  	    -name '*~' -o \
    1.41 @@ -194,10 +198,4 @@
    1.42  
    1.43  # Create a SVN snapshot that people can run update on
    1.44  snapshot:
    1.45 -	svn co http://svn.libsdl.org/trunk/SDL SDL-1.3
    1.46 -	(cd SDL-1.3 && ./autogen.sh && rm -rf autom4te.cache)
    1.47 -	cp SDL-1.3/include/SDL_config.h.default SDL-1.3/include/SDL_config.h
    1.48 -	tar zcf $(HOME)/SDL-1.3.tar.gz SDL-1.3
    1.49 -	rm -f $(HOME)/SDL-1.3.zip
    1.50 -	zip -r $(HOME)/SDL-1.3.zip SDL-1.3
    1.51 -	rm -rf SDL-1.3
    1.52 +	$(SHELL) $(aux_dir)/snapshot.sh
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/build-scripts/showrev.sh	Sun Jan 04 05:08:12 2009 +0000
     2.3 @@ -0,0 +1,10 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# Print the current source revision, if available
     2.7 +
     2.8 +srcdir=`dirname $0`/..
     2.9 +
    2.10 +if [ -d $srcdir/.svn ]; then
    2.11 +    cd $srcdir
    2.12 +    svnversion -c | sed -e 's,[0-9]*:\([0-9]*\)[A-Z]*,\1,'
    2.13 +fi
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/build-scripts/snapshot.sh	Sun Jan 04 05:08:12 2009 +0000
     3.3 @@ -0,0 +1,24 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# Generate a current snapshot from source control
     3.7 +
     3.8 +svn co http://svn.libsdl.org/trunk/SDL
     3.9 +(cd SDL && ./autogen.sh && rm -rf autom4te.cache)
    3.10 +sh SDL/build-scripts/updaterev.sh
    3.11 +cp SDL/include/SDL_config.h.default SDL/include/SDL_config.h
    3.12 +
    3.13 +major=`fgrep "#define SDL_MAJOR_VERSION" SDL/include/SDL_version.h | \
    3.14 +       sed 's,[^0-9]*\([0-9]*\),\1,'`
    3.15 +minor=`fgrep "#define SDL_MINOR_VERSION" SDL/include/SDL_version.h | \
    3.16 +       sed 's,[^0-9]*\([0-9]*\),\1,'`
    3.17 +patch=`fgrep "#define SDL_PATCHLEVEL" SDL/include/SDL_version.h | \
    3.18 +       sed 's,[^0-9]*\([0-9]*\),\1,'`
    3.19 +rev=`fgrep "#define SDL_REVISION" SDL/include/SDL_revision.h | \
    3.20 +       sed 's,[^0-9]*\([0-9]*\),\1,'`
    3.21 +path="SDL-$major.$minor.$patch-$rev"
    3.22 +
    3.23 +mv SDL $path
    3.24 +tar zcf $path.tar.gz $path
    3.25 +rm -f $path.zip
    3.26 +zip -r $path.zip $path
    3.27 +rm -rf $path
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/build-scripts/updaterev.sh	Sun Jan 04 05:08:12 2009 +0000
     4.3 @@ -0,0 +1,17 @@
     4.4 +#!/bin/sh
     4.5 +#
     4.6 +# Generate a header file with the current source revision
     4.7 +
     4.8 +cd `dirname $0`
     4.9 +srcdir=..
    4.10 +header=$srcdir/include/SDL_revision.h
    4.11 +
    4.12 +rev=`sh showrev.sh`
    4.13 +if [ "$rev" != "" ]; then
    4.14 +    echo "#define SDL_REVISION $rev" >$header.new
    4.15 +    if diff $header $header.new >/dev/null 2>&1; then
    4.16 +        rm $header.new
    4.17 +    else
    4.18 +        mv $header.new $header
    4.19 +    fi
    4.20 +fi
     5.1 --- a/include/SDL_version.h	Sat Jan 03 21:01:02 2009 +0000
     5.2 +++ b/include/SDL_version.h	Sun Jan 04 05:08:12 2009 +0000
     5.3 @@ -30,6 +30,7 @@
     5.4  #define _SDL_version_h
     5.5  
     5.6  #include "SDL_stdinc.h"
     5.7 +#include "SDL_revision.h"
     5.8  
     5.9  #include "begin_code.h"
    5.10  /* Set up for C function definitions, even when using C++ */
    5.11 @@ -131,6 +132,12 @@
    5.12   */
    5.13  extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
    5.14  
    5.15 +/**
    5.16 + * \fn int SDL_GetRevision()
    5.17 + * \brief Get the code revision of SDL that is linked against your program.
    5.18 + */
    5.19 +extern DECLSPEC int SDLCALL SDL_GetRevision();
    5.20 +
    5.21  /* Ends C function definitions when using C++ */
    5.22  #ifdef __cplusplus
    5.23  /* *INDENT-OFF* */
     6.1 --- a/src/SDL.c	Sat Jan 03 21:01:02 2009 +0000
     6.2 +++ b/src/SDL.c	Sun Jan 04 05:08:12 2009 +0000
     6.3 @@ -296,6 +296,13 @@
     6.4      SDL_VERSION(ver);
     6.5  }
     6.6  
     6.7 +/* Get the library source revision */
     6.8 +int
     6.9 +SDL_GetRevision()
    6.10 +{
    6.11 +    SDL_REVISION;
    6.12 +}
    6.13 +
    6.14  #if defined(__OS2__)
    6.15  /* Building for OS/2 */
    6.16  #ifdef __WATCOMC__