diff options
| -rw-r--r-- | doc/local.mk | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/doc/local.mk b/doc/local.mk index a653a324200..6a6864a7f0e 100644 --- a/doc/local.mk +++ b/doc/local.mk | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org> | 6 | # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org> |
| 7 | # Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu> | 7 | # Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu> |
| 8 | # Copyright © 2019 Timothy Sample <samplet@ngyro.com> | 8 | # Copyright © 2019 Timothy Sample <samplet@ngyro.com> |
| 9 | # Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org> | ||
| 9 | # | 10 | # |
| 10 | # This file is part of GNU Guix. | 11 | # This file is part of GNU Guix. |
| 11 | # | 12 | # |
| @@ -254,22 +255,34 @@ endif | |||
| 254 | 255 | ||
| 255 | # Reproducible tarball | 256 | # Reproducible tarball |
| 256 | 257 | ||
| 257 | # Generate 'version.texi' reproducibly using metadata from Git rather than | 258 | # Define a rule to build `version[LANG].texi' reproducibly using metadata from |
| 258 | # using metadata from the filesystem. This is expected to generate warnings: | 259 | # Git rather than using metadata from the filesystem. |
| 260 | define version.texi-from-git | ||
| 261 | $(srcdir)/doc/stamp-$(1): $(srcdir)/$(2) $(top_srcdir)/configure | ||
| 262 | $$(AM_V_GEN)set -e; \ | ||
| 263 | export LANG=C LANGUAGE=C LC_ALL=C LC_TIME=C; \ | ||
| 264 | export TZ=UTC0; \ | ||
| 265 | timestamp="$$$$(git log --pretty=format:%ct -n1 -- "$$<" \ | ||
| 266 | 2>/dev/null \ | ||
| 267 | || echo $$(SOURCE_DATE_EPOCH))" \ | ||
| 268 | dmy=$$$$(date --date="@$$$$timestamp" "+%-d %B %Y"); \ | ||
| 269 | my=$$$$(date --date="@$$$$timestamp" "+%B %Y"); \ | ||
| 270 | { echo "@set UPDATED $$$$dmy"; \ | ||
| 271 | echo "@set UPDATED-MONTH $$$$my"; \ | ||
| 272 | echo "@set EDITION $$$(VERSION)"; \ | ||
| 273 | echo "@set VERSION $$$(VERSION)"; } > "$$@-t"; \ | ||
| 274 | mv "$$@-t" "$$@"; \ | ||
| 275 | cp -p "$$@" "$$(srcdir)/doc/version$(3).texi" | ||
| 276 | endef | ||
| 277 | |||
| 278 | # Generate rules for stamp-vti and stamp-N that create version.texi and | ||
| 279 | # version-LANG.texi to override the Autotools versions that use timestamps | ||
| 280 | # embedded in the file-system. These are expected to generate warnings: | ||
| 259 | # | 281 | # |
| 260 | # Makefile:7376: warning: overriding recipe for target 'doc/stamp-vti' | 282 | # Makefile:7376: warning: overriding recipe for target 'doc/stamp-vti' |
| 261 | # Makefile:5098: warning: ignoring old recipe for target 'doc/stamp-vti' | 283 | # Makefile:5098: warning: ignoring old recipe for target 'doc/stamp-vti' |
| 262 | $(srcdir)/doc/stamp-vti: $(srcdir)/doc/guix.texi $(top_srcdir)/configure | 284 | i:=0 |
| 263 | $$(AM_V_GEN)set -e; \ | 285 | $(eval $(call version.texi-from-git,vti,doc/guix.texi,)) |
| 264 | export LANG=C LANGUAGE=C LC_ALL=C LC_TIME=C; \ | 286 | $(foreach lang, $(MANUAL_LANGUAGES), \ |
| 265 | export TZ=UTC0; \ | 287 | $(eval i=$(shell echo $$(($(i)+1)))) \ |
| 266 | timestamp=$$(git log --pretty=format:%ct -n1 -- $< 2>/dev/null \ | 288 | $(eval $(call version.texi-from-git,$(i),po/doc/guix-manual.$(lang).po,-$(lang)))) |
| 267 | || echo $(SOURCE_DATE_EPOCH)) \ | ||
| 268 | dmy=$$(date --date="@$$timestamp" "+%-d %B %Y"); \ | ||
| 269 | my=$$(date --date="@$$timestamp" "+%B %Y"); \ | ||
| 270 | { echo "@set UPDATED $$dmy"; \ | ||
| 271 | echo "@set UPDATED-MONTH $$my"; \ | ||
| 272 | echo "@set EDITION $(VERSION)"; \ | ||
| 273 | echo "@set VERSION $(VERSION)"; } > $@-t; \ | ||
| 274 | mv $@-t $@; \ | ||
| 275 | cp $@ $(srcdir)/doc/version.texi | ||
