texlive.combine: call faketime from within fmtutil

Calling 'faketime fmtutil' fails on some non-NixOS systems, due to
fmtutil calling system, and implicitly /bin/sh, which may be
incompatible with faketime's LD_PRELOAD (e.g. using a different glibc).
This change moves faketime within fmtutil so that LD_PRELOAD is applied
only to the final binary.
This commit is contained in:
Vincenzo Mantova 2023-05-08 12:41:41 +01:00
parent 22fcc0df22
commit c60d2ffe2e

View file

@ -248,7 +248,11 @@ in (buildEnv {
# libfaketime fixes non-determinism related to timestamps ignoring FORCE_SOURCE_DATE
# we cannot fix further randomness caused by luatex; for further details, see
# https://salsa.debian.org/live-team/live-build/-/blob/master/examples/hooks/reproducible/2006-reproducible-texlive-binaries-fmt-files.hook.chroot#L52
FORCE_SOURCE_DATE=1 TZ= faketime -f '@1980-01-01 00:00:00 x0.001' fmtutil --sys --all | grep '^fmtutil' # too verbose
# note that calling faketime and fmtutil is fragile (faketime uses LD_PRELOAD, fmtutil calls /bin/sh, causing potential glibc issues on non-NixOS)
# so we patch fmtutil to use faketime, rather than calling faketime fmtutil
substitute "$out/bin/fmtutil" fmtutil \
--replace 'my $cmdline = "$eng -ini ' 'my $cmdline = "faketime -f '"'"'\@1980-01-01 00:00:00 x0.001'"'"' $eng -ini '
FORCE_SOURCE_DATE=1 TZ= perl fmtutil --sys --all | grep '^fmtutil' # too verbose
#texlinks "$out/bin" && wrapBin # do we need to regenerate format links?
# Disable unavailable map files