Skip to content

Commit

Permalink
Merge pull request #219 from yangfl/master
Browse files Browse the repository at this point in the history
configure: Use determistic timestamp from SOURCE_DATE_EPOCH if availa…
  • Loading branch information
waruqi committed Aug 8, 2023
2 parents 3f6eae2 + 38e3f9c commit 2e0cac8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,16 @@ _os_find() {
}

# get date, "%Y%m%d%H%M" -> 202212072222
# Use deterministic timestamp from SOURCE_DATE_EPOCH if available
# https://reproducible-builds.org/docs/source-date-epoch/
_os_date() {
_ret=$(date +"${1}")
if test_z "${SOURCE_DATE_EPOCH}"; then
_ret=$(date +"${1}")
elif is_host "macosx"; then
_ret=$(date -u -r "$SOURCE_DATE_EPOCH" +"${1}")
else
_ret=$(date -u -d "@$SOURCE_DATE_EPOCH" +"${1}")
fi
}

# we avoid use `basename`, because it's slow
Expand Down

0 comments on commit 2e0cac8

Please sign in to comment.