[Groonga-commit] groonga/grnxx [master] Update the version string automatically.

Back to archive index

susumu.yata null+****@clear*****
Fri Dec 14 16:02:00 JST 2012


susumu.yata	2012-12-14 16:02:00 +0900 (Fri, 14 Dec 2012)

  New Revision: 280a27c166a40acb88a1bd7456502183fdb04e85
  https://github.com/groonga/grnxx/commit/280a27c166a40acb88a1bd7456502183fdb04e85

  Log:
    Update the version string automatically.

  Added files:
    lib/version.h
    lib/version.sh
  Modified files:
    .gitignore
    configure.ac
    lib/Makefile.am
    lib/grnxx.cpp

  Modified: .gitignore (+1 -0)
===================================================================
--- .gitignore    2012-12-13 18:21:10 +0900 (b11f314)
+++ .gitignore    2012-12-14 16:02:00 +0900 (b01d006)
@@ -20,6 +20,7 @@ config.*
 configure
 depcomp
 install-sh
+lib/version.h
 libtool
 ltmain.sh
 missing

  Modified: configure.ac (+1 -1)
===================================================================
--- configure.ac    2012-12-13 18:21:10 +0900 (301405b)
+++ configure.ac    2012-12-14 16:02:00 +0900 (01ec0f6)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.67])
-AC_INIT([grnxx], [0.0.0], [groonga �� razil.jp])
+AC_INIT([grnxx], [pre-alpha], [groonga �� razil.jp])
 AC_CONFIG_SRCDIR([lib/grnxx.hpp])
 AC_CONFIG_HEADERS(config.h)
 AM_INIT_AUTOMAKE

  Modified: lib/Makefile.am (+11 -1)
===================================================================
--- lib/Makefile.am    2012-12-13 18:21:10 +0900 (442412d)
+++ lib/Makefile.am    2012-12-14 16:02:00 +0900 (83031aa)
@@ -41,4 +41,14 @@ libgrnxx_include_HEADERS =	\
 	string_builder.hpp	\
 	string_format.hpp	\
 	thread.hpp		\
-	time.hpp
+	time.hpp		\
+	version.h
+
+EXTRA_DIST = version.sh
+
+.PHONY: FORCE
+
+FORCE:
+
+version.h: FORCE
+	@$(SHELL_PATH) $(srcdir)/version.sh

  Modified: lib/grnxx.cpp (+5 -0)
===================================================================
--- lib/grnxx.cpp    2012-12-13 18:21:10 +0900 (dd03a13)
+++ lib/grnxx.cpp    2012-12-14 16:02:00 +0900 (6659a1e)
@@ -18,6 +18,7 @@
 #include "grnxx.hpp"
 
 #include "../config.h"
+#include "version.h"
 
 namespace grnxx {
 
@@ -26,7 +27,11 @@ const char *Grnxx::bugreport() {
 }
 
 const char *Grnxx::version() {
+#ifdef GRNXX_VERSION
+  return GRNXX_VERSION;
+#else  // GRNXX_VERSION
   return PACKAGE_VERSION;
+#endif  // GRNXX_VERSION
 }
 
 }  // namespace grnxx

  Added: lib/version.h (+0 -0) 100644
===================================================================
--- /dev/null
+++ lib/version.h    2012-12-14 16:02:00 +0900 (e69de29)

  Added: lib/version.sh (+23 -0) 100755
===================================================================
--- /dev/null
+++ lib/version.sh    2012-12-14 16:02:00 +0900 (d49acc8)
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+GRNXX_VERSION_HEADER=version.h
+
+if [ -d "../.git" -o -f "../.git" ]
+then
+  GRNXX_CURRENT_VERSION=`git describe --abbrev=7 HEAD 2>/dev/null`
+  GRNXX_CURRENT_VERSION=`expr "${GRNXX_CURRENT_VERSION}" : v*'\(.*\)'`
+
+  if [ -r ${GRNXX_VERSION_HEADER} ]
+  then
+    GRNXX_OLD_VERSION=`grep '^#define GRNXX_VERSION ' ${GRNXX_VERSION_HEADER} |\
+                       sed -e 's/^#define GRNXX_VERSION "\(.*\)"/\1/'`
+  else
+    GRNXX_OLD_VERSION=unset
+  fi
+
+  if [ "${GRNXX_OLD_VERSION}" != "${GRNXX_CURRENT_VERSION}" ]
+  then
+    echo "#define GRNXX_VERSION \"${GRNXX_CURRENT_VERSION}\""\
+         >${GRNXX_VERSION_HEADER}
+  fi
+fi
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index