[Spice-devel] [PATCH spice 4/4] build-sys: generate spice-version.h

Marc-André Lureau marcandre.lureau at gmail.com
Fri Oct 24 08:54:07 PDT 2014


Editing the hexadecimal value of spice-version and keeping it in sync
with actual release is a bit tedious. Let's generate it
automatically (although handling of bumps will need temporarily static
versions, when 0.12 -> 1.0 for example)
---
 configure.ac              | 11 +++++++++++
 server/spice-version.h    | 27 ---------------------------
 server/spice-version.h.in | 27 +++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 27 deletions(-)
 delete mode 100644 server/spice-version.h
 create mode 100644 server/spice-version.h.in

diff --git a/configure.ac b/configure.ac
index cedeb40..615b31c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,16 @@ m4_define([SPICE_AGE], [9])
 AC_INIT(spice, [m4_esyscmd(build-aux/git-version-gen .tarball-version)],
         [spice-devel at lists.freedesktop.org], spice)
 
+major=`echo $PACKAGE_VERSION | cut -d. -f1`
+minor=`echo $PACKAGE_VERSION | cut -d. -f2`
+micro=`echo $PACKAGE_VERSION | cut -d. -f3`
+git=`echo $PACKAGE_VERSION | cut -d. -f4`
+if test "$git" != x ; then
+    micro=$(($micro+1))
+fi
+SPICE_SERVER_VERSION=`printf "0x%02x%02x%02x" $major $minor $micro`
+AC_SUBST(SPICE_SERVER_VERSION)
+
 AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_AUX_DIR(.)
@@ -506,6 +516,7 @@ AC_OUTPUT([
 Makefile
 spice-server.pc
 server/Makefile
+server/spice-version.h
 server/tests/Makefile
 client/Makefile
 docs/Makefile
diff --git a/server/spice-version.h b/server/spice-version.h
deleted file mode 100644
index 340c365..0000000
--- a/server/spice-version.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Copyright (C) 2009-2014 Red Hat, Inc.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library 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
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef SPICE_VERSION_H_
-#define SPICE_VERSION_H_
-
-#if !defined(SPICE_H_INSIDE) && !defined(SPICE_COMPILATION)
-#error "Only spice.h can be included directly."
-#endif
-
-#define SPICE_SERVER_VERSION 0x000c06 /* release 0.12.6 */
-
-#endif /* SPICE_VERSION_H_ */
diff --git a/server/spice-version.h.in b/server/spice-version.h.in
new file mode 100644
index 0000000..fcd0fa1
--- /dev/null
+++ b/server/spice-version.h.in
@@ -0,0 +1,27 @@
+/*
+ *  Copyright (C) 2009-2014 Red Hat, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SPICE_VERSION_H_
+#define SPICE_VERSION_H_
+
+#if !defined(SPICE_H_INSIDE) && !defined(SPICE_COMPILATION)
+#error "Only spice.h can be included directly."
+#endif
+
+#define SPICE_SERVER_VERSION @SPICE_SERVER_VERSION@
+
+#endif /* SPICE_VERSION_H_ */
-- 
1.9.3



More information about the Spice-devel mailing list