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.
5 "${libidn2.pname}-${libidn2.version}"
7 outputs = [ "bin" "dev" "out" ];
9 inherit (libidn2) out info devdoc; # no need to touch these store paths
13 cp -r '${libidn2.bin}' "$bin"
16 --set-interpreter '${stdenv.cc.bintools.dynamicLinker}' \
17 --set-rpath '${lib.concatMapStringsSep ":" (p: lib.getLib p + "/lib")
18 [ stdenv.cc.libc libunistring libidn2 ]}' \
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"
28 ln -s '${libidn2.out}' "$out" # it's hard to be without any $out