1{ stdenv, klibc }:
2
3stdenv.mkDerivation {
4 # !!! For now, the name has to be exactly as long as the original
5 # name due to the sed hackery below. Once patchelf 0.4 is in the
6 # tree, we can do this properly.
7 #name = "${klibc.name}-shrunk";
8 name = klibc.name;
9 buildCommand = ''
10 mkdir -p $out/lib
11 cp -prd ${klibc.out}/lib/klibc/bin $out/
12 cp -p ${klibc.out}/lib/*.so $out/lib/
13 chmod +w $out/*
14 old=$(echo ${klibc.out}/lib/klibc-*.so)
15 new=$(echo $out/lib/klibc-*.so)
16 for i in $out/bin/*; do
17 echo $i
18 sed "s^$old^$new^" -i $i
19 # !!! use patchelf
20 #patchelf --set-interpreter $new $i
21 done
22 ''; # */
23 allowedReferences = [ "out" ];
24
25 inherit (klibc) meta;
26}