stdenvAdapters.overrideSDK: update the SDK version recursively
Update all propagated build inputs recursively, so that propagated inputs with propagated inputs use the correct SDK.
This commit is contained in:
parent
6e4f3b7d86
commit
50d046c32a
@ -263,21 +263,24 @@ rec {
|
|||||||
|
|
||||||
sdk = pkgs.darwin."apple_sdk_${lib.replaceStrings [ "." ] [ "_" ] darwinSdkVersion}";
|
sdk = pkgs.darwin."apple_sdk_${lib.replaceStrings [ "." ] [ "_" ] darwinSdkVersion}";
|
||||||
|
|
||||||
isSDKFramework = pkg: lib.hasPrefix "apple-framework-" (lib.getName pkg);
|
|
||||||
|
|
||||||
replacePropagatedFrameworks = pkg:
|
replacePropagatedFrameworks = pkg:
|
||||||
let
|
let
|
||||||
propagatedFrameworks = lib.filter isSDKFramework pkg.propagatedBuildInputs;
|
propagatedInputs = pkg.propagatedBuildInputs;
|
||||||
|
mappedInputs = map mapPackageToSDK propagatedInputs;
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
inherit (pkg) outputs;
|
inherit (pkg) outputs;
|
||||||
# Map the old frameworks to new and the package’s outputs to their original outPaths.
|
# Map old frameworks to new ones and the package’s outputs to their original outPaths.
|
||||||
# The mappings are rendered into tab-separated files to be read back with `read`.
|
# Also map any packages that have propagated frameworks to their proxy packages using
|
||||||
frameworks = lib.concatMapStrings (pkg: "${pkg}\t${mapPackageToSDK pkg}\n") propagatedFrameworks;
|
# the requested SDK version. These mappings are rendered into tab-separated files to be
|
||||||
|
# parsed and read back with `read`.
|
||||||
|
dependencies = lib.concatMapStrings (pair: "${pair.fst}\t${pair.snd}\n") (lib.zipLists propagatedInputs mappedInputs);
|
||||||
pkgOutputs = lib.concatMapStrings (output: "${output}\t${(lib.getOutput output pkg).outPath}\n") pkg.outputs;
|
pkgOutputs = lib.concatMapStrings (output: "${output}\t${(lib.getOutput output pkg).outPath}\n") pkg.outputs;
|
||||||
passAsFile = [ "frameworks" "pkgOutputs" ];
|
passAsFile = [ "dependencies" "pkgOutputs" ];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
if lib.length propagatedFrameworks > 0
|
# Only remap the package’s propagated inputs if there are any and if any of them were themselves remapped.
|
||||||
|
if lib.length propagatedInputs > 0 && propagatedInputs != mappedInputs
|
||||||
then pkgs.runCommand pkg.name env ''
|
then pkgs.runCommand pkg.name env ''
|
||||||
# Iterate over the outputs in the package being replaced to make sure the proxy is
|
# Iterate over the outputs in the package being replaced to make sure the proxy is
|
||||||
# a fully functional replacement. This is like `symlinkJoin` except for outputs and
|
# a fully functional replacement. This is like `symlinkJoin` except for outputs and
|
||||||
@ -302,7 +305,7 @@ rec {
|
|||||||
while IFS=$'\t\n' read -r oldFramework newFramework; do
|
while IFS=$'\t\n' read -r oldFramework newFramework; do
|
||||||
substituteInPlace "''${!outputName}/nix-support/$fileName" \
|
substituteInPlace "''${!outputName}/nix-support/$fileName" \
|
||||||
--replace "$oldFramework" "$newFramework"
|
--replace "$oldFramework" "$newFramework"
|
||||||
done < "$frameworksPath"
|
done < "$dependenciesPath"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@ -319,9 +322,9 @@ rec {
|
|||||||
name = lib.getName pkg;
|
name = lib.getName pkg;
|
||||||
framework = lib.removePrefix "apple-framework-" name;
|
framework = lib.removePrefix "apple-framework-" name;
|
||||||
in
|
in
|
||||||
if isSDKFramework pkg
|
/**/ if pkg == null then pkg
|
||||||
then sdk.frameworks."${framework}"
|
else if name != framework then sdk.frameworks."${framework}"
|
||||||
else replacePropagatedFrameworks pkg;
|
else replacePropagatedFrameworks pkg;
|
||||||
|
|
||||||
mapRuntimeToSDK = pkg:
|
mapRuntimeToSDK = pkg:
|
||||||
# Only remap xcbuild for now, which exports the SDK used to build it.
|
# Only remap xcbuild for now, which exports the SDK used to build it.
|
||||||
|
Loading…
Reference in New Issue
Block a user