mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
Merge #175785: libidn2: hack to avoid referencing bootstrap tools
...into staging
This commit is contained in:
commit
5ffd19ddbf
@ -17,6 +17,7 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
# Beware: non-bootstrap libidn2 is overridden by ./hack.nix
|
||||
outputs = [ "bin" "dev" "out" "info" "devdoc" ];
|
||||
|
||||
patches = optional stdenv.isDarwin ./fix-error-darwin.patch;
|
||||
|
@ -0,0 +1,30 @@
|
||||
{ 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
|
||||
};
|
||||
}
|
||||
''
|
||||
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
|
||||
''
|
||||
|
@ -436,8 +436,16 @@ in
|
||||
inherit (prevStage)
|
||||
gzip bzip2 xz bash coreutils diffutils findutils gawk
|
||||
gnumake gnused gnutar gnugrep gnupatch patchelf
|
||||
attr acl zlib pcre libunistring libidn2;
|
||||
attr acl zlib pcre libunistring;
|
||||
${localSystem.libc} = getLibc prevStage;
|
||||
|
||||
# Hack: avoid libidn2.{bin,dev} referencing bootstrap tools. There's a logical cycle.
|
||||
libidn2 = import ../../development/libraries/libidn2/no-bootstrap-reference.nix {
|
||||
inherit lib;
|
||||
inherit (prevStage) libidn2;
|
||||
inherit (self) stdenv runCommandLocal patchelf libunistring;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
# Need to get rid of these when cross-compiling.
|
||||
inherit (prevStage) binutils binutils-unwrapped;
|
||||
|
Loading…
Reference in New Issue
Block a user