Description: Honour SOURCE_DATE_EPOCH.
 Honour the SOURCE_DATE_EPOCH environment variable to get documentation date
 from last debian changelog entry.
 This makes the build reproducible.
 See https://reproducible-builds.org/specs/source-date-epoch/.
Author: Alexis Bienvenüe <pado@passoire.fr>

Index: asymptote-2.37.real/doc/FAQ/m-html.pl
===================================================================
--- asymptote-2.37.real.orig/doc/FAQ/m-html.pl
+++ asymptote-2.37.real/doc/FAQ/m-html.pl
@@ -34,8 +34,8 @@ sub html_init {
     print HTML "<html>\n";
     $html_needpara= -1;
     $html_end='';
-    chop($html_date=`date '+%d %B %Y'`);
-    chop($html_year=`date '+%Y'`);
+    $html_date=time2str("%d %B %Y", $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
+    $html_year=time2str("%Y", $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
 }
 
 sub html_startup {
Index: asymptote-2.37.real/doc/FAQ/m-lout.pl
===================================================================
--- asymptote-2.37.real.orig/doc/FAQ/m-lout.pl
+++ asymptote-2.37.real/doc/FAQ/m-lout.pl
@@ -23,7 +23,7 @@
 
 sub lout_init {
     open(LOUT,">$prefix.lout");
-    chop($dprint= `date '+%d %B %Y'`);
+    $dprint = time2str("%d %B %Y", $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
     $dprint =~ s/^0//;
 }
 
Index: asymptote-2.37.real/doc/FAQ/bfnnconv.pl
===================================================================
--- asymptote-2.37.real.orig/doc/FAQ/bfnnconv.pl
+++ asymptote-2.37.real/doc/FAQ/bfnnconv.pl
@@ -21,6 +21,8 @@
 # by the GPL.  However, I would appreciate it if you credited me if
 # appropriate in any documents you format using BFNN.)
 
+use Date::Format;
+
 @outputs=('ascii','info','html');
 
 while ($ARGV[0] =~ m/^\-/) {
@@ -135,7 +137,12 @@ while (<>) {
                 m/([^\\])\`/ || warn "`$_'";
                 $_= $';
                 $cmd= $`.$1;
-                $it= `$cmd`; chop $it;
+                if($cmd =~ /date [\"\']\+(.*?)[\"\']/) {
+                  my $format=$1;
+                  $it=time2str($format, $ENV{SOURCE_DATE_EPOCH} || time, "UTC");
+                } else {
+                  $it= `$cmd`; chop $it;
+                }
                 print $fh $it;
             }
             print $fh $_;
