summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-11-13 16:48:17 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-11-13 16:48:17 (GMT)
commita37a5856371a357583a7ee9e9d05b945eba555f1 (patch)
treeb3bf5265a2f2b108df51d7f23abd3873b1ec691d /configure
parentf9312515e4a93dda33475377fb9800c4b9102324 (diff)
configure: add support for helper script to compute version string
Some projects are using (or planning to use) crosstool-NG, and are storing it in their VCS, which might not be Mercurial. At the same time, those projects may want to track development snapshots versions the way we do with the Hg identity string (hg id). Provide a way for these project to do so, without having to patch ./configure, and maintain that patch over-and-over again. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure44
1 files changed, 29 insertions, 15 deletions
diff --git a/configure b/configure
index 6a68b38..76194b9 100755
--- a/configure
+++ b/configure
@@ -536,21 +536,35 @@ has_or_abort lib="${ncurses_libs}" \
# If this version is n hg clone, try to get the revision number
# If we can't get the revision number, use date
printf "\nComputing version string... "
-case "${VERSION}" in
- *+hg|hg)
- REVISION="$( hg id -n 2>/dev/null || true )"
- case "${REVISION}" in
- "")
- VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
- *)
- VERSION="${VERSION}_$( hg id -b )@${REVISION%%+}_$( hg id -i )"
- ;;
- esac
- # Arrange to have no / in the directory name, no need to create an
- # arbitrarily deep directory structure
- VERSION="$( printf "${VERSION}\n" |"${sed}" -r -e 's|/+|_|g;' )"
- ;;
-esac
+
+# Pass the version to the version helper script, if present, to compute
+# a local version string, if needed.
+if [ -f version.sh -a -x version.sh ]; then
+ V="$( ./version.sh "${VERSION}" 2>/dev/null |head -n 1 )"
+fi
+
+# If the script returns an empty string, revert to using the version
+# we just computed, above.
+if [ -n "${V}" ]; then
+ VERSION="${V}"
+else
+ case "${VERSION}" in
+ *+hg|hg)
+ REVISION="$( hg id -n 2>/dev/null || true )"
+ case "${REVISION}" in
+ "")
+ VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
+ *)
+ VERSION="${VERSION}_$( hg id -b )@${REVISION%%+}_$( hg id -i )"
+ ;;
+ esac
+ # Arrange to have no / in the directory name, no need to create an
+ # arbitrarily deep directory structure
+ VERSION="$( printf "${VERSION}\n" |"${sed}" -r -e 's|/+|_|g;' )"
+ ;;
+ esac
+fi
+
printf "${VERSION}\n"
#---------------------------------------------------------------------