2012-12-31 Peter Rosin <peda@lysator.liu.se> (tiny change)
+ git-version-gen: add --fallback option to use if git is not present
+ * build-aux/git-version-gen: Add support for the new option --fallback,
+ which comes into play when there is no $tarball_version_file and
+ git is not working.
+ (scriptversion): Update.
+
maint.mk: handle missing git with more grace
* top/maint.mk (no-submodule-changes, public-submodule-commit):
Quietly proceed if git is not present.
#!/bin/sh
# Print a version string.
-scriptversion=2012-03-18.17; # UTC
+scriptversion=2012-12-31.22; # UTC
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
#
Options:
--prefix prefix of git tags (default 'v')
+ --fallback fallback version to use if \"git --version\" fails
--help display this help and exit
--version output version information and exit
Running without arguments will suffice in most cases."
prefix=v
+fallback=
while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
--prefix) shift; prefix="$1";;
+ --fallback) shift; fallback="$1";;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
# Remove the "g" in git describe's output string, to save a byte.
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
v_from_git=1
-else
+elif test -z "$fallback" || git --version >/dev/null 2>&1; then
v=UNKNOWN
+else
+ v=$fallback
fi
v=`echo "$v" |sed "s/^$prefix//"`