build-sys: generate spice-version.h

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)
This commit is contained in:
Marc-André Lureau 2014-10-24 17:46:31 +02:00
parent 6f798ba1f7
commit ab12cf414c
2 changed files with 12 additions and 1 deletions

View File

@ -18,6 +18,16 @@ m4_define([SPICE_AGE], [9])
AC_INIT(spice, [m4_esyscmd(build-aux/git-version-gen .tarball-version)],
[spice-devel@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 x"$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(.)
@ -510,6 +520,7 @@ AC_OUTPUT([
Makefile
spice-server.pc
server/Makefile
server/spice-version.h
server/tests/Makefile
client/Makefile
docs/Makefile

View File

@ -22,6 +22,6 @@
#error "Only spice.h can be included directly."
#endif
#define SPICE_SERVER_VERSION 0x000c06 /* release 0.12.6 */
#define SPICE_SERVER_VERSION @SPICE_SERVER_VERSION@
#endif /* SPICE_VERSION_H_ */