swift-corelibs: set NIX_COREFOUNDATION_RPATH in a hook

Closes #230870. Thanks to @eliasnaur for the test case and for rasining
awareness and to @veprbl for the work done on #111385.

This takes a slightly different approach from those two PRs. The hook is
set unconditionally. The stdenv bootstrap doesn’t really need CF at all,
so setting the hook is harmless. This simplifies things.
This commit is contained in:
Randy Eckenrode 2023-05-19 15:49:09 -04:00
parent 5611fa71ab
commit 0d3355a439
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
2 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, fetchurl, ninja, python3, curl, libxml2, objc4, ICU }:
{ lib, stdenv, fetchFromGitHub, fetchurl, makeSetupHook, ninja, python3, curl, libxml2, objc4, ICU }:
let
# 10.12 adds a new sysdir.h that our version of CF in the main derivation depends on, but
@ -104,4 +104,6 @@ stdenv.mkDerivation {
ln -s Versions/Current/$i $base/$i
done
'';
darwinEnvHook = makeSetupHook { name = "darwin-env-hook"; } ./pure-corefoundation-hook.sh;
}

View File

@ -0,0 +1,7 @@
usePureCoreFoundation() {
# Avoid overriding value set by the impure CF
if [ -z "${NIX_COREFOUNDATION_RPATH:-}" ]; then
export NIX_COREFOUNDATION_RPATH=@out@/Library/Frameworks
fi
}
addEnvHooks "$hostOffset" usePureCoreFoundation