diff options
| author | Janneke Nieuwenhuizen <janneke@gnu.org> | 2024-04-17 19:54:05 +0200 |
|---|---|---|
| committer | Janneke Nieuwenhuizen <janneke@gnu.org> | 2024-04-19 16:45:41 +0200 |
| commit | f83b5274c8d67a9bccf8881cc4f87d76a3d172de (patch) | |
| tree | 75b8ca766c6bdebdc4b34d173f1fb7d8e10141bd /build-aux/xgettext.scm | |
| parent | bb089f76227666e11e6949038c4fd9e130e047a3 (diff) | |
maint: Support `make doc-pot-update' from a tarball.
* build-aux/xgettext.scm: Move setting of environment variables to shell
header.
(main): Use SOURCE_DATE_EPOCH as fallback for timestamp. This fixes running
from a tarball.
* Makefile.am (EXTRA_DIST): Add it.
Change-Id: Ic487587b22495868fd2a21545a13dc9e3458299c
Diffstat (limited to 'build-aux/xgettext.scm')
| -rwxr-xr-x | build-aux/xgettext.scm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/build-aux/xgettext.scm b/build-aux/xgettext.scm index 44d30b8149e..7142336a9df 100755 --- a/build-aux/xgettext.scm +++ b/build-aux/xgettext.scm | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | # -*-scheme-*- | 2 | # -*-scheme-*- |
| 3 | build_aux=$(dirname $0) | 3 | build_aux=$(dirname $0) |
| 4 | srcdir=$build_aux/.. | 4 | srcdir=$build_aux/.. |
| 5 | export LC_ALL=en_US.UTF-8 | ||
| 6 | export TZ=UTC0 | ||
| 5 | exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@" | 7 | exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@" |
| 6 | !# | 8 | !# |
| 7 | 9 | ||
| @@ -59,9 +61,6 @@ exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@" | |||
| 59 | ;;; Entry point. | 61 | ;;; Entry point. |
| 60 | ;;; | 62 | ;;; |
| 61 | (define (main args) | 63 | (define (main args) |
| 62 | ;; Cater for being run in a container. | ||
| 63 | (setenv "LC_ALL" "en_US.UTF-8") | ||
| 64 | (setenv "TZ" "UTC0") | ||
| 65 | (fluid-set! %default-port-encoding #f) | 64 | (fluid-set! %default-port-encoding #f) |
| 66 | (let* ((files-from (get-option args "--files-from=")) | 65 | (let* ((files-from (get-option args "--files-from=")) |
| 67 | (default-domain (get-option args "--default-domain=")) | 66 | (default-domain (get-option args "--default-domain=")) |
| @@ -82,9 +81,10 @@ exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@" | |||
| 82 | (files (map (cute string-append directory "/" <>) files)) | 81 | (files (map (cute string-append directory "/" <>) files)) |
| 83 | (git-command `("git" "log" "--pretty=format:%ci" "-n1" ,@files)) | 82 | (git-command `("git" "log" "--pretty=format:%ci" "-n1" ,@files)) |
| 84 | (timestamp (pipe-command git-command)) | 83 | (timestamp (pipe-command git-command)) |
| 84 | (source-date-epoch (or (getenv "SOURCE_DATE_EPOCH") "1")) | ||
| 85 | (timestamp (if (string-null? timestamp) source-date-epoch | ||
| 86 | timestamp)) | ||
| 85 | (po-file (string-append default-domain ".po"))) | 87 | (po-file (string-append default-domain ".po"))) |
| 86 | (when (string-null? timestamp) | ||
| 87 | (exit 1)) | ||
| 88 | (substitute* po-file | 88 | (substitute* po-file |
| 89 | (("(\"POT-Creation-Date: )[^\\]*" all header) | 89 | (("(\"POT-Creation-Date: )[^\\]*" all header) |
| 90 | (string-append header timestamp))))))) | 90 | (string-append header timestamp))))))) |
