Skip to content

Commit 2df5e34

Browse files
committed
Fix build time when building from tarball (now really)
Don't define BUILD_DATE at all when no git version information is available. `version.cpp` will then define it for us correctly to the last commit date. This has been fixed and broken many times over 0.9 history (21cc8bd, ef1e984), please don't touch this code unless you plan on testing all possible scenarios including gitian builds. Fixes #3570.
1 parent 39d4eee commit 2df5e34

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

share/genbuild.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ else
1313
exit 1
1414
fi
1515

16-
TIME=$(date '+%F %T %z')
17-
16+
DESC=""
17+
LAST_COMMIT_DATE=""
1818
if [ -e "$(which git)" -a -d ".git" ]; then
1919
# clean 'dirty' status of touched files that haven't been modified
2020
git diff >/dev/null 2>/dev/null
@@ -23,7 +23,7 @@ if [ -e "$(which git)" -a -d ".git" ]; then
2323
DESC="$(git describe --dirty 2>/dev/null)"
2424

2525
# get a string like "2012-04-10 16:27:19 +0200"
26-
TIME="$(git log -n 1 --format="%ci")"
26+
LAST_COMMIT_DATE="$(git log -n 1 --format="%ci")"
2727
fi
2828

2929
if [ -n "$DESC" ]; then
@@ -35,5 +35,7 @@ fi
3535
# only update build.h if necessary
3636
if [ "$INFO" != "$NEWINFO" ]; then
3737
echo "$NEWINFO" >"$FILE"
38-
echo "#define BUILD_DATE \"$TIME\"" >>"$FILE"
38+
if [ -n "$LAST_COMMIT_DATE" ]; then
39+
echo "#define BUILD_DATE \"$LAST_COMMIT_DATE\"" >> "$FILE"
40+
fi
3941
fi

0 commit comments

Comments
 (0)