<URL: http://bugs.freeciv.org/Ticket/Display.html?id=4712 >

 Since this ticket has last been touched, we have moved from
self-hosted CVS to gna svn.

 Attached patch adds target fc_svnrev_gen.h to common/Makefile. At
this point this file is not used (included) anywhere, and it is not
dependency for anything (it will be built only if explicitly
requested)

 That header contains a couple of macros.
 - First there is either FC_SVNREV_ON or FC_SVNREV_OFF defined.
FC_SVNREV_ON will be defined if source directory is unmodified svn
checkout directory.
 - FC_SVNREV itself contains release string ("r13171") if FC_SVNREV_ON
defined, or some fallback string if FC_SVNREV_OFF is defined.

 I have tested this in my system using number of tricks, but in the
end it cannot be fully tested before it is committed (since changing
build system locally to support this will mean that local system is
not unmodified).
 Plan is to commit this and then to test that it works. Then we can
start using it.


 - ML

diff -Nurd -X.diff_ignore freeciv/bootstrap/fc_svnrev_gen.h.in freeciv/bootstrap/fc_svnrev_gen.h.in
--- freeciv/bootstrap/fc_svnrev_gen.h.in	1970-01-01 02:00:00.000000000 +0200
+++ freeciv/bootstrap/fc_svnrev_gen.h.in	2007-08-14 20:35:28.000000000 +0300
@@ -0,0 +1,28 @@
+/**********************************************************************
+ Freeciv - Copyright (C) 2004 - The Freeciv Project
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+/* common/fc_svnrev_gen.h is automatically generated from
+ * bootstrap/fc_svnrev_gen.h.in. Do not edit fc_svnrev_ge.h, edit
+ * fc_svnrev_gen.h.in */
+
+#ifndef FC__FC_SVNREV_H
+#define FC__FC_SVNREV_H
+
+/* Either FC_SVNREV_OFF or FC_SVNREV_ON macro defined.
+ * If FC_SVNREV_ON is defined, FC_SVNREV contains valid svn revision number
+ * string (currently starting with 'r')
+ * If FC_SVNREV_OFF is defined, FC_SVNREV contains some fallback string */
+#define FC_SVNREV_<SVNREVSTATE>
+#define FC_SVNREV "<SVNREV>"
+
+#endif /* FC__FC_SVNREV_H */
diff -Nurd -X.diff_ignore freeciv/common/Makefile.am freeciv/common/Makefile.am
--- freeciv/common/Makefile.am	2007-08-04 18:38:32.000000000 +0300
+++ freeciv/common/Makefile.am	2007-08-14 20:39:54.000000000 +0300
@@ -91,6 +91,31 @@
 	cd $(srcdir) && ./generate_packets.py
 	touch packets_generate
 
+.PHONY: fc_svnrev_gen.h
+fc_svnrev_gen.h :
+	(REV="" ; REVSTATE="OFF" ; \
+         if which svn && which tail && \
+           test -d $(top_srcdir)/.svn ; then \
+           if test "x$$(cd $(top_srcdir) ; svn diff | tail -n 1)" = "x" ; then \
+            MAXREV=0 ; \
+            REV="$$(cd $(top_srcdir) ; svn ls -v | (while read REVNUM REST ; do if test $$REVNUM -gt $$MAXREV ; then MAXREV=$$REVNUM ; fi ; done ; echo r$$MAXREV ))" ; \
+            fi ; \
+echo "REV: $$REV"; \
+            if test "x$$REV" = "x" ; then \
+              REV="svn" ; \
+            else \
+              REVSTATE="ON" ; \
+            fi ; \
+        else \
+          REV="dist" ; \
+        fi ; \
+        cat $(top_srcdir)/bootstrap/fc_svnrev_gen.h.in | sed -e "s,<SVNREV>,$$REV," -e "s,<SVNREVSTATE>,$$REVSTATE," > fc_svnrev_gen.h.tmp ; \
+	if ! test -f fc_svnrev_gen.h || ! cmp fc_svnrev_gen.h fc_svnrev_gen.h.tmp ; then \
+          mv fc_svnrev_gen.h.tmp fc_svnrev_gen.h ; \
+        else \
+          rm fc_svnrev_gen.h.tmp ; \
+        fi) > /dev/null
+
 #libcivcommon_a_DEPENDENCIES = ../utility/libcivutility.a
 #libcivcommon_a_LIBADD       = ../utility/libcivutility.a
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to