ngz pushed a commit to branch tex-team
in repository guix.
commit 8a7a3f45f7ce97f24c5f78d8df0150eafdf426e6
Author: Nicolas Goaziou <[email protected]>
AuthorDate: Tue Feb 11 09:47:21 2025 +0100
gnu: Make modular TeX Live reproducible.
Fixes: https://issues.guix.gnu.org/73613
* gnu/packages/tex.scm (texlive-aleph):
(texlive-amstex):
(texlive-eplain):
(texlive-hitex):
(texlive-lollipop):
(texlive-mex):
(texlive-mltex):
(texlive-texsis):
(texlive-luatex):
(texlive-xmltex):
(texlive-latex-bin):
(texlive-cslatex):
(texlive-mptopdf):
(texlive-mflua):
(texlive-luajittex):
(texlive-csplain):
(texlive-luahbtex):
(texlive-jadetex):
(texlive-pdftex):
(texlive-optex):
(texlive-context-legacy):
(texlive-everyshi):
(texlive-xetex): Add libfaketime to native inputs.
* guix/build/texlive-build-system.scm (enforce-source-date-epoch): New
function.
(create-formats): Wrap format generation within a `faketime' call.
(%standard-phases): Add a phase to obey to SOURCE_DATE_EPOCH.
Change-Id: Ieef6adb18b7f4373194e3550d41761f75334e574
---
gnu/packages/tex.scm | 34 ++++++++++++++++++++++++++++++----
guix/build/texlive-build-system.scm | 20 ++++++++++++++++++--
2 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index f0d68ef766..f6d8121013 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -69,6 +69,7 @@
#:use-module (gnu packages autotools)
#:use-module (gnu packages bash)
#:use-module (gnu packages boost)
+ #:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
#:use-module (gnu packages digest)
@@ -2440,6 +2441,7 @@ number styles are available.")
(outputs '("out" "doc"))
(build-system texlive-build-system)
(arguments (list #:create-formats #~(list "aleph")))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-aleph-bin
texlive-cm
@@ -3072,6 +3074,7 @@ create a bibliography.")
(mkdir-p bin)
(with-directory-excursion bin
(symlink pdftex "amstex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-amsfonts
texlive-cm
@@ -15744,6 +15747,7 @@ Cosmetica font, which is a similar design to Optima and
includes Greek.")
(mkdir-p bin)
(with-directory-excursion bin
(symlink pdftex "eplain"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -20477,6 +20481,7 @@ Indian Type Foundry, with support for LaTeX and
pdfLaTeX.")
(outputs '("out" "doc"))
(build-system texlive-build-system)
(arguments (list #:create-formats #~(list "hilatex" "hitex")))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -24728,6 +24733,7 @@ symbol variants more suited to work in logic.")
(mkdir-p bin)
(with-directory-excursion bin
(symlink tex "lollipop"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs (list texlive-cm texlive-hyphen-base texlive-tex))
(home-page "https://ctan.org/pkg/lollipop")
(synopsis "TeX made easy")
@@ -26771,6 +26777,7 @@ with symbols, giving automatic alignment.")
(symlink pdftex "mex")
(symlink pdftex "pdfmex")
(symlink pdftex "utf8mex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-enctex
texlive-hyphen-complete
@@ -27152,6 +27159,7 @@ avoids the spindliness of most other Type 1 versions of
Computer Modern.")
(with-directory-excursion bin
(symlink pdftex "mllatex")
(symlink pdftex "mltex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -36501,6 +36509,7 @@ produces.")
(mkdir-p bin)
(with-directory-excursion bin
(symlink pdftex "texsis"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-cm
texlive-hyphen-base
@@ -45094,6 +45103,7 @@ LaTeX packages use of @samp{@@@@}) in nested package
files.")
(mkdir-p bin)
(with-directory-excursion bin
(symlink euptex "platex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -45357,6 +45367,7 @@ their specific needs.")
(outputs '("out" "doc"))
(build-system texlive-build-system)
(arguments (list #:create-formats #~(list "eptex" "ptex")))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-cm
texlive-etex
@@ -46214,6 +46225,7 @@ of the fonts used in printers shops in Lispia.")
(arguments
(list #:texlive-latex-bin? #f
#:create-formats #~(list "tex")))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-cm
texlive-hyphen-base
@@ -46480,6 +46492,7 @@ barcodes.")
(mkdir-p bin)
(with-directory-excursion bin
(symlink euptex "uplatex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -46550,6 +46563,7 @@ and e-upTeX.")
(outputs '("out" "doc"))
(build-system texlive-build-system)
(arguments (list #:create-formats #~(list "euptex" "uptex")))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-cm
texlive-etex
@@ -48514,6 +48528,7 @@ environments and another with all extracted
environments converted to
#~(and (not #$(or (target-ppc64le?)
(target-riscv64?)))
(list "luajithbtex" "luajittex"))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-cm
texlive-etex
@@ -48630,6 +48645,7 @@ clearly show any mismatches.")
"0ngbhdh8hgpjfqnrjlnp27x3qziks3yf2zp1qq7r4bjfa5jx9gr6"))))
(build-system texlive-build-system)
(arguments (list #:create-formats #~(list "mflua")))
+ (native-inputs (list libfaketime))
(propagated-inputs (list texlive-luatex texlive-metafont
texlive-mflua-bin))
(home-page "https://ctan.org/pkg/mflua")
(synopsis "Configuration and base files for MFLua")
@@ -49698,6 +49714,7 @@ information in the TFM file.")
(let ((perl (search-input-file inputs "/bin/perl")))
(substitute* "scripts/context/perl/mptopdf.pl"
(("exec perl") (string-append "exec " perl)))))))))
+ (native-inputs (list libfaketime))
(inputs (list perl))
(propagated-inputs (list texlive-pdftex texlive-plain))
(home-page "https://ctan.org/pkg/mptopdf")
@@ -50303,6 +50320,7 @@ see the structure of a document by looking at the
source file of the manual.")
(substitute* "source/cslatex/base/cslatex.ins"
(("\\keepsilent\n" all)
(string-append all "\\askforoverwritefalse\n"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-atbegshi
texlive-atveryend
@@ -58204,6 +58222,7 @@ formats.")
(symlink pdftex "latex")
(symlink luahbtex "lualatex")
(symlink pdftex "pdflatex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -59187,6 +59206,7 @@ and @code{pdfxmltex}.")
(mkdir-p (string-append #$output "/bin"))
(symlink pdftex (string-append #$output "/bin/xmltex"))
(symlink pdftex (string-append #$output
"/bin/pdfxmltex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
@@ -60643,7 +60663,7 @@ in the same way as BSD/GNU @code{getopt_long(3)}
functions do.")
"TEXMFSYSCONFIG = \"$TEXMFDIST/../texmf-config\",\n")
(("TEXMF *=.*")
"TEXMF =
\"{$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,$TEXMFSYSCONFIG,$TEXMFSYSVAR,$TEXMFDIST}\",\n")))))))
- (native-inputs (list texlive-kpathsea))
+ (native-inputs (list libfaketime texlive-kpathsea))
(propagated-inputs
(list texlive-cm
texlive-etex
@@ -60767,7 +60787,7 @@ Either of the Plain and LaTeX2e formats may be used
with the package.")
(list
#:texlive-latex-bin? #f
#:create-formats #~(list "luahbtex")))
- (native-inputs (list texlive-kpathsea))
+ (native-inputs (list libfaketime texlive-kpathsea))
(propagated-inputs
(list texlive-cm
texlive-etex
@@ -61525,7 +61545,7 @@ available.")
(symlink pdftex "csplain")
(symlink pdftex "pdfcsplain")
(symlink luatex "luacsplain"))))))))
- (native-inputs (list texlive-xetex))
+ (native-inputs (list libfaketime texlive-xetex))
(propagated-inputs
(list texlive-cm
texlive-cs
@@ -70377,6 +70397,7 @@ of ink traps which typify the Kurier font.")
(with-directory-excursion bin
(symlink pdftex "jadetex")
(symlink pdftex "pdfjadetex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-amsfonts
texlive-auxhook
@@ -71297,6 +71318,7 @@ e-TeX.")
(string-append prefix
#$(this-package-input "ghostscript")
"/bin\"\n"))))))))
+ (native-inputs (list libfaketime))
(inputs (list ghostscript))
(propagated-inputs
(list texlive-cm
@@ -71828,6 +71850,7 @@ and back-ends. It also ensures compatibility with the
@code{media9} and
(mkdir-p bin)
(with-directory-excursion bin
(symlink luatex "optex"))))))))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-amsfonts
texlive-cm
@@ -73592,6 +73615,7 @@ to make the correct sequence of sections of a book
block visible.")
(list
#:link-scripts #~(list "texexec.rb" "texmfstart.rb")
#:create-formats #~(list "cont-en")))
+ (native-inputs (list libfaketime))
(inputs (list ruby))
(propagated-inputs (list texlive-context texlive-metapost texlive-mptopdf
texlive-pdftex texlive-xetex))
@@ -89830,7 +89854,8 @@ compatibility reasons.")
(lambda _
(delete-file-recursively "web2c"))))))
(native-inputs
- (list texlive-firstaid
+ (list libfaketime
+ texlive-firstaid
texlive-l3kernel
texlive-l3packages
texlive-latex
@@ -90532,6 +90557,7 @@ that it will build with web2c out of the box.")
(arguments
(list #:link-scripts #~(list "xelatex-unsafe.sh" "xetex-unsafe.sh")
#:create-formats #~(list "xelatex" "xetex")))
+ (native-inputs (list libfaketime))
(propagated-inputs
(list texlive-babel
texlive-cm
diff --git a/guix/build/texlive-build-system.scm
b/guix/build/texlive-build-system.scm
index 90936c178d..87f08d4ec6 100644
--- a/guix/build/texlive-build-system.scm
+++ b/guix/build/texlive-build-system.scm
@@ -91,6 +91,15 @@ runfile to replace. If a file has no matching runfile, it
is ignored."
((command-regexp _ command)
(which command))))))
+(define* (enforce-source-date-epoch #:rest _)
+ "Toggle FORCE_SOURCE_DATE in order to make some Web2C binaries obey to
+SOURCE_DATE_EPOCH.
+
+This is only a part of the solution to make TeX Live reproducible as format
+generation also needs to be wrapped within a `faketime' call in the
+`create-formats' phase."
+ (setenv "FORCE_SOURCE_DATE" "1"))
+
(define* (configure-texmf #:rest _)
"Ensure TEXMFVAR is writable and \"ls-R\" database is not required."
;; Default TEXMFVAR value is relative to $HOME, which is not set during
@@ -176,7 +185,8 @@ runfile to replace. If a file has no matching runfile, it
is ignored."
(install-as-runfiles "build" "\\.tfm$"))
local-sources)))
-(define* (create-formats #:key create-formats inputs #:allow-other-keys)
+(define* (create-formats
+ #:key create-formats native-inputs inputs #:allow-other-keys)
(define (collect-locations inputs pred)
(delete-duplicates
(append-map (match-lambda
@@ -194,7 +204,12 @@ runfile to replace. If a file has no matching runfile, it
is ignored."
(setenv "LUAINPUTS"
(string-join (collect-locations inputs "\\.lua$") ":"))
(mkdir-p "web2c")
- (for-each (cut invoke "fmtutil-sys" "--byfmt" <> "--fmtdir=web2c")
+ ;; The ".fmt" format files contain timestamps. Reset them.
+ (unless (assoc-ref (or native-inputs inputs) "libfaketime")
+ (error "Missing 'libfaketime' native input"))
+ (for-each (cut invoke
+ "faketime" "1970-01-01T00:00:00+00:00"
+ "fmtutil-sys" "--byfmt" <> "--fmtdir=web2c")
create-formats)
;; Remove cruft.
(for-each delete-file (find-files "web2c" "\\.log$"))))
@@ -302,6 +317,7 @@ runfile to replace. If a file has no matching runfile, it
is ignored."
(delete 'bootstrap)
(delete 'configure)
(add-after 'unpack 'patch-shell-scripts patch-shell-scripts)
+ (add-before 'build 'enforce-source-date-epoch enforce-source-date-epoch)
(add-before 'build 'configure-texmf configure-texmf)
(add-before 'build 'delete-drv-files delete-drv-files)
(add-after 'delete-drv-files 'generate-font-metrics generate-font-metrics)