2024-06-30 08:12:46 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
libidn2,
|
|
|
|
libunistring,
|
|
|
|
runCommandLocal,
|
|
|
|
patchelf,
|
|
|
|
}:
|
2024-05-02 00:46:19 +00:00
|
|
|
# Construct a copy of libidn2.* where all (transitive) libc references (in .bin)
|
|
|
|
# get replaced by a new one, so that there's no reference to bootstrap tools.
|
2024-06-30 08:12:46 +00:00
|
|
|
runCommandLocal "${libidn2.pname}-${libidn2.version}"
|
2024-05-02 00:46:19 +00:00
|
|
|
{
|
2024-06-30 08:12:46 +00:00
|
|
|
outputs = [
|
|
|
|
"bin"
|
|
|
|
"dev"
|
|
|
|
"out"
|
|
|
|
];
|
2024-05-02 00:46:19 +00:00
|
|
|
passthru = {
|
|
|
|
inherit (libidn2) out info devdoc; # no need to touch these store paths
|
|
|
|
};
|
|
|
|
inherit (libidn2) meta;
|
|
|
|
}
|
|
|
|
''
|
|
|
|
cp -r '${libidn2.bin}' "$bin"
|
|
|
|
chmod +w "$bin"/bin/*
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter '${stdenv.cc.bintools.dynamicLinker}' \
|
2024-06-30 08:12:46 +00:00
|
|
|
--set-rpath '${
|
|
|
|
lib.concatMapStringsSep ":" (p: lib.getLib p + "/lib") [
|
|
|
|
stdenv.cc.libc
|
|
|
|
libunistring
|
|
|
|
libidn2
|
|
|
|
]
|
|
|
|
}' \
|
2024-05-02 00:46:19 +00:00
|
|
|
"$bin"/bin/*
|
|
|
|
|
|
|
|
cp -r '${libidn2.dev}' "$dev"
|
|
|
|
chmod +w "$dev"/nix-support/propagated-build-inputs
|
|
|
|
substituteInPlace "$dev"/nix-support/propagated-build-inputs \
|
|
|
|
--replace '${libidn2.bin}' "$bin"
|
|
|
|
substituteInPlace "$dev"/lib/pkgconfig/libidn2.pc \
|
|
|
|
--replace '${libidn2.dev}' "$dev"
|
|
|
|
|
|
|
|
ln -s '${libidn2.out}' "$out" # it's hard to be without any $out
|
|
|
|
''
|