blob: ff8c479150672542d32cab3f727559925f9625a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
{
stdenv,
lib,
libidn2,
libunistring,
runCommandLocal,
patchelf,
}:
# 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.
runCommandLocal "${libidn2.pname}-${libidn2.version}"
{
outputs = [
"bin"
"dev"
"out"
];
passthru = {
inherit (libidn2) out info devdoc; # no need to touch these store paths
};
inherit (libidn2) meta pname version;
}
''
cp -r '${libidn2.bin}' "$bin"
chmod +w "$bin"/bin/*
patchelf \
--set-interpreter '${stdenv.cc.bintools.dynamicLinker}' \
--set-rpath '${
lib.concatMapStringsSep ":" (p: lib.getLib p + "/lib") [
stdenv.cc.libc
libunistring
libidn2
]
}' \
"$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
''
|