Merge pull request #225555 from NickCao/qt6-cleanup

qt6: general cleanup to ease future reworking of packaging
This commit is contained in:
Nick Cao 2023-04-11 07:39:53 +08:00 committed by GitHub
commit 528dd7fa25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 56 deletions

View File

@ -2,26 +2,11 @@
, lib
, stdenv
, fetchurl
, fetchgit
, fetchpatch
, fetchFromGitHub
, makeSetupHook
, makeWrapper
, bison
, cups
, harfbuzz
, libGL
, perl
, cmake
, ninja
, writeText
, gstreamer
, gst-plugins-base
, gst-plugins-good
, gst-libav
, gst-vaapi
, gtk3
, dconf
, gst_all_1
, libglvnd
, darwin
, buildPackages
@ -37,23 +22,28 @@ let
mirror = "mirror://qt";
};
qtModule =
import ./qtModule.nix
{ inherit stdenv lib perl cmake ninja writeText; }
{ inherit self srcs; };
addPackages = self: with self;
let
callPackage = self.newScope ({ inherit qtModule stdenv srcs; });
callPackage = self.newScope ({
inherit qtModule srcs;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
cmake = cmake.overrideAttrs (attrs: {
patches = attrs.patches ++ [
./patches/cmake.patch
];
});
});
in
{
inherit callPackage qtModule srcs;
inherit callPackage srcs;
qtModule = callPackage ./qtModule.nix { };
qtbase = callPackage ./modules/qtbase.nix {
withGtk3 = true;
inherit (srcs.qtbase) src version;
inherit bison cups harfbuzz libGL dconf gtk3 developerBuild cmake;
inherit developerBuild;
inherit (darwin.apple_sdk_11_0.frameworks) AGL AVFoundation AppKit GSS MetalKit;
patches = [
./patches/qtbase-qmake-mkspecs-mac.patch
@ -68,7 +58,7 @@ let
})
];
};
env = callPackage ./qt-env.nix {};
env = callPackage ./qt-env.nix { };
full = env "qt-full-${qtbase.version}" ([
qt3d
qt5compat
@ -111,7 +101,7 @@ let
qtlanguageserver = callPackage ./modules/qtlanguageserver.nix { };
qtlottie = callPackage ./modules/qtlottie.nix { };
qtmultimedia = callPackage ./modules/qtmultimedia.nix {
inherit gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi;
inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi;
inherit (darwin.apple_sdk_11_0.frameworks) VideoToolbox;
};
qtnetworkauth = callPackage ./modules/qtnetworkauth.nix { };
@ -140,19 +130,21 @@ let
inherit (darwin.apple_sdk_11_0.frameworks) WebKit;
};
wrapQtAppsHook = makeSetupHook {
name = "wrap-qt6-apps-hook";
propagatedBuildInputs = [ buildPackages.makeWrapper ];
wrapQtAppsHook = makeSetupHook
{
name = "wrap-qt6-apps-hook";
propagatedBuildInputs = [ buildPackages.makeWrapper ];
} ./hooks/wrap-qt-apps-hook.sh;
qmake = makeSetupHook {
name = "qmake6-hook";
propagatedBuildInputs = [ self.qtbase.dev ];
substitutions = {
inherit debug;
fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh;
};
} ./hooks/qmake-hook.sh;
qmake = makeSetupHook
{
name = "qmake6-hook";
propagatedBuildInputs = [ self.qtbase.dev ];
substitutions = {
inherit debug;
fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh;
};
} ./hooks/qmake-hook.sh;
};
# TODO(@Artturin): convert to makeScopeWithSplicing

View File

@ -1,6 +1,4 @@
{ stdenv, lib, perl, cmake, ninja, writeText }:
{ self, srcs, patches ? [ ] }:
{ stdenv, lib, perl, cmake, ninja, writeText, qtbase, qmake, srcs, patches ? [ ] }:
args:
@ -18,7 +16,7 @@ stdenv.mkDerivation (args // {
perl
cmake
ninja
self.qmake
qmake
];
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or [ ]);
@ -61,7 +59,7 @@ stdenv.mkDerivation (args // {
if [[ -z "$dontSyncQt" && -f sync.profile ]]; then
# FIXME: this probably breaks crosscompiling as it's not from nativeBuildInputs
# I don't know how to get /libexec from nativeBuildInputs to work, it's not under /bin
${lib.getDev self.qtbase}/libexec/syncqt.pl -version "''${version%%-*}"
${lib.getDev qtbase}/libexec/syncqt.pl -version "''${version%%-*}"
fi
'';

View File

@ -23227,20 +23227,7 @@ with pkgs;
qtEnv = qt5.env;
qt5Full = qt5.full;
qt6 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-6) {
inherit newScope;
inherit lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper writeText;
inherit bison cups dconf harfbuzz libGL perl gtk3 ninja;
inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi;
inherit darwin buildPackages libglvnd;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
cmake = cmake.overrideAttrs (attrs: {
patches = attrs.patches ++ [
../development/libraries/qt-6/patches/cmake.patch
];
});
});
qt6 = recurseIntoAttrs (callPackage ../development/libraries/qt-6 { });
qt6Packages = recurseIntoAttrs (import ./qt6-packages.nix {
inherit lib pkgs qt6;