about summary refs log tree commit diff
path: root/pkgs/development/interpreters/perl
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2021-10-26 13:48:51 +0300
committerArtturin <Artturin@artturin.com>2021-11-05 22:57:28 +0200
commitf7cfc8f319935cbed44703ce0614504fa186aa51 (patch)
tree0d790db2b29dd05196de8a68d008613bf126c103 /pkgs/development/interpreters/perl
parent0aa67239fac6cf9f130b99dca9ac79a4e2a3d09a (diff)
perl: build reproducibly
Diffstat (limited to 'pkgs/development/interpreters/perl')
-rw-r--r--pkgs/development/interpreters/perl/default.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix
index 45c12b9720c46..9b1b4d6121964 100644
--- a/pkgs/development/interpreters/perl/default.nix
+++ b/pkgs/development/interpreters/perl/default.nix
@@ -100,9 +100,22 @@ let
 
     enableParallelBuilding = !crossCompiling;
 
+    # perl includes the build date, the uname of the build system and the
+    # username of the build user in some files.
+    # We override these to make it build deterministically.
+    # other distro solutions
+    # https://github.com/bmwiedemann/openSUSE/blob/master/packages/p/perl/perl-reproducible.patch
+    # https://github.com/archlinux/svntogit-packages/blob/packages/perl/trunk/config.over
+    # https://salsa.debian.org/perl-team/interpreter/perl/blob/debian-5.26/debian/config.over
+    # A ticket has been opened upstream to possibly clean some of this up: https://rt.perl.org/Public/Bug/Display.html?id=133452
     preConfigure = ''
-        substituteInPlace ./Configure --replace '`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`' 'Thu Jan  1 00:00:01 UTC 1970'
-        substituteInPlace ./Configure --replace '$uname -a' '$uname --kernel-name --machine --operating-system'
+        cat > config.over <<EOF
+        ${lib.optionalString (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu) ''osvers="gnulinux"''}
+        myuname="nixpkgs"
+        myhostname="nixpkgs"
+        cf_by="nixpkgs"
+        cf_time="$(date -d "@$SOURCE_DATE_EPOCH")"
+        EOF
       '' + optionalString stdenv.isDarwin ''
         substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
       '' + optionalString (!enableThreading) ''