Guix currently builds from the source archive produced by git archive in a location outside of the git tree. This means that share/genbuild.sh will be unable to determine the version number from git because there is no git information available to it during the build. In order for the correct version to be set, share/genbuild.sh will now fallback to GIT_TAG and GIT_COMMIT environment variables if they are set. Guix makes use of this by setting GIT_TAG and GIT_COMMIT before leaving the git tree so that during the build, share/genbuild.sh will create a build.h file containing the correct values for the version string.
Fixes #22623