Bug 209908

Summary: sysutils/u-boot-rpi: build relies on GNU date when SOURCE_DATE_EPOCH is set in environment
Product: Ports & Packages Reporter: Ed Maste <emaste>
Component: Individual Port(s)Assignee: freebsd-uboot (Nobody) <uboot>
Status: New ---    
Severity: Affects Only Me CC: manu, w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (manu)
Version: Latest   
Hardware: Any   
OS: Any   

Description Ed Maste freebsd_committer freebsd_triage 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 Walter 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?)