perl-5.20: break dependency on the compiler that built it

This is a major closure size reduction on Darwin, and probably a less
significant one on Linux. On darwin, retaining the compiler means adding
clang and its dependency llvm to the perl closure, which gives us ~400MB
of extra stuff. Considering that Nix itself depends on this version of
perl, that makes cutting a new Nix release rather unpleasaont Darwin.

After this patch, I was able to get the `nixUnstable` closure down to
21MB after feeding it into a .tar.xz (123MB before compression). There's
still room for improvement but this should carry us over until we split
outputs.
This commit is contained in:
Dan Peebles 2016-01-07 22:57:41 -05:00
parent 897fb98a96
commit 732495017b

View File

@ -93,6 +93,14 @@ stdenv.mkDerivation rec {
substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
'';
# Inspired by nuke-references, which I can't depend on because it uses perl. Perhaps it should just use sed :)
postInstall = ''
self=$(echo $out | sed -n "s|^$NIX_STORE/\\([a-z0-9]\{32\}\\)-.*|\1|p")
sed -i "/$self/b; s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" "$out"/lib/perl5/*/*/Config.pm
sed -i "/$self/b; s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" "$out"/lib/perl5/*/*/Config_heavy.pl
'';
setupHook = ./setup-hook.sh;
passthru.libPrefix = "lib/perl5/site_perl";