Merge pull request #265524 from Artturin/usemakescopew

This commit is contained in:
Artturi 2023-11-24 16:29:21 +02:00 committed by GitHub
commit 81ca4c3e22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 25 deletions

View File

@ -1,6 +1,8 @@
{ newScope
, lib
, stdenv
, generateSplicesForMkScope
, makeScopeWithSplicing'
, fetchurl
, fetchpatch
, fetchpatch2
@ -12,6 +14,7 @@
, overrideSDK
, buildPackages
, python3
, config
# options
, developerBuild ? false
@ -24,10 +27,11 @@ let
mirror = "mirror://qt";
};
addPackages = self: with self;
addPackages = self:
let
callPackage = self.newScope ({
inherit qtModule srcs python3;
inherit (self) qtModule;
inherit srcs python3;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
});
in
@ -58,7 +62,9 @@ let
];
};
env = callPackage ./qt-env.nix { };
full = env "qt-full-${qtbase.version}" ([
full = callPackage ({ env, qtbase }: env "qt-full-${qtbase.version}"
# `with self` is ok to use here because having these spliced is unnecessary
( with self;[
qt3d
qt5compat
qtcharts
@ -96,7 +102,7 @@ let
qtwebengine
qtwebsockets
qtwebview
] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ]);
] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ])) { };
qt3d = callPackage ./modules/qt3d.nix { };
qt5compat = callPackage ./modules/qt5compat.nix { };
@ -149,11 +155,11 @@ let
GameController ImageCaptureCore LocalAuthentication
MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz
ReplayKit SecurityInterface Vision;
qtModule = qtModule.override {
qtModule = callPackage ({ qtModule }: qtModule.override {
stdenv = if stdenv.isDarwin
then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; }
else stdenv;
};
}) { };
xcbuild = buildPackages.xcbuild.override {
productBuildVer = "20A2408";
};
@ -163,26 +169,32 @@ let
inherit (darwin.apple_sdk_11_0.frameworks) WebKit;
};
wrapQtAppsHook = makeSetupHook
wrapQtAppsHook = callPackage ({ makeBinaryWrapper }: makeSetupHook
{
name = "wrap-qt6-apps-hook";
propagatedBuildInputs = [ buildPackages.makeBinaryWrapper ];
} ./hooks/wrap-qt-apps-hook.sh;
propagatedBuildInputs = [ makeBinaryWrapper ];
} ./hooks/wrap-qt-apps-hook.sh) { };
qmake = makeSetupHook
qmake = callPackage ({ qtbase }: makeSetupHook
{
name = "qmake6-hook";
propagatedBuildInputs = [ self.qtbase.dev ];
propagatedBuildInputs = [ qtbase.dev ];
substitutions = {
inherit debug;
fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh;
};
} ./hooks/qmake-hook.sh;
} ./hooks/qmake-hook.sh) { };
} // lib.optionalAttrs config.allowAliases {
# Convert to a throw on 03-01-2023 and backport the change.
# Warnings show up in various cli tool outputs, throws do not.
# Remove completely before 24.05
overrideScope' = lib.warnIf (lib.isInOldestRelease 2311) "qt6 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
};
# TODO(@Artturin): convert to makeScopeWithSplicing'
# simple example of how to do that in 5568a4d25ca406809530420996d57e0876ca1a01
baseScope = lib.makeScope newScope addPackages;
baseScope = makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "qt6";
f = addPackages;
};
bootstrapScope = baseScope.overrideScope(final: prev: {
qtbase = prev.qtbase.override { qttranslations = null; };

View File

@ -24665,7 +24665,7 @@ with pkgs;
qt6 = recurseIntoAttrs (callPackage ../development/libraries/qt-6 { });
qt6Packages = recurseIntoAttrs (import ./qt6-packages.nix {
inherit lib pkgs qt6;
inherit lib __splicedPackages makeScopeWithSplicing' generateSplicesForMkScope pkgsBuildHost;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
});

View File

@ -266,8 +266,9 @@ in (noExtraAttrs (kdeFrameworks // plasmaMobileGear // plasma5 // plasma5.thirdP
yuview = callPackage ../applications/video/yuview { };
}) // lib.optionalAttrs pkgs.config.allowAliases {
# remove after 23.11 branch-off and backport removal to 23.11
# 23.11 will have a warning for this in `makeScope` itself
# Convert to a throw on 01-01-2023.
# Warnings show up in various cli tool outputs, throws do not.
# Remove completely before 24.05
overrideScope' = lib.warn "libsForQt5 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
}));
}

View File

@ -5,17 +5,27 @@
# this file.
{ lib
, pkgs
, qt6
, __splicedPackages
, makeScopeWithSplicing'
, generateSplicesForMkScope
, stdenv
, pkgsBuildHost
}:
(lib.makeScope pkgs.newScope ( self:
let
callPackage = self.callPackage;
pkgs = __splicedPackages;
# qt6 set should not be pre-spliced to prevent spliced packages being a part of an unspliced set
# 'pkgsCross.aarch64-multiplatform.pkgsBuildTarget.targetPackages.qt6Packages.qtbase' should not have a `__spliced` but if qt6 is pre-spliced then it will have one.
# pkgsBuildHost == pkgs
qt6 = pkgsBuildHost.qt6;
in
(qt6 // {
makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "qt6Packages";
f = (self: let
inherit (self) callPackage;
noExtraAttrs = set: lib.attrsets.removeAttrs set [ "extend" "override" "overrideScope" "overrideScope'" "overrideDerivation" ];
in (noExtraAttrs qt6) // {
inherit stdenv;
# LIBRARIES
@ -45,4 +55,11 @@ in
qt6Support = true;
suffix = "qt6";
};
})))
} // lib.optionalAttrs pkgs.config.allowAliases {
# Convert to a throw on 01-01-2023.
# Warnings show up in various cli tool outputs, throws do not.
# Remove completely before 24.05
overrideScope' = lib.warn "qt6Packages now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
});
}