summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:44:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:44:09 +0000
commit5e707dc6ca775854c09fef2729e0be1d997399a5 (patch)
treee676fd1b87f19e374fb51d8ee2d47742c8c8c02f /debian/patches
parentAdding upstream version 1.23.0. (diff)
downloadgroff-5e707dc6ca775854c09fef2729e0be1d997399a5.tar.xz
groff-5e707dc6ca775854c09fef2729e0be1d997399a5.zip
Adding debian version 1.23.0-3.debian/1.23.0-3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/bash-scripts.patch45
-rw-r--r--debian/patches/doc-default-os-debian.patch41
-rw-r--r--debian/patches/doc-gfdl.patch163
-rw-r--r--debian/patches/doc-gzipped.patch41
-rw-r--r--debian/patches/extratmacdirs.patch33
-rw-r--r--debian/patches/load-desc-failure.patch42
-rw-r--r--debian/patches/man-hyperlinks.patch47
-rw-r--r--debian/patches/mmse-note.patch71
-rw-r--r--debian/patches/nroff-ifs.patch30
-rw-r--r--debian/patches/nroff-map-CW-to-R.patch40
-rw-r--r--debian/patches/papersize-config.patch98
-rw-r--r--debian/patches/series12
-rw-r--r--debian/patches/source-date-epoch-utc.patch468
13 files changed, 1131 insertions, 0 deletions
diff --git a/debian/patches/bash-scripts.patch b/debian/patches/bash-scripts.patch
new file mode 100644
index 0000000..e61c2ec
--- /dev/null
+++ b/debian/patches/bash-scripts.patch
@@ -0,0 +1,45 @@
+From e3d8901a5e24e11e1fa8a80329309295a20eb47f Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:09 +0000
+Subject: The *2graph scripts use $RANDOM, which is bash-specific
+
+Forwarded: https://lists.gnu.org/archive/html/groff/2014-01/msg00008.html
+Last-Update: 2018-03-05
+
+Patch-Name: bash-scripts.patch
+---
+ contrib/eqn2graph/eqn2graph.sh | 2 +-
+ contrib/grap2graph/grap2graph.sh | 2 +-
+ contrib/pic2graph/pic2graph.sh | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/contrib/eqn2graph/eqn2graph.sh b/contrib/eqn2graph/eqn2graph.sh
+index 3e9c37486..454754b52 100644
+--- a/contrib/eqn2graph/eqn2graph.sh
++++ b/contrib/eqn2graph/eqn2graph.sh
+@@ -1,4 +1,4 @@
+-#! /bin/sh
++#! /bin/bash
+ #
+ # eqn2graph -- compile EQN equation descriptions to bitmap images
+ #
+diff --git a/contrib/grap2graph/grap2graph.sh b/contrib/grap2graph/grap2graph.sh
+index 29df25bb1..062f2eecd 100644
+--- a/contrib/grap2graph/grap2graph.sh
++++ b/contrib/grap2graph/grap2graph.sh
+@@ -1,4 +1,4 @@
+-#! /bin/sh
++#! /bin/bash
+ #
+ # grap2graph -- compile graph description descriptions to bitmap images
+ #
+diff --git a/contrib/pic2graph/pic2graph.sh b/contrib/pic2graph/pic2graph.sh
+index b22991483..cc92ce075 100644
+--- a/contrib/pic2graph/pic2graph.sh
++++ b/contrib/pic2graph/pic2graph.sh
+@@ -1,4 +1,4 @@
+-#! /bin/sh
++#! /bin/bash
+ #
+ # pic2graph -- compile PIC image descriptions to bitmap images
+ #
diff --git a/debian/patches/doc-default-os-debian.patch b/debian/patches/doc-default-os-debian.patch
new file mode 100644
index 0000000..c1eaa8a
--- /dev/null
+++ b/debian/patches/doc-default-os-debian.patch
@@ -0,0 +1,41 @@
+From 9bd0e1f19bb2591b30d628710ab805ca265789bc Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Sun, 9 Jul 2023 12:04:37 +0100
+Subject: Set doc-default-operating-system to "Debian"
+
+Bug-Debian: https://bugs.debian.org/284002
+Forwarded: not-needed
+Last-Update: 2023-07-09
+
+Patch-Name: doc-default-os-debian.patch
+---
+ tmac/mdoc/doc-common | 2 +-
+ tmac/tests/doc_smoke-test.sh | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
+index 53a25659f..769b3700d 100644
+--- a/tmac/mdoc/doc-common
++++ b/tmac/mdoc/doc-common
+@@ -490,7 +490,7 @@
+ .\" NS
+ .\" NS override this in 'mdoc.local', if necessary
+ .
+-.ds doc-default-operating-system GNU\"
++.ds doc-default-operating-system Debian\"
+ .
+ .
+ .\" NS doc-operating-system global string
+diff --git a/tmac/tests/doc_smoke-test.sh b/tmac/tests/doc_smoke-test.sh
+index 09d1ad06b..f63df9e1d 100755
+--- a/tmac/tests/doc_smoke-test.sh
++++ b/tmac/tests/doc_smoke-test.sh
+@@ -58,7 +58,7 @@ echo "checking paragraph body for correct content" >&2
+ echo "$output" | grep -qE 'you can read this' || wail
+
+ echo "checking footer for correct content" >&2
+-echo "$output" | grep -qE '^GNU +August 25, 2020 +mdoc-test\(7\)' \
++echo "$output" | grep -qE '^Debian +August 25, 2020 +mdoc-test\(7\)' \
+ || wail
+
+ test -z "$fail"
diff --git a/debian/patches/doc-gfdl.patch b/debian/patches/doc-gfdl.patch
new file mode 100644
index 0000000..f0c646a
--- /dev/null
+++ b/debian/patches/doc-gfdl.patch
@@ -0,0 +1,163 @@
+From 22b7d1355485e1aa9dd52317087d9abe5a9c44ce Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:16 +0000
+Subject: Add GFDL references to manual pages licensed under GFDL
+
+Bug-Debian: https://bugs.debian.org/292229
+Forwarded: not-needed
+Last-Update: 2023-07-08
+
+Patch-Name: doc-gfdl.patch
+---
+ contrib/hdtbl/groff_hdtbl.7.man | 3 +++
+ contrib/pdfmark/pdfroff.1.man | 3 +++
+ man/groff.7.man | 3 +++
+ man/groff_diff.7.man | 3 +++
+ man/groff_out.5.man | 3 +++
+ man/groff_tmac.5.man | 3 +++
+ man/roff.7.man | 3 +++
+ src/roff/groff/groff.1.man | 3 +++
+ src/roff/troff/troff.1.man | 3 +++
+ tmac/groff_trace.7.man | 3 +++
+ 10 files changed, 30 insertions(+)
+
+diff --git a/contrib/hdtbl/groff_hdtbl.7.man b/contrib/hdtbl/groff_hdtbl.7.man
+index af5ab875f..4e0e8e926 100644
+--- a/contrib/hdtbl/groff_hdtbl.7.man
++++ b/contrib/hdtbl/groff_hdtbl.7.man
+@@ -20,6 +20,9 @@ groff_hdtbl \- Heidelberger table macros for GNU
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/contrib/pdfmark/pdfroff.1.man b/contrib/pdfmark/pdfroff.1.man
+index 029a1f459..e55d9176c 100644
+--- a/contrib/pdfmark/pdfroff.1.man
++++ b/contrib/pdfmark/pdfroff.1.man
+@@ -20,6 +20,9 @@ pdfroff \- construct files in Portable Document Format using
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/man/groff.7.man b/man/groff.7.man
+index 3d4cad11b..f51c0a2e4 100644
+--- a/man/groff.7.man
++++ b/man/groff.7.man
+@@ -22,6 +22,9 @@ language reference
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
+index 0d25cb6c0..bc6a45309 100644
+--- a/man/groff_diff.7.man
++++ b/man/groff_diff.7.man
+@@ -23,6 +23,9 @@ and AT&T
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/man/groff_out.5.man b/man/groff_out.5.man
+index 9c1534e2e..f90b0e640 100644
+--- a/man/groff_out.5.man
++++ b/man/groff_out.5.man
+@@ -22,6 +22,9 @@ intermediate output format
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/man/groff_tmac.5.man b/man/groff_tmac.5.man
+index fac78f52f..b28297f6f 100644
+--- a/man/groff_tmac.5.man
++++ b/man/groff_tmac.5.man
+@@ -21,6 +21,9 @@ typesetting system
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/man/roff.7.man b/man/roff.7.man
+index 2468a4b02..9272f8264 100644
+--- a/man/roff.7.man
++++ b/man/roff.7.man
+@@ -25,6 +25,9 @@ typesetting
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/src/roff/groff/groff.1.man b/src/roff/groff/groff.1.man
+index c551326e8..ed6c7eae1 100644
+--- a/src/roff/groff/groff.1.man
++++ b/src/roff/groff/groff.1.man
+@@ -21,6 +21,9 @@ document formatting system
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff-base/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/src/roff/troff/troff.1.man b/src/roff/troff/troff.1.man
+index d83c4a515..01b46616c 100644
+--- a/src/roff/troff/troff.1.man
++++ b/src/roff/troff/troff.1.man
+@@ -22,6 +22,9 @@ typesetter and document formatter
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff-base/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/tmac/groff_trace.7.man b/tmac/groff_trace.7.man
+index 63da8abb8..f3be31970 100644
+--- a/tmac/groff_trace.7.man
++++ b/tmac/groff_trace.7.man
+@@ -21,6 +21,9 @@ documents
+ .\"
+ .\" A copy of the Free Documentation License is included as a file
+ .\" called FDL in the main directory of the groff source package.
++.\"
++.\" A copy of the GNU Free Documentation License is also available in this
++.\" Debian package as /usr/share/doc/groff/copyright.
+ .
+ .
+ .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
diff --git a/debian/patches/doc-gzipped.patch b/debian/patches/doc-gzipped.patch
new file mode 100644
index 0000000..a91c730
--- /dev/null
+++ b/debian/patches/doc-gzipped.patch
@@ -0,0 +1,41 @@
+From 2bc926a96d056356c0c5cd68779e6579b289b38d Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:17 +0000
+Subject: Adjust documentation references to account for compression
+
+Bug-Debian: https://bugs.debian.org/498356
+Forwarded: not-needed
+Last-Update: 2023-07-08
+
+Patch-Name: doc-gzipped.patch
+---
+ contrib/pdfmark/pdfroff.1.man | 2 +-
+ src/preproc/pic/pic.1.man | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/pdfmark/pdfroff.1.man b/contrib/pdfmark/pdfroff.1.man
+index e55d9176c..101da7d7f 100644
+--- a/contrib/pdfmark/pdfroff.1.man
++++ b/contrib/pdfmark/pdfroff.1.man
+@@ -958,7 +958,7 @@ as the preferred formatter.
+ .
+ .
+ .TP
+-.I @PDFDOCDIR@/\:\%pdfmark.pdf
++.I @PDFDOCDIR@/\:\%pdfmark.pdf.gz
+ \[lq]Portable Document Format Publishing with GNU
+ .IR Troff \[rq],
+ by Keith Marshall,
+diff --git a/src/preproc/pic/pic.1.man b/src/preproc/pic/pic.1.man
+index 727cbc347..aa1123706 100644
+--- a/src/preproc/pic/pic.1.man
++++ b/src/preproc/pic/pic.1.man
+@@ -1500,7 +1500,7 @@ which interprets 0 as black and 1 as white.
+ .\" ====================================================================
+ .
+ .TP
+-.I @DOCDIR@/\:pic\:.ps
++.I @DOCDIR@/\:pic\:.ps.gz
+ \[lq]Making Pictures with GNU pic\[rq],
+ by Eric S.\& Raymond.
+ .
diff --git a/debian/patches/extratmacdirs.patch b/debian/patches/extratmacdirs.patch
new file mode 100644
index 0000000..d0fb221
--- /dev/null
+++ b/debian/patches/extratmacdirs.patch
@@ -0,0 +1,33 @@
+From 8d089f72758f5abf62fe667cb6a7bef1b5d2e36b Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:20 +0000
+Subject: Allow adding a version-independent directory to the macro path
+
+This allows us to put /usr/share/groff/tmac at the end of groff's macro
+path in Debian.
+
+This uses GNU-make-specific code, so it may not be forwardable in its
+current state. A more upstreamable approach might be to add a --with-*
+option to configure.
+
+Forwarded: no
+Last-Update: 2018-03-05
+
+Patch-Name: extratmacdirs.patch
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index f7ab4107e..c4d09b7be 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -207,7 +207,7 @@ localtmacdir=$(dataprogramdir)/site-tmac
+ # directory will be always added.
+ # `troffrc' and `troffrc-end' (and `eqnrc') are searched neither in the
+ # current nor in the home directory.
+-tmacpath=$(systemtmacdir)$(RT_SEP)$(localtmacdir)$(RT_SEP)$(tmacdir)
++tmacpath=$(systemtmacdir)$(RT_SEP)$(localtmacdir)$(RT_SEP)$(tmacdir)$(if $(extratmacdirs),$(RT_SEP)$(extratmacdirs))
+
+ # sys_tmac_prefix
+ # `sys_tmac_prefix' is prefix (if any) for system macro packages.
diff --git a/debian/patches/load-desc-failure.patch b/debian/patches/load-desc-failure.patch
new file mode 100644
index 0000000..ebf05f6
--- /dev/null
+++ b/debian/patches/load-desc-failure.patch
@@ -0,0 +1,42 @@
+From b30f08f4cd5791a9895df07c1acb061518c73cbe Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:22 +0000
+Subject: Display more helpful output when failing to load a device
+
+If the device is known to be one of the devices in the groff binary package
+rather than groff-base, refer the user to that.
+
+Forwarded: not-needed
+Last-Update: 2023-07-08
+
+Patch-Name: load-desc-failure.patch
+---
+ src/roff/groff/groff.cpp | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
+index 4eb732969..d4cb3c122 100644
+--- a/src/roff/groff/groff.cpp
++++ b/src/roff/groff/groff.cpp
+@@ -378,9 +378,18 @@ int main(int argc, char **argv)
+ }
+ font::set_unknown_desc_command_handler(handle_unknown_desc_command);
+ const char *desc = font::load_desc();
+- if (0 /* nullptr */ == desc)
+- fatal("cannot load 'DESC' description file for device '%1'",
+- device);
++ if (0 /* nullptr */ == desc) {
++ if (strcmp(device, "X100") == 0 || strcmp(device, "X100-12") == 0 ||
++ strcmp(device, "X75") == 0 || strcmp(device, "X75-12") == 0 ||
++ strcmp(device, "dvi") == 0 || strcmp(device, "html") == 0 ||
++ strcmp(device, "lbp") == 0 || strcmp(device, "lj4") == 0)
++ fatal("cannot load 'DESC' description file for device '%1' "
++ "(try installing the 'groff' package?)",
++ device);
++ else
++ fatal("cannot load 'DESC' description file for device '%1'",
++ device);
++ }
+ if (need_postdriver && (0 /* nullptr */ == postdriver))
+ fatal_with_file_and_line(desc, 0, "device description file missing"
+ " 'postpro' directive");
diff --git a/debian/patches/man-hyperlinks.patch b/debian/patches/man-hyperlinks.patch
new file mode 100644
index 0000000..d28dec8
--- /dev/null
+++ b/debian/patches/man-hyperlinks.patch
@@ -0,0 +1,47 @@
+From 43f8bc8009a33929db3f3bafadf17f606c1b850a Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Tue, 11 Jul 2023 17:33:14 +0100
+Subject: Enable OSC 8 hyperlinks for man pages
+
+The version of `less` in Debian stable supports these, provided that
+you're also using a suitable terminal emulator.
+
+Forwarded: no
+Last-Update: 2023-07-11
+
+Patch-Name: man-hyperlinks.patch
+---
+ tmac/man.local | 2 +-
+ tmac/tests/an_UE-breaks-before-long-URIs.sh | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tmac/man.local b/tmac/man.local
+index 5daa507b8..0bb667bd4 100644
+--- a/tmac/man.local
++++ b/tmac/man.local
+@@ -6,7 +6,7 @@
+ .\" output devices.
+ .if !'\*[.T]'html' \
+ . if !r U \
+-. nr U 0
++. nr U 1
+ .\"
+ .\" "CW" is not a portable font name, but some man pages use it anyway.
+ .\" Uncomment this to suppress warnings produced by such pages. This
+diff --git a/tmac/tests/an_UE-breaks-before-long-URIs.sh b/tmac/tests/an_UE-breaks-before-long-URIs.sh
+index 0b151fd8d..f39ceaea1 100755
+--- a/tmac/tests/an_UE-breaks-before-long-URIs.sh
++++ b/tmac/tests/an_UE-breaks-before-long-URIs.sh
+@@ -48,10 +48,10 @@ wail () {
+ fail=yes
+ }
+
+-output=$(printf "%s" "$input" | "$groff" -Tascii -P-cbou -man)
++output=$(printf "%s" "$input" | "$groff" -Tascii -P-cbou -rU0 -man)
+ echo "$output"
+ error=$(printf "%s" "$input" \
+- | "$groff" -Tascii -P-cbou -man -ww -z 2>&1)
++ | "$groff" -Tascii -P-cbou -rU0 -man -ww -z 2>&1)
+
+ echo "testing that no diagnostic messages are produced" >&2
+ test -z "$error" || wail
diff --git a/debian/patches/mmse-note.patch b/debian/patches/mmse-note.patch
new file mode 100644
index 0000000..a5944b5
--- /dev/null
+++ b/debian/patches/mmse-note.patch
@@ -0,0 +1,71 @@
+From a936d99e2e4315890085267112317ab710d504fc Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Sun, 26 Jan 2014 19:34:00 +0000
+Subject: Note that groff_mmse(7) is only available in Swedish locales
+
+Bug-Debian: https://bugs.debian.org/710431
+Forwarded: no
+Last-Update: 2023-07-08
+
+Patch-Name: mmse-note.patch
+---
+ contrib/mm/groff_mm.7.man | 1 +
+ contrib/mm/mmroff.1.man | 3 ++-
+ man/groff_tmac.5.man | 3 ++-
+ src/roff/groff/groff.1.man | 3 ++-
+ 4 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/contrib/mm/groff_mm.7.man b/contrib/mm/groff_mm.7.man
+index 4f9419150..4da41c867 100644
+--- a/contrib/mm/groff_mm.7.man
++++ b/contrib/mm/groff_mm.7.man
+@@ -5414,6 +5414,7 @@ You can browse it interactively with \[lq]info groff\[rq].
+ .MR @g@eqn @MAN1EXT@ ,
+ .MR @g@refer @MAN1EXT@ ,
+ .MR groff_mmse @MAN7EXT@
++(only in Swedish locales)
+ .
+ .
+ .\" Restore compatibility mode (for, e.g., Solaris 10/11).
+diff --git a/contrib/mm/mmroff.1.man b/contrib/mm/mmroff.1.man
+index 7920c709d..b0aed5509 100644
+--- a/contrib/mm/mmroff.1.man
++++ b/contrib/mm/mmroff.1.man
+@@ -151,7 +151,8 @@ Sweden.
+ .\" ====================================================================
+ .
+ .MR groff_mm @MAN7EXT@ ,
+-.MR groff_mmse @MAN7EXT@ ,
++.MR groff_mmse @MAN7EXT@
++(only in Swedish locales),
+ .MR groff @MAN1EXT@ ,
+ .MR @g@troff @MAN1EXT@ ,
+ .MR @g@tbl @MAN1EXT@ ,
+diff --git a/man/groff_tmac.5.man b/man/groff_tmac.5.man
+index b28297f6f..01f4c1970 100644
+--- a/man/groff_tmac.5.man
++++ b/man/groff_tmac.5.man
+@@ -416,7 +416,8 @@ Some of the localization of the
+ .I mm
+ package is handled separately;
+ see
+-.MR groff_mmse @MAN7EXT@ .
++.MR groff_mmse @MAN7EXT@
++(only in Swedish locales).
+ .
+ .
+ .TP
+diff --git a/src/roff/groff/groff.1.man b/src/roff/groff/groff.1.man
+index ed6c7eae1..75687440e 100644
+--- a/src/roff/groff/groff.1.man
++++ b/src/roff/groff/groff.1.man
+@@ -2311,7 +2311,8 @@ Macro packages and package-specific utilities:
+ .MR groff_mdoc @MAN7EXT@ , \" #56
+ .MR groff_me @MAN7EXT@ , \" #57
+ .MR groff_mm @MAN7EXT@ , \" # 10
+-.MR groff_mmse @MAN7EXT@ , \" # 11
++.MR groff_mmse @MAN7EXT@ \" # 11
++(only in Swedish locales),
+ .MR mmroff @MAN1EXT@ , \" #12
+ .MR groff_mom @MAN7EXT@ , \" #13
+ .MR pdfmom @MAN1EXT@ , \" #30
diff --git a/debian/patches/nroff-ifs.patch b/debian/patches/nroff-ifs.patch
new file mode 100644
index 0000000..bee5851
--- /dev/null
+++ b/debian/patches/nroff-ifs.patch
@@ -0,0 +1,30 @@
+From 5820d2ee6514013f1ee6477935ed13a5230c2cca Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:12 +0000
+Subject: Unset IFS at nroff startup
+
+It's questionable whether we should forward this; as noted in the bug
+trail, there's a decent argument that this is a dash bug.
+
+Bug-Debian: https://bugs.debian.org/541621
+Forwarded: no
+Last-Update: 2018-03-05
+
+Patch-Name: nroff-ifs.patch
+---
+ src/roff/nroff/nroff.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh
+index 77f5c069e..14e4bd0f1 100644
+--- a/src/roff/nroff/nroff.sh
++++ b/src/roff/nroff/nroff.sh
+@@ -20,6 +20,8 @@
+ # You should have received a copy of the GNU General Public License
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+
++unset IFS
++
+ prog="$0"
+
+ T=
diff --git a/debian/patches/nroff-map-CW-to-R.patch b/debian/patches/nroff-map-CW-to-R.patch
new file mode 100644
index 0000000..8a99c9b
--- /dev/null
+++ b/debian/patches/nroff-map-CW-to-R.patch
@@ -0,0 +1,40 @@
+From 742dfac36f1fd23e17d27dbf83e3793d3f3a063d Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Fri, 14 Jul 2023 12:42:26 +0100
+Subject: Map CW to R for nroff
+
+Bug-Debian: https://bugs.debian.org/1040975
+Last-Update: 2023-07-14
+
+Patch-Name: nroff-map-CW-to-R.patch
+---
+ tmac/man.local | 2 +-
+ tmac/mdoc.local | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tmac/man.local b/tmac/man.local
+index 0bb667bd4..1aaaadd6a 100644
+--- a/tmac/man.local
++++ b/tmac/man.local
+@@ -12,7 +12,7 @@
+ .\" Uncomment this to suppress warnings produced by such pages. This
+ .\" test remaps the font to roman ("R") on nroff (terminal) devices. You
+ .\" might prefer to remap it to bold ("B") instead.
+-.\" .if n .ftr CW R
++.if n .ftr CW R
+ .\"
+ .\" A de facto standard URL format for man pages is recognized
+ .\" everywhere except Apple, where different macOS applications expect
+diff --git a/tmac/mdoc.local b/tmac/mdoc.local
+index 94688aba0..66dcc423d 100644
+--- a/tmac/mdoc.local
++++ b/tmac/mdoc.local
+@@ -6,7 +6,7 @@
+ .\" Uncomment this to suppress warnings produced by such pages. This
+ .\" test remaps the font to roman ("R") on nroff (terminal) devices. You
+ .\" might prefer to remap it to bold ("B") instead.
+-.\" .if n .ftr CW R
++.if n .ftr CW R
+ .\"
+ .\" Local Variables:
+ .\" mode: nroff
diff --git a/debian/patches/papersize-config.patch b/debian/patches/papersize-config.patch
new file mode 100644
index 0000000..912a657
--- /dev/null
+++ b/debian/patches/papersize-config.patch
@@ -0,0 +1,98 @@
+From 89007e004d78582fd83651d0421045229ff2e838 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 2 Jan 2014 13:13:21 +0000
+Subject: Use /etc/papersize in preference to configure-time selection
+
+Forwarded: not-needed
+Last-Update: 2023-07-09
+
+Patch-Name: papersize-config.patch
+---
+ font/devdvi/devdvi.am | 4 ++--
+ font/devlbp/devlbp.am | 4 ++--
+ font/devlj4/devlj4.am | 4 ++--
+ font/devpdf/devpdf.am | 5 +++--
+ font/devps/devps.am | 4 ++--
+ 5 files changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/font/devdvi/devdvi.am b/font/devdvi/devdvi.am
+index e7f5768d7..4d479de2b 100644
+--- a/font/devdvi/devdvi.am
++++ b/font/devdvi/devdvi.am
+@@ -81,9 +81,9 @@ font/devdvi/DESC: $(devdvi_srcdir)/DESC.in
+ $(AM_V_GEN)$(MKDIR_P) `dirname $@` \
+ && cat $(devdvi_srcdir)/DESC.in >$@ \
+ && if test "$(PAGE)" = A4; then \
+- echo "papersize a4" >>$@; \
++ echo "papersize /etc/papersize a4" >>$@; \
+ else \
+- echo "papersize letter" >>$@; \
++ echo "papersize /etc/papersize letter" >>$@; \
+ fi \
+ && (test -z '$(DVIPRINT)' \
+ || echo print '$(DVIPRINT)' >>$@)
+diff --git a/font/devlbp/devlbp.am b/font/devlbp/devlbp.am
+index 0702a2088..b60450caa 100644
+--- a/font/devlbp/devlbp.am
++++ b/font/devlbp/devlbp.am
+@@ -45,9 +45,9 @@ font/devlbp/DESC: $(devlbp_srcdir)/DESC.in
+ $(AM_V_GEN)$(MKDIR_P) `dirname $@` \
+ && cat $(devlbp_srcdir)/DESC.in >$@ \
+ && if test "$(PAGE)" = A4; then \
+- echo "papersize a4" >>$@; \
++ echo "papersize /etc/papersize a4" >>$@; \
+ else \
+- echo "papersize letter" >>$@; \
++ echo "papersize /etc/papersize letter" >>$@; \
+ fi \
+ && (test -z '$(LBPPRINT)' \
+ || echo print '$(LBPPRINT)' >>$@)
+diff --git a/font/devlj4/devlj4.am b/font/devlj4/devlj4.am
+index 9f17c4d72..d5cfe9b6d 100644
+--- a/font/devlj4/devlj4.am
++++ b/font/devlj4/devlj4.am
+@@ -90,9 +90,9 @@ font/devlj4/DESC: $(devlj4_srcdir)/DESC.in
+ && echo "unitwidth `expr 7620000 / $(LJ4RES)`" >>$@ \
+ && cat $(devlj4_srcdir)/DESC.in >>$@ \
+ && if test "$(PAGE)" = A4; then \
+- echo "papersize a4" >>$@; \
++ echo "papersize /etc/papersize a4" >>$@; \
+ else \
+- echo "papersize letter" >>$@; \
++ echo "papersize /etc/papersize letter" >>$@; \
+ fi \
+ && (test -z '$(LJ4PRINT)' \
+ || echo print '$(LJ4PRINT)' >>$@)
+diff --git a/font/devpdf/devpdf.am b/font/devpdf/devpdf.am
+index edce36575..5ba6f93f7 100644
+--- a/font/devpdf/devpdf.am
++++ b/font/devpdf/devpdf.am
+@@ -92,9 +92,10 @@ font/devpdf/DESC: $(devpdf_srcdir)/DESC.in
+ && cat $(devpdf_srcdir)/DESC.in \
+ >$(top_builddir)/font/devpdf/DESC \
+ && if test "$(PAGE)" = A4; then \
+- echo "papersize a4" >>$(top_builddir)/font/devpdf/DESC; \
++ echo "papersize /etc/papersize a4" \
++ >>$(top_builddir)/font/devpdf/DESC; \
+ else \
+- echo "papersize letter" \
++ echo "papersize /etc/papersize letter" \
+ >>$(top_builddir)/font/devpdf/DESC; \
+ fi
+
+diff --git a/font/devps/devps.am b/font/devps/devps.am
+index 2664f3c91..656c603be 100644
+--- a/font/devps/devps.am
++++ b/font/devps/devps.am
+@@ -144,9 +144,9 @@ font/devps/DESC: $(devps_srcdir)/DESC.in
+ && cat $(devps_srcdir)/DESC.in >$@.tmp \
+ && echo broken $(BROKEN_SPOOLER_FLAGS) >>$@.tmp \
+ && if test "$(PAGE)" = A4; then \
+- echo "papersize a4" >>$@.tmp; \
++ echo "papersize /etc/papersize a4" >>$@.tmp; \
+ else \
+- echo "papersize letter" >>$@.tmp; \
++ echo "papersize /etc/papersize letter" >>$@.tmp; \
+ fi \
+ && (test -z '$(PSPRINT)' \
+ || echo print '$(PSPRINT)' >>$@.tmp)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..fcabcc0
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,12 @@
+bash-scripts.patch
+nroff-ifs.patch
+doc-gfdl.patch
+doc-gzipped.patch
+extratmacdirs.patch
+papersize-config.patch
+load-desc-failure.patch
+mmse-note.patch
+source-date-epoch-utc.patch
+doc-default-os-debian.patch
+man-hyperlinks.patch
+nroff-map-CW-to-R.patch
diff --git a/debian/patches/source-date-epoch-utc.patch b/debian/patches/source-date-epoch-utc.patch
new file mode 100644
index 0000000..b9e5b76
--- /dev/null
+++ b/debian/patches/source-date-epoch-utc.patch
@@ -0,0 +1,468 @@
+From 56d2f35b18a8e6502c6aa842c07b3d27fe9f6f7f Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Sun, 9 Jul 2023 13:23:21 +0100
+Subject: Display time from SOURCE_DATE_EPOCH in UTC.
+
+The semantics imposed in 1.23.0 are unsuitable for use with
+reproducible-builds harnesses, since those specifically want to vary the
+TZ environment variable to shake out other problems in build systems.
+However, my patch that Debian has been carrying for a while is
+unsuitable for general use, since most people expect the time displayed
+in output to use local time.
+
+A viable compromise seems to be to force UTC _only_ when
+SOURCE_DATE_EPOCH is set. That will keep reproducible-builds harnesses
+working with no extra effort, while also preserving the expected
+behaviour for typical users of groff that don't go out of their way to
+set that environment variable.
+
+As a bonus, this corrects the behaviour of gropdf when the local offset
+from UTC is not a whole number of hours.
+
+* src/include/curtime.h (current_time): Return a `struct tm *`.
+ Document behaviour.
+* src/libs/libgroff/curtime.cpp (current_time): If SOURCE_DATE_EPOCH is
+ set, return the overridden time after passing it through `gmtime`.
+ Otherwise, pass the current time through `localtime`.
+
+* src/devices/grohtml/post-html.cpp (html_printer::do_file_components,
+ html_printer::~html_printer):
+* src/devices/grops/ps.cpp (ps_printer::~ps_printer):
+* src/roff/troff/input.cpp (init_registers): Adjust to new
+ `current_time` signature.
+
+* src/devices/gropdf/gropdf.pl: If SOURCE_DATE_EPOCH is set, return the
+ overridden time after passing it through `gmtime`. Otherwise, pass
+ the current time through `localtime`.
+ (PDFDate): Fix output in the case where the local offset from UTC is
+ not a whole number of hours. (Previously, the minutes offset field
+ was always set to zero.)
+
+* doc/groff.texi (Environment):
+* src/devices/grohtml/grohtml.1.man (Environment):
+* src/devices/gropdf/gropdf.1.man (Environment):
+* src/devices/grops/grops.1.man (Environment):
+* src/roff/groff/groff.1.man (Environment):
+* src/roff/troff/troff.1.man (Environment): Update.
+
+Origin: upstream, https://git.savannah.gnu.org/cgit/groff.git/commit/?id=d7bbfb04ea25a82a8597cdef6ebb391cb78ab47c
+Last-Update: 2023-07-11
+
+Patch-Name: source-date-epoch-utc.patch
+---
+ doc/groff.texi | 13 +++++++------
+ src/devices/grohtml/grohtml.1.man | 12 +++++++-----
+ src/devices/grohtml/post-html.cpp | 16 ++++------------
+ src/devices/gropdf/gropdf.1.man | 10 +++++-----
+ src/devices/gropdf/gropdf.pl | 16 ++++++++++++++--
+ src/devices/grops/grops.1.man | 12 +++++++-----
+ src/devices/grops/ps.cpp | 9 ++-------
+ src/include/curtime.h | 19 +++++++++++--------
+ src/libs/libgroff/curtime.cpp | 23 +++++++++++++----------
+ src/roff/groff/groff.1.man | 12 +++++++-----
+ src/roff/troff/input.cpp | 24 +++++++++---------------
+ src/roff/troff/troff.1.man | 12 +++++++-----
+ 12 files changed, 93 insertions(+), 85 deletions(-)
+
+diff --git a/doc/groff.texi b/doc/groff.texi
+index 2a6635e9d..bcea4f3e7 100644
+--- a/doc/groff.texi
++++ b/doc/groff.texi
+@@ -1389,15 +1389,16 @@ overrides @env{GROFF_TYPESETTER}.
+ @tindex SOURCE_DATE_EPOCH@r{, environment variable}
+ A timestamp (expressed as seconds since the Unix epoch) to use as the
+ output creation timestamp in place of the current time. The time is
+-converted to human-readable form using @cite{localtime@r{(3)}} when the
+-formatter starts up and stored in registers usable by documents and
+-macro packages (@pxref{Built-in Registers}).
++converted to human-readable form using @cite{gmtime@r{(3)}} and
++@cite{asctime@r{(3)}} when the formatter starts up and stored in
++registers usable by documents and macro packages (@pxref{Built-in
++Registers}).
+
+ @item TZ
+ @tindex TZ@r{, environment variable}
+-The time zone to use when converting the current time (or value of
+-@env{SOURCE_DATE_EPOCH}) to human-readable form; see
+-@cite{tzset@r{(3)}}.
++The time zone to use when converting the current time to human-readable
++form; see @cite{tzset@r{(3)}}. If @env{SOURCE_DATE_EPOCH} is used, it
++is always converted to human-readable form using UTC.
+ @end table
+
+ MS-DOS and MS-Windows ports of @code{groff} use semicolons, rather than
+diff --git a/src/devices/grohtml/grohtml.1.man b/src/devices/grohtml/grohtml.1.man
+index 2243b474c..8a55c93dd 100644
+--- a/src/devices/grohtml/grohtml.1.man
++++ b/src/devices/grohtml/grohtml.1.man
+@@ -616,18 +616,20 @@ A timestamp
+ to use as the output creation timestamp in place of the current time.
+ .
+ The time is converted to human-readable form using
+-.MR ctime 3
++.MR gmtime 3
++and
++.MR asctime 3 ,
+ and recorded in an HTML comment.
+ .
+ .
+ .TP
+ .I TZ
+-The time zone to use when converting the current time
+-(or value of
+-.IR SOURCE_DATE_EPOCH )
+-to human-readable form;
++The time zone to use when converting the current time to human-readable form;
+ see
+ .MR tzset 3 .
++If
++.I SOURCE_DATE_EPOCH
++is used, it is always converted to human-readable form using UTC.
+ .
+ .
+ .\" ====================================================================
+diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp
+index 4e02b5cfa..b42720da1 100644
+--- a/src/devices/grohtml/post-html.cpp
++++ b/src/devices/grohtml/post-html.cpp
+@@ -5081,11 +5081,7 @@ void html_printer::do_file_components (void)
+ fclose(file_list.get_file());
+ file_list.move_next();
+ if (file_list.is_new_output_file()) {
+-#ifdef LONG_FOR_TIME_T
+- long t;
+-#else
+- time_t t;
+-#endif
++ struct tm *t;
+
+ if (fragment_no > 1)
+ write_navigation(top, prev, next, current);
+@@ -5115,7 +5111,7 @@ void html_printer::do_file_components (void)
+ if (do_write_date_comment) {
+ t = current_time();
+ html.begin_comment("CreationDate: ")
+- .put_string(ctime(&t), strlen(ctime(&t))-1)
++ .put_string(asctime(t), strlen(asctime(t))-1)
+ .end_comment();
+ }
+
+@@ -5215,11 +5211,7 @@ void html_printer::writeHeadMetaStyle (void)
+
+ html_printer::~html_printer()
+ {
+-#ifdef LONG_FOR_TIME_T
+- long t;
+-#else
+- time_t t;
+-#endif
++ struct tm *t;
+
+ if (current_paragraph)
+ current_paragraph->flush_text();
+@@ -5240,7 +5232,7 @@ html_printer::~html_printer()
+ if (do_write_date_comment) {
+ t = current_time();
+ html.begin_comment("CreationDate: ")
+- .put_string(ctime(&t), strlen(ctime(&t))-1)
++ .put_string(asctime(t), strlen(asctime(t))-1)
+ .end_comment();
+ }
+
+diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man
+index d1d39bbe0..20a957e68 100644
+--- a/src/devices/gropdf/gropdf.1.man
++++ b/src/devices/gropdf/gropdf.1.man
+@@ -1673,18 +1673,18 @@ A timestamp
+ to use as the output creation timestamp in place of the current time.
+ .
+ The time is converted to human-readable form using Perl's
+-.I \%localtime()
++.I \%gmtime()
+ function and recorded in a PDF comment.
+ .
+ .
+ .TP
+ .I TZ
+-The time zone to use when converting the current time
+-(or value of
+-.IR SOURCE_DATE_EPOCH )
+-to human-readable form;
++The time zone to use when converting the current time to human-readable form;
+ see
+ .MR tzset 3 .
++If
++.I SOURCE_DATE_EPOCH
++is used, it is always converted to human-readable form using UTC.
+ .
+ .
+ .\" ====================================================================
+diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
+index c65a1051f..0e1b612a5 100644
+--- a/src/devices/gropdf/gropdf.pl
++++ b/src/devices/gropdf/gropdf.pl
+@@ -23,6 +23,7 @@
+ use strict;
+ use warnings;
+ use Getopt::Long qw(:config bundling);
++use POSIX qw(mktime);
+
+ use constant
+ {
+@@ -343,7 +344,12 @@ for $papersz ( split(" ", lc($possiblesizes).' #duff#') )
+ # If we get here, $papersz was invalid, so try the next one.
+ }
+
+-my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time);
++my @dt;
++if ($ENV{SOURCE_DATE_EPOCH}) {
++ @dt=gmtime($ENV{SOURCE_DATE_EPOCH});
++} else {
++ @dt=localtime;
++}
+ my $dt=PDFDate(\@dt);
+
+ my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
+@@ -628,7 +634,13 @@ sub GetObj
+ sub PDFDate
+ {
+ my $dt=shift;
+- return(sprintf("D:%04d%02d%02d%02d%02d%02d%+03d'00'",$dt->[5]+1900,$dt->[4]+1,$dt->[3],$dt->[2],$dt->[1],$dt->[0],( localtime time() + 3600*( 12 - (gmtime)[2] ) )[2] - 12));
++ my $offset;
++ if ($ENV{SOURCE_DATE_EPOCH}) {
++ $offset=0;
++ } else {
++ $offset=mktime((localtime $dt)[0..5]) - mktime((gmtime $dt)[0..5]);
++ }
++ return(sprintf("D:%04d%02d%02d%02d%02d%02d%+03d'%+03d'",$dt->[5]+1900,$dt->[4]+1,$dt->[3],$dt->[2],$dt->[1],$dt->[0],int($offset/3600),int(($offset%3600)/60)));
+ }
+
+ sub ToPoints
+diff --git a/src/devices/grops/grops.1.man b/src/devices/grops/grops.1.man
+index d0ec21d0b..53014ee1b 100644
+--- a/src/devices/grops/grops.1.man
++++ b/src/devices/grops/grops.1.man
+@@ -1696,18 +1696,20 @@ A timestamp
+ to use as the output creation timestamp in place of the current time.
+ .
+ The time is converted to human-readable form using
+-.MR ctime 3
++.MR gmtime 3
++and
++.MR asctime 3 ,
+ and recorded in a PostScript comment.
+ .
+ .
+ .TP
+ .I TZ
+-The time zone to use when converting the current time
+-(or value of
+-.IR SOURCE_DATE_EPOCH )
+-to human-readable form;
++The time zone to use when converting the current time to human-readable form;
+ see
+ .MR tzset 3 .
++If
++.I SOURCE_DATE_EPOCH
++is used, it is always converted to human-readable form using UTC.
+ .
+ .
+ .\" ====================================================================
+diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
+index 807945f97..59e6e253d 100644
+--- a/src/devices/grops/ps.cpp
++++ b/src/devices/grops/ps.cpp
+@@ -1390,13 +1390,8 @@ ps_printer::~ps_printer()
+ .end_comment();
+ {
+ fputs("%%CreationDate: ", out.get_file());
+-#ifdef LONG_FOR_TIME_T
+- long
+-#else
+- time_t
+-#endif
+- t = current_time();
+- fputs(ctime(&t), out.get_file());
++ struct tm *t = current_time();
++ fputs(asctime(t), out.get_file());
+ }
+ for (font_pointer_list *f = font_list; f; f = f->next) {
+ ps_font *psf = (ps_font *)(f->p);
+diff --git a/src/include/curtime.h b/src/include/curtime.h
+index 5d3a24a7b..ebd2efb80 100644
+--- a/src/include/curtime.h
++++ b/src/include/curtime.h
+@@ -15,13 +15,16 @@ for more details.
+ The GNU General Public License version 2 (GPL2) is available in the
+ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
+
+-#ifndef LONG_FOR_TIME_T
+ #include <time.h>
+-#endif
+
+-#ifdef LONG_FOR_TIME_T
+-long
+-#else
+-time_t
+-#endif
+-current_time();
++// Get the current time in broken-down time representation. If the
++// SOURCE_DATE_EPOCH environment variable is set, then it is used instead of
++// the real time from the system clock; in this case, the user is clearly
++// trying to arrange for some kind of reproducible build, so express the
++// time in UTC. Otherwise, use the real time from the system clock, and
++// express it relative to the user's time zone.
++//
++// In either case, as with gmtime() and localtime(), the return value points
++// to a statically-allocated struct which might be overwritten by later
++// calls.
++struct tm *current_time();
+diff --git a/src/libs/libgroff/curtime.cpp b/src/libs/libgroff/curtime.cpp
+index 34dbc5ca9..277755cab 100644
+--- a/src/libs/libgroff/curtime.cpp
++++ b/src/libs/libgroff/curtime.cpp
+@@ -15,9 +15,7 @@ for more details.
+ The GNU General Public License version 2 (GPL2) is available in the
+ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
+
+-#ifdef HAVE_CONFIG_H
+-#include <config.h>
+-#endif
++#include "lib.h"
+
+ #include <errno.h>
+ #include <limits.h>
+@@ -25,16 +23,18 @@ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
+ #include <string.h>
+ #include <time.h>
+
++#include "curtime.h"
+ #include "errarg.h"
+ #include "error.h"
+
++struct tm *current_time()
++{
+ #ifdef LONG_FOR_TIME_T
+-long
++ long
+ #else
+-time_t
++ time_t
+ #endif
+-current_time()
+-{
++ t;
+ char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+
+ if (source_date_epoch) {
+@@ -49,7 +49,10 @@ current_time()
+ fatal("$SOURCE_DATE_EPOCH: no digits found: '%1'", endptr);
+ if (*endptr != '\0')
+ fatal("$SOURCE_DATE_EPOCH: trailing garbage: '%1'", endptr);
+- return epoch;
+- } else
+- return time(0);
++ t = epoch;
++ return gmtime(&t);
++ } else {
++ t = time(0);
++ return localtime(&t);
++ }
+ }
+diff --git a/src/roff/groff/groff.1.man b/src/roff/groff/groff.1.man
+index 75687440e..348036cdf 100644
+--- a/src/roff/groff/groff.1.man
++++ b/src/roff/groff/groff.1.man
+@@ -1879,19 +1879,21 @@ A time stamp
+ to use as the output creation time stamp in place of the current time.
+ .
+ The time is converted to human-readable form using
+-.MR localtime 3
++.MR gmtime 3
++and
++.MR asctime 3
+ when the formatter starts up and stored in registers usable by documents
+ and macro packages.
+ .
+ .
+ .TP
+ .I TZ
+-The time zone to use when converting the current time
+-(or value of
+-.IR SOURCE_DATE_EPOCH )
+-to human-readable form;
++The time zone to use when converting the current time to human-readable form;
+ see
+ .MR tzset 3 .
++If
++.I SOURCE_DATE_EPOCH
++is used, it is always converted to human-readable form using UTC.
+ .
+ .
+ .\" ====================================================================
+diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
+index 292ee7389..f03338335 100644
+--- a/src/roff/troff/input.cpp
++++ b/src/roff/troff/input.cpp
+@@ -8297,21 +8297,15 @@ void warn_request()
+
+ static void init_registers()
+ {
+-#ifdef LONG_FOR_TIME_T
+- long
+-#else /* not LONG_FOR_TIME_T */
+- time_t
+-#endif /* not LONG_FOR_TIME_T */
+- t = current_time();
+- struct tm *tt = localtime(&t);
+- set_number_reg("seconds", int(tt->tm_sec));
+- set_number_reg("minutes", int(tt->tm_min));
+- set_number_reg("hours", int(tt->tm_hour));
+- set_number_reg("dw", int(tt->tm_wday + 1));
+- set_number_reg("dy", int(tt->tm_mday));
+- set_number_reg("mo", int(tt->tm_mon + 1));
+- set_number_reg("year", int(1900 + tt->tm_year));
+- set_number_reg("yr", int(tt->tm_year));
++ struct tm *t = current_time();
++ set_number_reg("seconds", int(t->tm_sec));
++ set_number_reg("minutes", int(t->tm_min));
++ set_number_reg("hours", int(t->tm_hour));
++ set_number_reg("dw", int(t->tm_wday + 1));
++ set_number_reg("dy", int(t->tm_mday));
++ set_number_reg("mo", int(t->tm_mon + 1));
++ set_number_reg("year", int(1900 + t->tm_year));
++ set_number_reg("yr", int(t->tm_year));
+ set_number_reg("$$", getpid());
+ register_dictionary.define(".A",
+ new readonly_text_register(ascii_output_flag
+diff --git a/src/roff/troff/troff.1.man b/src/roff/troff/troff.1.man
+index 01b46616c..4fbb962b1 100644
+--- a/src/roff/troff/troff.1.man
++++ b/src/roff/troff/troff.1.man
+@@ -868,19 +868,21 @@ A timestamp
+ to use as the output creation timestamp in place of the current time.
+ .
+ The time is converted to human-readable form using
+-.MR localtime 3
++.MR gmtime 3
++and
++.MR asctime 3
+ when the formatter starts up and stored in registers usable by documents
+ and macro packages.
+ .
+ .
+ .TP
+ .I TZ
+-The timezone to use when converting the current time
+-(or value of
+-.IR SOURCE_DATE_EPOCH )
+-to human-readable form;
++The time zone to use when converting the current time to human-readable form;
+ see
+ .MR tzset 3 .
++If
++.I SOURCE_DATE_EPOCH
++is used, it is always converted to human-readable form using UTC.
+ .
+ .
+ .\" ====================================================================