mail[Wesnoth-commits] r25179 - in /trunk: SConstruct src/Makefile.am src/game_config.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on March 27, 2008 - 09:37:
Author: esr
Date: Thu Mar 27 09:37:20 2008
New Revision: 25179

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25179&view=rev
Log:
Arrange both build recipes so they generate a revision.hpp file
containing a symbol definition for the checkout revision. Guard the inclusion
with HAVE_REVISION so Windows developers doing an SVN checkout wobn't
trip over it.  (This is a stopgap until scons or cmake lets us create
the recision.h file uniformly on Windows.)

Modified:
    trunk/SConstruct
    trunk/src/Makefile.am
    trunk/src/game_config.cpp

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=25179&r1=25178&r2=25179&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Thu Mar 27 09:37:20 2008
@@ -46,14 +46,9 @@
 # Setup
 #
 
-# FIXME: Currently this will only work under Linux
-svnrev = commands.getoutput("svnversion -n . 2>/dev/null")
-
 env = Environment(options = opts)
 
 env.TargetSignatures('content')
-
-env["CXXFLAGS"].append('-DSVNREV=\'"%s"\'' % svnrev)
 
 # Omits the 'test' target 
 all = env.Alias("all", ["wesnoth", "wesnoth_editor", "wesnothd", "campaignd",
@@ -131,6 +126,9 @@
 # FIXME: Unix-specific.
 # Link only on demand, so we don't need separate link lists for each binary
 env["LINKFLAGS"].append("-Wl,--as-needed")
+
+# Later in the recipe we will guarantee that src/revision.hpp exists 
+env["CXXFLAGS"].append('-DHAVE_REVISION')
 
 if env["debug"]:
     env["CXXFLAGS"] += Split("-O0 -DDEBUG -ggdb3 -W -Wall -ansi")
@@ -453,12 +451,11 @@
             LIBS =  ['wesnoth_core', 'wesnoth_sdl', 'wesnothd'] + commonlibs 
+ ['boost_unit_test_framework'],
             LIBPATH = [".", "/lib", "/usr/lib"])
 
-# FIXME: Include this in gameconfig.cpp when we switch over to scons.
-# Because of the content check, scons will do the right thing.
-# At that point the following line and -DSVNREV can be removed from CXXFLAGS.
-env.Depends('src/game_config.o', 'revision_stamp.h')
-r = env.Command("revision_stamp.h", [],
-            'echo "#define REVISION \"%s\"" >revision_stamp.h' % svnrev)
+# FIXME: Currently this will only work under Linux
+svnrev = commands.getoutput("svnversion -n . 2>/dev/null")
+env.Depends('src/game_config.o', 'src/revision.hpp')
+r = env.Command("revision.h", [],
+            'echo "#define REVISION \"%s\"" >src/revision.h' % svnrev)
 env.AlwaysBuild(r)
 
 #

Modified: trunk/src/Makefile.am
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=25179&r1=25178&r2=25179&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Thu Mar 27 09:37:20 2008
@@ -1,7 +1,3 @@
-SVNREV = $(shell svnversion -n $(topdir) 2>/dev/null)
-CFLAGS += "-DSVNREV=\"$(SVNREV)\""
-CXXFLAGS += "-DSVNREV=\"$(SVNREV)\""
-
 AUTOMAKE_OPTIONS = subdir-objects
 
 bin_PROGRAMS =
@@ -439,20 +435,25 @@
        wml_exception.cpp 
 
 # Until game_config.cpp is removed, this will be needed to ensure that the
-# SVNVER constant gets updated correctly.  If and when that definition is
+# REVISION constant gets updated correctly.  If and when that definition is
 # moved elsewhere, this dependency must follow it.
-game_config.o: revision-stamp 
+game_config.o: revision.hpp 
 
 # Should be touched each time the SVN revision number goes up 
-revision-stamp: FORCE
-       if [ x"$(SVNREV)" != x`cat revision-stamp 2>/dev/null` ]; then echo 
-n $(SVNREV) >revision-stamp; fi
+# Inclusion of this file should be guarded by HAVE_REVISION so checkouts 
+# into a Windows build environment won't break.
+REVISION = $(shell svnversion -n $(topdir) 2>/dev/null)
+.PRECIOUS: revision.hpp
+revision.hpp: FORCE
+       echo '#define REVISION  "$(REVISION)"' >/tmp/westemp$$$$; \
+       if cmp -s revision.hpp /tmp/westemp$$$$ 2>/dev/null; then :; else cp 
/tmp/westemp$$ revision.hpp; fi
 
 FORCE:
 
-AM_CXXFLAGS = -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@  
-DWESNOTH_PATH=\"$(pkgdatadir)\" \
+AM_CXXFLAGS = -DHAVE_REVISION -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@  
-DWESNOTH_PATH=\"$(pkgdatadir)\" \
        -DLOCALEDIR=\"$(LOCALEDIR)\" 
-DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR) -DFIFODIR=\"$(fifodir)\"
 
-AM_CFLAGS = -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ 
-DWESNOTH_PATH=\"$(pkgdatadir)\" \
+AM_CFLAGS = -DHAVE_REVISION -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ 
-DWESNOTH_PATH=\"$(pkgdatadir)\" \
        -DLOCALEDIR=\"$(LOCALEDIR)\" 
-DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR)
 
 if PYTHON

Modified: trunk/src/game_config.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_config.cpp?rev=25179&r1=25178&r2=25179&view=diff
==============================================================================
--- trunk/src/game_config.cpp (original)
+++ trunk/src/game_config.cpp Thu Mar 27 09:37:20 2008
@@ -21,6 +21,9 @@
 #include "util.hpp"
 #include "serialization/string_utils.hpp"
 #include "wesconfig.h"
+#ifdef HAVE_REVISION
+#include "revision.hpp"
+#endif /* HAVE_REVISION */
 
 #include <cstdlib>
 #include <sstream>
@@ -40,8 +43,8 @@
        const int gold_carryover_percentage = 80;
        const bool gold_carryover_add = false;
        const std::string version = VERSION;
-#ifdef SVNREV
-       const std::string revision = VERSION " (" SVNREV ")";
+#ifdef REVISION
+       const std::string revision = VERSION " (" REVISION ")";
 #else
        const std::string revision = VERSION;
 #endif




Related Messages


Powered by MHonArc, Updated Thu Mar 27 11:04:15 2008