Bug 209908 - sysutils/u-boot-rpi: build relies on GNU date when SOURCE_DATE_EPOCH is set in environment
Summary: sysutils/u-boot-rpi: build relies on GNU date when SOURCE_DATE_EPOCH is set i...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Emmanuel Vadot
Depends on:
Reported: 2016-05-31 17:16 UTC by Ed Maste
Modified: 2018-09-27 23:22 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (manu)


Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2016-05-31 17:16:31 UTC
The SOURCE_DATE_EPOCH[1] environment variable can be used as part of a strategy for reproducible ports builds[2].

Building sysutils/u-boot-rpi without the coreutils package (which provides GNU date installed as gdate) fails with:

  CHK     include/generated/timestamp_autogenerated.h
Makefile:1317: recipe for target 'include/generated/timestamp_autogenerated.h' failed
gmake[1]: *** [include/generated/timestamp_autogenerated.h] Error 42
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/u-boot-rpi/work/u-boot-2016.01'
*** Error code 1

The Makefile notes that GNU date is required if using SOURCE_DATE_EPOCH:

# The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date.  
# The BSD date on the other hand behaves different and would produce errors    
# with the misused '-d' switch.  Respect that and search a working date with   
# well known pre- and suffixes for the GNU variant of date.
define filechk_timestamp.h
        (if test -n "$${SOURCE_DATE_EPOCH}"; then \

The ReproducibleBuilds wiki describes a technique[3] for supporting BSD date, summarized here:

13:11 < mapreri> date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || 
                 date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || 
                 date -u "+$DATE_FMT"

[1] https://reproducible-builds.org/specs/source-date-epoch/
[2] https://reproducible-builds.org/
[3] https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal#Bash_.2F_POSIX_shell
Comment 1 w.schwarzenfeld freebsd_triage 2018-01-14 01:22:58 UTC
Maintainer feedback?
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2018-06-18 22:43:51 UTC
Assign to current maintainer.

(manu: is this PR still relevant?)