[Spice-devel] [vdagent-win PATCH 3/4] build: Automatically update version/copyright in version.rc

Frediano Ziglio fziglio at redhat.com
Thu Nov 17 12:15:03 UTC 2016


The versions/copyright in version.rc are very outdated.
Updating them automatically at configure time should ensure they are
updated more often.
Looks a bit weird to distribute config.h file however in this
case it contain only version information and the file is
useful to compile under Windows.

This patch is inspired by a work of Christophe Fergeau

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 Makefile.am       |  1 +
 common/version.rc | 12 +++++++-----
 configure.ac      |  6 ++++++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 92e51e9..3962c3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -87,6 +87,7 @@ CLEANFILES = spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
 
 EXTRA_DIST +=			\
 	$(top_srcdir)/.version	\
+	config.h		\
 	common/version.rc	\
 	tests/clipboard.py	\
 	vdagent.sln		\
diff --git a/common/version.rc b/common/version.rc
index e78a7ef..2603dce 100644
--- a/common/version.rc
+++ b/common/version.rc
@@ -1,6 +1,8 @@
 /////////////////////////////////////////////////////////////////////////////
 // English (U.S.) resources
 
+#include "../config.h"
+
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -13,8 +15,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,5,1,0
- PRODUCTVERSION 0,5,1,0
+ FILEVERSION RC_PRODUCTVERSION
+ PRODUCTVERSION RC_PRODUCTVERSION
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -31,12 +33,12 @@ BEGIN
         BEGIN
             VALUE "CompanyName", "Red Hat Inc."
             VALUE "FileDescription", FILE_DESCRIPTION
-            VALUE "FileVersion", "0, 5, 1, 0"
+            VALUE "FileVersion", RC_PRODUCTVERSION_STR
             VALUE "InternalName", INTERNAL_NAME
-            VALUE "LegalCopyright", "Copyright (c) 2009  Red Hat Inc. and/or its affiliates"
+            VALUE "LegalCopyright", "Copyright (c) 2009-" BUILD_YEAR "  Red Hat Inc. and/or its affiliates"
             VALUE "OriginalFilename", ORIGINAL_FILENAME
             VALUE "ProductName", "Red Hat Spice"
-            VALUE "ProductVersion", "0, 5, 1, 0"
+            VALUE "ProductVersion", RC_PRODUCTVERSION_STR
         END
     END
     BLOCK "VarFileInfo"
diff --git a/configure.ac b/configure.ac
index 7f6511d..4f409fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,12 @@ fi
 build=`expr $micro \* 256 + $buildid`
 WINDOWS_PRODUCTVERSION="$major.$minor.$build"
 AC_SUBST([WINDOWS_PRODUCTVERSION])
+microdigit=`echo $micro | cut -d- -f1`
+RC_PRODUCTVERSION="$major, $minor, $microdigit, 0"
+AC_DEFINE_UNQUOTED([RC_PRODUCTVERSION_STR], "$RC_PRODUCTVERSION", [Resource product version])
+AC_DEFINE_UNQUOTED([RC_PRODUCTVERSION], [$RC_PRODUCTVERSION], [Resource product version])
+BUILD_YEAR=`date +%Y`
+AC_DEFINE_UNQUOTED([BUILD_YEAR], "$BUILD_YEAR", [Build year])
 
 # Check for programs
 AC_PROG_CC
-- 
2.7.4



More information about the Spice-devel mailing list