at 24.05-pre 30 lines 1.1 kB view raw
1{ stdenv, lib, libidn2, libunistring, runCommandLocal, patchelf }: 2# Construct a copy of libidn2.* where all (transitive) libc references (in .bin) 3# get replaced by a new one, so that there's no reference to bootstrap tools. 4runCommandLocal 5 "${libidn2.pname}-${libidn2.version}" 6 { 7 outputs = [ "bin" "dev" "out" ]; 8 passthru = { 9 inherit (libidn2) out info devdoc; # no need to touch these store paths 10 }; 11 } 12 '' 13 cp -r '${libidn2.bin}' "$bin" 14 chmod +w "$bin"/bin/* 15 patchelf \ 16 --set-interpreter '${stdenv.cc.bintools.dynamicLinker}' \ 17 --set-rpath '${lib.concatMapStringsSep ":" (p: lib.getLib p + "/lib") 18 [ stdenv.cc.libc libunistring libidn2 ]}' \ 19 "$bin"/bin/* 20 21 cp -r '${libidn2.dev}' "$dev" 22 chmod +w "$dev"/nix-support/propagated-build-inputs 23 substituteInPlace "$dev"/nix-support/propagated-build-inputs \ 24 --replace '${libidn2.bin}' "$bin" 25 substituteInPlace "$dev"/lib/pkgconfig/libidn2.pc \ 26 --replace '${libidn2.dev}' "$dev" 27 28 ln -s '${libidn2.out}' "$out" # it's hard to be without any $out 29 '' 30