[Git][reproducible-builds/reproducible-website][master] Add configure.ac / GNU Autotools example for using SOURCE_DATE_EPOCH.
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Tue Apr 29 21:10:01 UTC 2025
Chris Lamb pushed to branch master at Reproducible Builds / reproducible-website
Commits:
54b010d0 by Chris Lamb at 2025-04-29T14:09:36-07:00
Add configure.ac / GNU Autotools example for using SOURCE_DATE_EPOCH.
- - - - -
1 changed file:
- _docs/source-date-epoch.md
Changes:
=====================================
_docs/source-date-epoch.md
=====================================
@@ -99,6 +99,24 @@ endif
The above will work with either GNU or BSD date, and fallback to ignore `SOURCE_DATE_EPOCH` if both fails.
+### GNU Autotools / `configure.ac`
+
+```make
+BUILD_DATE=m4_esyscmd([date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" %Y-%m-%d])
+AC_SUBST(BUILD_DATE)
+```
+
+or:
+
+```make
+DATE_FMT="%Y-%m-%d"
+BUILD_DATE=`date $DATE_FMT`
+if test "x$SOURCE_DATE_EPOCH" != "x"; then
+ BUILD_DATE=`date -u -d "@$SOURCE_DATE_EPOCH" $DATE_FMT 2>/dev/null || date -u -r $SOURCE_DATE_EPOCH $DATE_FMT || date -u $DATE_FMT`
+fi
+AC_SUBST(BUILD_DATE)
+```
+
### CMake
```cmake
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/54b010d0cdde8b5d27c7132a9d39f35ca59412da
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/54b010d0cdde8b5d27c7132a9d39f35ca59412da
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20250429/6004aa19/attachment.htm>
More information about the rb-commits
mailing list