Merge #175785: libidn2: hack to avoid referencing bootstrap tools

...into staging

+40 -1
+1
pkgs/development/libraries/libidn2/default.nix
··· 17 }; 18 19 strictDeps = true; 20 outputs = [ "bin" "dev" "out" "info" "devdoc" ]; 21 22 patches = optional stdenv.isDarwin ./fix-error-darwin.patch;
··· 17 }; 18 19 strictDeps = true; 20 + # Beware: non-bootstrap libidn2 is overridden by ./hack.nix 21 outputs = [ "bin" "dev" "out" "info" "devdoc" ]; 22 23 patches = optional stdenv.isDarwin ./fix-error-darwin.patch;
+30
pkgs/development/libraries/libidn2/no-bootstrap-reference.nix
···
··· 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. 4 + runCommandLocal 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 +
+9 -1
pkgs/stdenv/linux/default.nix
··· 436 inherit (prevStage) 437 gzip bzip2 xz bash coreutils diffutils findutils gawk 438 gnumake gnused gnutar gnugrep gnupatch patchelf 439 - attr acl zlib pcre libunistring libidn2; 440 ${localSystem.libc} = getLibc prevStage; 441 } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { 442 # Need to get rid of these when cross-compiling. 443 inherit (prevStage) binutils binutils-unwrapped;
··· 436 inherit (prevStage) 437 gzip bzip2 xz bash coreutils diffutils findutils gawk 438 gnumake gnused gnutar gnugrep gnupatch patchelf 439 + attr acl zlib pcre libunistring; 440 ${localSystem.libc} = getLibc prevStage; 441 + 442 + # Hack: avoid libidn2.{bin,dev} referencing bootstrap tools. There's a logical cycle. 443 + libidn2 = import ../../development/libraries/libidn2/no-bootstrap-reference.nix { 444 + inherit lib; 445 + inherit (prevStage) libidn2; 446 + inherit (self) stdenv runCommandLocal patchelf libunistring; 447 + }; 448 + 449 } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { 450 # Need to get rid of these when cross-compiling. 451 inherit (prevStage) binutils binutils-unwrapped;