From: Brian Gottreu Date: Tue, 23 Jun 2015 01:15:39 +0000 (-0500) Subject: Fix version date for Mac OSX and FreeBSD X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~109^2~8^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=979ab346c4c550404c0e1b5320142a5b0eb8ffcd;p=graphviz Fix version date for Mac OSX and FreeBSD --- diff --git a/autogen.sh b/autogen.sh index 36d25385a..78f2b63d5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,9 +1,20 @@ #! /bin/sh -GRAPHVIZ_VERSION_DATE=$( git log -n 1 --format=%ct ) +GRAPHVIZ_GIT_DATE=$( git log -n 1 --format=%ci ) + if test $? -eq 0; then - GRAPHVIZ_VERSION_DATE=$( date -u +%Y%m%d.%H%M -d @$GRAPHVIZ_VERSION_DATE ) - echo "Version date is based on time of last commit: $GRAPHVIZ_VERSION_DATE" + GRAPHVIZ_VERSION_DATE=$( date -u +%Y%m%d.%H%M -d "$GRAPHVIZ_GIT_DATE" 2>/dev/null ) + if test $? -ne 0; then + # try date with FreeBSD syntax + GRAPHVIZ_VERSION_DATE=$( date -u -j -f "%Y-%m-%d %H:%M:%S %z" "$GRAPHVIZ_GIT_DATE" +%Y%m%d.%H%M ) + if test $? -ne 0; then + echo "Warning: we do not know how to invoke date correctly." >$2 + else + echo "Version date is based on time of last commit: $GRAPHVIZ_VERSION_DATE" + fi + else + echo "Version date is based on time of last commit: $GRAPHVIZ_VERSION_DATE" + fi else GRAPHVIZ_VERSION_DATE="0" echo "Warning: we do not appear to be running in a git clone." >$2