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}";
isSDKFramework = pkg: lib.hasPrefix "apple-framework-" (lib.getName pkg);
replacePropagatedFrameworks = pkg:
let
propagatedFrameworks = lib.filter isSDKFramework pkg.propagatedBuildInputs;
propagatedInputs = pkg.propagatedBuildInputs;
mappedInputs = map mapPackageToSDK propagatedInputs;
env = {
inherit (pkg) outputs;
# Map the old frameworks to new and the packages outputs to their original outPaths.
# The mappings are rendered into tab-separated files to be read back with `read`.
frameworks = lib.concatMapStrings (pkg: "${pkg}\t${mapPackageToSDK pkg}\n") propagatedFrameworks;
# Map old frameworks to new ones and the packages outputs to their original outPaths.
# Also map any packages that have propagated frameworks to their proxy packages using
# 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;
passAsFile = [ "frameworks" "pkgOutputs" ];
passAsFile = [ "dependencies" "pkgOutputs" ];
};
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 ''
# 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
@ -302,7 +305,7 @@ rec {
while IFS=$'\t\n' read -r oldFramework newFramework; do
substituteInPlace "''${!outputName}/nix-support/$fileName" \
--replace "$oldFramework" "$newFramework"
done < "$frameworksPath"
done < "$dependenciesPath"
fi
done
else
@ -319,13 +322,13 @@ rec {
name = lib.getName pkg;
framework = lib.removePrefix "apple-framework-" name;
in
if isSDKFramework pkg
then sdk.frameworks."${framework}"
else replacePropagatedFrameworks pkg;
/**/ if pkg == null then pkg
else if name != framework then sdk.frameworks."${framework}"
else replacePropagatedFrameworks pkg;
mapRuntimeToSDK = pkg:
# 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; }; }
else pkg;
@ -364,6 +367,7 @@ rec {
"buildInputs"
"nativeBuildInputs"
"propagatedNativeBuildInputs"
"propagatedBuildInputs"
]);
});
}

View File

@ -24667,7 +24667,7 @@ with pkgs;
darwin buildPackages;
inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base;
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 {

View File

@ -178,7 +178,8 @@ in (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdParty // kdeGea
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;
};
@ -209,8 +210,8 @@ in (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdParty // kdeGea
qtinstaller = callPackage ../development/libraries/qtinstaller { };
qtkeychain = callPackage ../development/libraries/qtkeychain {
stdenv = if pkgs.stdenv.isDarwin then pkgs.darwin.apple_sdk_11_0.stdenv else pkgs.stdenv;
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) CoreFoundation Security;
stdenv = if pkgs.stdenv.isDarwin then pkgs.overrideSDK pkgs.stdenv "11.0" else pkgs.stdenv;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreFoundation Security;
};
qtmpris = callPackage ../development/libraries/qtmpris { };