--- a/Makefile.in Sat Jan 03 21:01:02 2009 +0000
+++ b/Makefile.in Sun Jan 04 05:08:12 2009 +0000
@@ -42,7 +42,7 @@
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
-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
+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
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
@@ -63,7 +63,10 @@
$(objects):
$(SHELL) $(auxdir)/mkinstalldirs $@
-.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
+update-revision:
+ $(SHELL) $(auxdir)/updaterev.sh
+
+.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
depend:
@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
$(SHELL) $(auxdir)/makedep.sh
@@ -75,7 +78,7 @@
include $(depend)
-$(objects)/$(TARGET): $(OBJECTS)
+$(objects)/$(TARGET): update-revision $(OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
@@ -153,6 +156,7 @@
$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
tar cf - $(DIST) | (cd $(distdir); tar xf -)
cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
+ $(SHELL) $(distdir)/build-scripts/updaterev.sh
rm -rf `find $(distdir) -name .svn`
find $(distdir) \( \
-name '*~' -o \
@@ -194,10 +198,4 @@
# Create a SVN snapshot that people can run update on
snapshot:
- svn co http://svn.libsdl.org/trunk/SDL SDL-1.3
- (cd SDL-1.3 && ./autogen.sh && rm -rf autom4te.cache)
- cp SDL-1.3/include/SDL_config.h.default SDL-1.3/include/SDL_config.h
- tar zcf $(HOME)/SDL-1.3.tar.gz SDL-1.3
- rm -f $(HOME)/SDL-1.3.zip
- zip -r $(HOME)/SDL-1.3.zip SDL-1.3
- rm -rf SDL-1.3
+ $(SHELL) $(aux_dir)/snapshot.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/showrev.sh Sun Jan 04 05:08:12 2009 +0000
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Print the current source revision, if available
+
+srcdir=`dirname $0`/..
+
+if [ -d $srcdir/.svn ]; then
+ cd $srcdir
+ svnversion -c | sed -e 's,[0-9]*:\([0-9]*\)[A-Z]*,\1,'
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/snapshot.sh Sun Jan 04 05:08:12 2009 +0000
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Generate a current snapshot from source control
+
+svn co http://svn.libsdl.org/trunk/SDL
+(cd SDL && ./autogen.sh && rm -rf autom4te.cache)
+sh SDL/build-scripts/updaterev.sh
+cp SDL/include/SDL_config.h.default SDL/include/SDL_config.h
+
+major=`fgrep "#define SDL_MAJOR_VERSION" SDL/include/SDL_version.h | \
+ sed 's,[^0-9]*\([0-9]*\),\1,'`
+minor=`fgrep "#define SDL_MINOR_VERSION" SDL/include/SDL_version.h | \
+ sed 's,[^0-9]*\([0-9]*\),\1,'`
+patch=`fgrep "#define SDL_PATCHLEVEL" SDL/include/SDL_version.h | \
+ sed 's,[^0-9]*\([0-9]*\),\1,'`
+rev=`fgrep "#define SDL_REVISION" SDL/include/SDL_revision.h | \
+ sed 's,[^0-9]*\([0-9]*\),\1,'`
+path="SDL-$major.$minor.$patch-$rev"
+
+mv SDL $path
+tar zcf $path.tar.gz $path
+rm -f $path.zip
+zip -r $path.zip $path
+rm -rf $path
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build-scripts/updaterev.sh Sun Jan 04 05:08:12 2009 +0000
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Generate a header file with the current source revision
+
+cd `dirname $0`
+srcdir=..
+header=$srcdir/include/SDL_revision.h
+
+rev=`sh showrev.sh`
+if [ "$rev" != "" ]; then
+ echo "#define SDL_REVISION $rev" >$header.new
+ if diff $header $header.new >/dev/null 2>&1; then
+ rm $header.new
+ else
+ mv $header.new $header
+ fi
+fi
--- a/include/SDL_version.h Sat Jan 03 21:01:02 2009 +0000
+++ b/include/SDL_version.h Sun Jan 04 05:08:12 2009 +0000
@@ -30,6 +30,7 @@
#define _SDL_version_h
#include "SDL_stdinc.h"
+#include "SDL_revision.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
@@ -131,6 +132,12 @@
*/
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
+/**
+ * \fn int SDL_GetRevision()
+ * \brief Get the code revision of SDL that is linked against your program.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRevision();
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
--- a/src/SDL.c Sat Jan 03 21:01:02 2009 +0000
+++ b/src/SDL.c Sun Jan 04 05:08:12 2009 +0000
@@ -296,6 +296,13 @@
SDL_VERSION(ver);
}
+/* Get the library source revision */
+int
+SDL_GetRevision()
+{
+ SDL_REVISION;
+}
+
#if defined(__OS2__)
/* Building for OS/2 */
#ifdef __WATCOMC__