Description: Allow overriding version description
 Makefile.in has provisions to allow setting the version description, ref and
 hash values through environment variables. However, if it detects the source
 directory being a git repository, it will overwrite these values again. This
 patch changes it to always override the default or autodetected values when the
 environment variables are available.
Author: Andreas Bombe <aeb@debian.org>
Applied-Upstream: https://github.com/ghdl/ghdl/commit/5ae1ab81b54e0a065c9a309e64dc8f790ea94b2c
Last-Update: 2021-10-31
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/Makefile.in
+++ b/Makefile.in
@@ -162,14 +162,17 @@
 
 version.tmp: $(srcdir)/src/version.in force
 #	Create version.tmp from version.in, using git date/hash, or envvars.
-	GHDL_VER_DESC=$${GHDL_VER_DESC:-tarball}; \
-	GHDL_VER_REF=$${GHDL_VER_REF:-unknown}; \
-	GHDL_VER_HASH=$${GHDL_VER_HASH:-unknown}; \
+	GHDL_AUTO_VER_DESC=tarball; \
+	GHDL_AUTO_VER_REF=unknown; \
+	GHDL_AUTO_VER_HASH=unknown; \
 	if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty --long`; then \
-	  GHDL_VER_DESC=`echo $$desc | sed -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g' -e 's/^v//g'`; \
-	  GHDL_VER_REF=`cd $(srcdir); git rev-parse --abbrev-ref HEAD`; \
-	  GHDL_VER_HASH=`cd $(srcdir); git rev-parse HEAD`; \
+	  GHDL_AUTO_VER_DESC=`echo $$desc | sed -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g' -e 's/^v//g'`; \
+	  GHDL_AUTO_VER_REF=`cd $(srcdir); git rev-parse --abbrev-ref HEAD`; \
+	  GHDL_AUTO_VER_HASH=`cd $(srcdir); git rev-parse HEAD`; \
 	fi; \
+	GHDL_VER_DESC=$${GHDL_VER_DESC:-$$GHDL_AUTO_VER_DESC}; \
+	GHDL_VER_REF=$${GHDL_VER_REF:-$$GHDL_AUTO_VER_REF}; \
+	GHDL_VER_HASH=$${GHDL_VER_HASH:-$$GHDL_AUTO_VER_HASH}; \
 	sed \
 	  -e "s#@VER@#$(ghdl_version)#" \
 	  -e "s#@DESC@#$${GHDL_VER_DESC}#" \
