Description: Allow one to override git version with variable PKG_VERSION
 During configuration, src/version.in is used as a template to create
 version.ads. If it detects being compiled from a git repository, it will
 replace the string "tarball" with git --describe output.
 .
 Allow one to override this with the contents of an environment variable. If
 PKG_VERSION is specified, it is unconditionally used, otherwise the previous
 detection takes place. Replace the string "tarball" in the template with
 "@ORIGIN@" to simplify the sed commands.
Author: Andreas Bombe <aeb@debian.org>
Last-Update: 2018-01-12
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: git/Makefile.in
===================================================================
--- git.orig/Makefile.in	2021-01-29 02:12:01.647635709 +0100
+++ git/Makefile.in	2021-01-29 02:12:01.647635709 +0100
@@ -160,14 +160,16 @@
 include $(srcdir)/src/grt/Makefile.inc
 
 version.tmp: $(srcdir)/src/version.in force
-#	Create version.tmp from version.in, using git date/hash
-	if test -d $(srcdir)/.git \
+#	Create version.tmp from version.in, substituting @VER@ and @ORIGIN@ with suitable values
+	if [ -n "$(PKG_VERSION)" ]; then \
+	  sub="$(PKG_VERSION)"; \
+	elif test -d $(srcdir)/.git \
 	   && desc=`cd $(srcdir); git describe --dirty`; then \
-          sub="s/[(].*[)]/($$desc)/"; \
+	   sub="$$desc"; \
 	else \
-	  sub="s/tarball/tarball/"; \
+	  sub="tarball"; \
         fi; \
-	$(SED) -e "$$sub" -e "s/@VER@/$(ghdl_version)/" < $< > $@; \
+	$(SED) -e "s,@ORIGIN@,$$sub," -e "s/@VER@/$(ghdl_version)/" < $< > $@; \
 
 version.ads: version.tmp
 #	Change version.ads only if version.tmp has been modified to avoid
Index: git/src/version.in
===================================================================
--- git.orig/src/version.in	2021-01-29 02:12:01.647635709 +0100
+++ git/src/version.in	2021-01-29 02:12:01.647635709 +0100
@@ -1,5 +1,5 @@
 package Version is
    Ghdl_Ver : constant String := "@VER@";
    Ghdl_Release : constant String :=
-      "(tarball) [Dunoon edition]";
+      "(@ORIGIN@) [Dunoon edition]";
 end Version;
