git-version-gen: Honor GIT_DESCRIBE_FOR_BUILD environment variable

The GNOME-OSTree build system currently creates chroots and bind
mounts to the source tree outside the root; this means that we can't
necessarily run git inside the root, because in the case of git
submodules, the .git repository will point to outside root.

Also, error out fatally if we fail to determine the version; it
makes no sense to put UNKNOWN in e.g. the pkg-config files
since this will just cause errors later on.
This commit is contained in:
Colin Walters 2012-09-25 19:26:18 -04:00 committed by Tanu Kaskinen
parent bf0a640cfd
commit f16a532e88
2 changed files with 16 additions and 2 deletions

View file

@ -28,6 +28,10 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules color-tests dist-xz tar-ustar])
AS_IF([! test -n "$VERSION"], [
AC_MSG_ERROR([git-version-gen failed])
])
m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)