From 274bb6fc22f8e0bfe521305d5e67eee268cabf7f Mon Sep 17 00:00:00 2001 From: Nathan Rossi Date: Fri, 30 Dec 2016 18:02:26 +1000 Subject: [PATCH] configure.ac: Set 'mym4_revision' to 0 if not a git repo --- It is possible for the source to not be located in a git repository (e.g. source is from a tarball). In which case the git repository information is not available. This results in the mym4_revision being an empty string however this value is used in BUILD_FILEVERSION where it is assumed to be 4 decimal values. Additionally BUILD_REVISION uses this value and is also assumed to be non-empty. In the case of BUILD_FILEVERSION it is used in versioninfo.rc.in, where it must be populated as 4 decimal values due to the expected syntax. In cases where it is not (e.g. when BUILD_FILEVERSION = '1,26,0,' a syntax error is raised. windres: versioninfo.rc.in:21: syntax error This patch changes mym4_revision so that if the 'git rev-parse' returns non-zero (e.g. not in a git repository) the value falls back to '0'. This propagates as '0' to both BUILD_FILEVERSION and BUILD_REVISION. Signed-off-by: Nathan Rossi Upstream-Status: Submitted --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6d4f173d1b..149ac02b5f 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,7 @@ m4_define([mym4_version_minor], [27]) # processing is done by autoconf and not during the configure run. m4_define([mym4_version], [mym4_version_major.mym4_version_minor]) m4_define([mym4_revision], - m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r'])) + m4_esyscmd([(git rev-parse --short HEAD || printf '0') | tr -d '\n\r'])) m4_define([mym4_revision_dec], m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))])) m4_define([mym4_betastring], -- 2.11.0