bsd-date.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 377dc5d0beb68cb89405f17e5045a5893ffe5b08 Mon Sep 17 00:00:00 2001
  2. From: Daniel Kolesa <daniel@octaforge.org>
  3. Date: Sat, 9 Apr 2022 19:39:08 +0200
  4. Subject: [PATCH] fix up timestamp stuff for BSD date
  5. ---
  6. Makefile | 21 ++++-----------------
  7. 1 file changed, 4 insertions(+), 17 deletions(-)
  8. diff --git a/Makefile b/Makefile
  9. index ad83d60d..31e4c4e2 100644
  10. --- a/Makefile
  11. +++ b/Makefile
  12. @@ -1969,25 +1969,12 @@ define filechk_version.h
  13. echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
  14. endef
  15. -# The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date.
  16. -# The BSD date on the other hand behaves different and would produce errors
  17. -# with the misused '-d' switch. Respect that and search a working date with
  18. -# well known pre- and suffixes for the GNU variant of date.
  19. define filechk_timestamp.h
  20. (if test -n "$${SOURCE_DATE_EPOCH}"; then \
  21. - SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \
  22. - DATE=""; \
  23. - for date in gdate date.gnu date; do \
  24. - $${date} -u -d "$${SOURCE_DATE}" >/dev/null 2>&1 && DATE="$${date}"; \
  25. - done; \
  26. - if test -n "$${DATE}"; then \
  27. - LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
  28. - LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \
  29. - LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \
  30. - LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_EPOCH %s'; \
  31. - else \
  32. - return 42; \
  33. - fi; \
  34. + LC_ALL=C date -j -r "$${SOURCE_DATE_EPOCH}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
  35. + LC_ALL=C date -j -r "$${SOURCE_DATE_EPOCH}" +'#define U_BOOT_TIME "%T"'; \
  36. + LC_ALL=C date -j -r "$${SOURCE_DATE_EPOCH}" +'#define U_BOOT_TZ "%z"'; \
  37. + LC_ALL=C date -j -r "$${SOURCE_DATE_EPOCH}" +'#define U_BOOT_EPOCH %s'; \
  38. else \
  39. LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \
  40. LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \
  41. --
  42. 2.35.1