Merge pull request #263878 from reckenrode/qt5-override-sdk

qt5.qtbase: switch to overrideSDK
This commit is contained in:
K900 2023-11-01 19:44:59 +03:00 committed by GitHub
commit d07f6b7c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 17 deletions

View File

@ -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 packages outputs to their original outPaths. # Map old frameworks to new ones and the packages 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 packages 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,13 +322,13 @@ 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.
if pkg != null && lib.getName pkg == "xcodebuild" if pkg != null && lib.isAttrs pkg && lib.getName pkg == "xcodebuild"
then pkg.override { stdenv = overrideSDK stdenv { inherit darwinMinVersion darwinSdkVersion; }; } then pkg.override { stdenv = overrideSDK stdenv { inherit darwinMinVersion darwinSdkVersion; }; }
else pkg; else pkg;
@ -364,6 +367,7 @@ rec {
"buildInputs" "buildInputs"
"nativeBuildInputs" "nativeBuildInputs"
"propagatedNativeBuildInputs" "propagatedNativeBuildInputs"
"propagatedBuildInputs"
]); ]);
}); });
} }

View File

@ -24667,7 +24667,7 @@ with pkgs;
darwin buildPackages; darwin buildPackages;
inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base; inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base;
inherit config; inherit config;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
}); });
libsForQt5 = recurseIntoAttrs (import ./qt5-packages.nix { libsForQt5 = recurseIntoAttrs (import ./qt5-packages.nix {

View File

@ -178,7 +178,8 @@ in (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdParty // kdeGea
pulseaudio-qt = callPackage ../development/libraries/pulseaudio-qt { }; pulseaudio-qt = callPackage ../development/libraries/pulseaudio-qt { };
qca-qt5 = pkgs.darwin.apple_sdk_11_0.callPackage ../development/libraries/qca-qt5 { qca-qt5 = callPackage ../development/libraries/qca-qt5 {
stdenv = if pkgs.stdenv.isDarwin then pkgs.overrideSDK pkgs.stdenv "11.0" else pkgs.stdenv;
inherit (libsForQt5) qtbase; inherit (libsForQt5) qtbase;
}; };
@ -209,8 +210,8 @@ in (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdParty // kdeGea
qtinstaller = callPackage ../development/libraries/qtinstaller { }; qtinstaller = callPackage ../development/libraries/qtinstaller { };
qtkeychain = callPackage ../development/libraries/qtkeychain { qtkeychain = callPackage ../development/libraries/qtkeychain {
stdenv = if pkgs.stdenv.isDarwin then pkgs.darwin.apple_sdk_11_0.stdenv else pkgs.stdenv; stdenv = if pkgs.stdenv.isDarwin then pkgs.overrideSDK pkgs.stdenv "11.0" else pkgs.stdenv;
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) CoreFoundation Security; inherit (pkgs.darwin.apple_sdk.frameworks) CoreFoundation Security;
}; };
qtmpris = callPackage ../development/libraries/qtmpris { }; qtmpris = callPackage ../development/libraries/qtmpris { };