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

Christophe Fergeau cfergeau at redhat.com
Thu Nov 17 13:15:55 UTC 2016


Do we want to support VS builds from git as well? If yes, you'll need to
add config.h too.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Thu, Nov 17, 2016 at 01:11:23PM +0000, Frediano Ziglio wrote:
> 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       |  5 +++--
>  common/version.rc | 12 +++++++-----
>  configure.ac      |  6 ++++++
>  3 files changed, 16 insertions(+), 7 deletions(-)
> 
> Changes since v1:
> - fix include directory for out of src tree build.
> 
> diff --git a/Makefile.am b/Makefile.am
> index 92e51e9..b60a718 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -45,7 +45,7 @@ vdagent_SOURCES =			\
>  	$(NULL)
>  
>  vdagent_rc.$(OBJEXT): vdagent/vdagent.rc
> -	$(AM_V_GEN)$(WINDRES) -i $< -o $@
> +	$(AM_V_GEN)$(WINDRES) -I $(top_builddir)/common -i $< -o $@
>  
>  MAINTAINERCLEANFILES += vdagent_rc.$(OBJEXT)
>  
> @@ -60,7 +60,7 @@ vdservice_SOURCES =			\
>  	$(NULL)
>  
>  vdservice_rc.$(OBJEXT): vdservice/vdservice.rc
> -	$(AM_V_GEN)$(WINDRES) -i $< -o $@
> +	$(AM_V_GEN)$(WINDRES) -I $(top_builddir)/common -i $< -o $@
>  
>  MAINTAINERCLEANFILES += vdservice_rc.$(OBJEXT)
>  
> @@ -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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161117/5e96c120/attachment.sig>


More information about the Spice-devel mailing list