Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions packages/perl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,27 @@ export CFLAGS="$MARCH -O2 -pipe -gno-record-gcc-switches -ffile-prefix-map=$(pwd
export LDFLAGS="-Wl,--build-id=none"
export CXXFLAGS="${CFLAGS}"

# Perl's Configure bakes the wall-clock build time into Config (cf_time/cf_by),
# which makes the build non-reproducible. Pin both deterministically.
export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-0}"
CF_TIME="$(LC_ALL=C TZ=UTC date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null || echo 'Thu Jan 1 00:00:00 UTC 1970')"
# Perl's Configure recomputes cf_time from `date` UNCONDITIONALLY, so a
# `-D cf_time=` override does NOT stick — the wall-clock still leaks into cf_time,
# which feeds $config_tag1 (perlbug/perlthanks) and the "Configuration time" line
# in Config_heavy.pl. config.over is sourced AFTER all of Configure's computation
# (perl's documented override hook), so pin cf_time/cf_by there instead.
# The sandbox already exports SOURCE_DATE_EPOCH — read it (with a fallback), don't re-set it.
CF_TIME="$(LC_ALL=C TZ=UTC date -u -d "@${SOURCE_DATE_EPOCH:-0}" 2>/dev/null || echo 'Thu Jan 1 00:00:00 UTC 1970')"
# Configure also bakes the build host's nodename (in the sandbox a per-build
# `minimal-<pid>` hostname) into several Config fields: myuname (the "Target
# system" line, via `uname -a`), myhostname, and the derived cf_email/perladmin.
# config.over is sourced after all computation, so pin every host-derived field
# here. myuname keeps the real kernel info with just the nodename sanitized.
MYUNAME="$(uname -a | awk '{$2="builder"; print}' | tr '[:upper:]' '[:lower:]' | tr -d '/')"
cat > config.over <<EOF
cf_time='$CF_TIME'
cf_by='builder'
myuname='$MYUNAME'
myhostname='builder'
cf_email='build@builder'
perladmin='build@builder'
EOF

sh Configure -des \
-D cc=gcc \
Expand All @@ -34,9 +51,7 @@ sh Configure -des \
-D man3dir=/usr/share/man/man3 \
-D pager="/usr/bin/less -isR" \
-D useshrplib \
-D usethreads \
-D cf_time="$CF_TIME" \
-D cf_by=builder
-D usethreads

make -j$(nproc)
# TEST_JOBS=$(nproc) make test_harness # TODO there are failures
Expand Down