diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index 8acc044894bca..ea65e5f3ae82c 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -42,7 +42,7 @@ let qtModule = callPackage ./qtModule.nix { }; qtbase = callPackage ./modules/qtbase.nix { - withGtk3 = true; + withGtk3 = !stdenv.hostPlatform.isMinGW; inherit (srcs.qtbase) src version; inherit developerBuild; inherit (darwin.apple_sdk_11_0.frameworks) @@ -69,47 +69,49 @@ let ]; }; env = callPackage ./qt-env.nix { }; - 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 - qtconnectivity - qtdatavis3d - qtdeclarative - qtdoc - qtgraphs - qtgrpc - qthttpserver - qtimageformats - qtlanguageserver - qtlocation - qtlottie - qtmultimedia - qtmqtt - qtnetworkauth - qtpositioning - qtsensors - qtserialbus - qtserialport - qtshadertools - qtspeech - qtquick3d - qtquick3dphysics - qtquickeffectmaker - qtquicktimeline - qtremoteobjects - qtsvg - qtscxml - qttools - qttranslations - qtvirtualkeyboard - qtwebchannel - qtwebengine - qtwebsockets - qtwebview - ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ qtwayland libglvnd ])) { }; + 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 + qtconnectivity + qtdatavis3d + qtdeclarative + qtdoc + qtgraphs + qtgrpc + qthttpserver + qtimageformats + qtlanguageserver + qtlocation + qtlottie + qtmultimedia + qtmqtt + qtnetworkauth + qtpositioning + qtsensors + qtserialbus + qtserialport + qtshadertools + qtspeech + qtquick3d + qtquick3dphysics + qtquickeffectmaker + qtquicktimeline + qtremoteobjects + qtsvg + qtscxml + qttools + qttranslations + qtvirtualkeyboard + qtwebchannel + qtwebengine + qtwebsockets + qtwebview + ] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ])) + { }; qt3d = callPackage ./modules/qt3d.nix { }; qt5compat = callPackage ./modules/qt5compat.nix { }; @@ -162,11 +164,14 @@ let GameController ImageCaptureCore LocalAuthentication MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz ReplayKit SecurityInterface Vision; - qtModule = callPackage ({ qtModule }: qtModule.override { - stdenv = if stdenv.hostPlatform.isDarwin - then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; } - else stdenv; - }) { }; + 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"; }; @@ -176,21 +181,25 @@ let inherit (darwin.apple_sdk_11_0.frameworks) WebKit; }; - wrapQtAppsHook = callPackage ({ makeBinaryWrapper }: makeSetupHook - { - name = "wrap-qt6-apps-hook"; - propagatedBuildInputs = [ makeBinaryWrapper ]; - } ./hooks/wrap-qt-apps-hook.sh) { }; + wrapQtAppsHook = callPackage + ({ makeBinaryWrapper }: makeSetupHook + { + name = "wrap-qt6-apps-hook"; + propagatedBuildInputs = [ makeBinaryWrapper ]; + } ./hooks/wrap-qt-apps-hook.sh) + { }; - qmake = callPackage ({ qtbase }: makeSetupHook - { - name = "qmake6-hook"; - propagatedBuildInputs = [ qtbase.dev ]; - substitutions = { - inherit debug; - fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh; - }; - } ./hooks/qmake-hook.sh) { }; + qmake = callPackage + ({ qtbase }: makeSetupHook + { + name = "qmake6-hook"; + propagatedBuildInputs = [ qtbase.dev ]; + substitutions = { + inherit debug; + fix_qmake_libtool = ./hooks/fix-qmake-libtool.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. @@ -203,12 +212,13 @@ let f = addPackages; }; - bootstrapScope = baseScope.overrideScope(final: prev: { + bootstrapScope = baseScope.overrideScope (final: prev: { qtbase = prev.qtbase.override { qttranslations = null; }; qtdeclarative = null; }); - finalScope = baseScope.overrideScope(final: prev: { + finalScope = baseScope.overrideScope (final: prev: { qttranslations = bootstrapScope.qttranslations; }); -in finalScope +in +finalScope diff --git a/pkgs/development/libraries/qt-6/modules/qtbase.nix b/pkgs/development/libraries/qt-6/modules/qtbase.nix index 26fdeceda61fb..0a16f725c4771 100644 --- a/pkgs/development/libraries/qt-6/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-6/modules/qtbase.nix @@ -4,6 +4,7 @@ , patches ? [ ] , version , coreutils +, buildPackages , bison , flex , gdb @@ -79,6 +80,8 @@ , EventKit , GSS , MetalKit + # mingw +, pkgsBuildBuild # optional dependencies , cups , libmysqlclient @@ -96,6 +99,7 @@ let debugSymbols = debug || developerBuild; + isCrossBuild = !stdenv.buildPlatform.canExecute stdenv.hostPlatform; in stdenv.mkDerivation rec { pname = "qtbase"; @@ -110,7 +114,6 @@ stdenv.mkDerivation rec { openssl sqlite zlib - unixODBC # Text rendering harfbuzz icu @@ -119,14 +122,16 @@ stdenv.mkDerivation rec { libpng pcre2 pcre - libproxy zstd - double-conversion libb2 md4c + double-conversion + ] ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ + libproxy dbus glib # unixODBC drivers + unixODBC unixODBCDrivers.psql unixODBCDrivers.sqlite unixODBCDrivers.mariadb @@ -174,11 +179,16 @@ stdenv.mkDerivation rec { EventKit GSS MetalKit - ] ++ lib.optional libGLSupported libGL; + ] ++ lib.optionals libGLSupported [ + libGL + ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ + vulkan-headers + vulkan-loader + ]; - buildInputs = [ + buildInputs = lib.optionals (lib.meta.availableOn stdenv.hostPlatform at-spi2-core) [ at-spi2-core - ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libinput) [ libinput ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ AppKit @@ -186,9 +196,9 @@ stdenv.mkDerivation rec { ] ++ lib.optional withGtk3 gtk3 ++ lib.optional developerBuild gdb - ++ lib.optional (cups != null) cups - ++ lib.optional (libmysqlclient != null) libmysqlclient - ++ lib.optional (postgresql != null) postgresql; + ++ lib.optional (cups != null && lib.meta.availableOn stdenv.hostPlatform cups) cups + ++ lib.optional (libmysqlclient != null && !stdenv.hostPlatform.isMinGW) libmysqlclient + ++ lib.optional (postgresql != null && lib.meta.availableOn stdenv.hostPlatform postgresql) postgresql; nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which cmake xmlstarlet ninja ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ]; @@ -203,7 +213,7 @@ stdenv.mkDerivation rec { # https://bugreports.qt.io/browse/QTBUG-97568 postPatch = '' - substituteInPlace src/corelib/CMakeLists.txt --replace-fail "/bin/ls" "${coreutils}/bin/ls" + substituteInPlace src/corelib/CMakeLists.txt --replace-fail "/bin/ls" "${buildPackages.coreutils}/bin/ls" '' + lib.optionalString stdenv.hostPlatform.isDarwin '' substituteInPlace cmake/QtPublicAppleHelpers.cmake --replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun" ''; @@ -232,7 +242,11 @@ stdenv.mkDerivation rec { ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # error: 'path' is unavailable: introduced in macOS 10.15 "-DQT_FEATURE_cxx17_filesystem=OFF" - ] ++ lib.optional (qttranslations != null) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations"; + ] ++ lib.optionals isCrossBuild [ + "-DQT_HOST_PATH=${pkgsBuildBuild.qt6.qtbase}" + "-DQt6HostInfo_DIR=${pkgsBuildBuild.qt6.qtbase}/lib/cmake/Qt6HostInfo" + ] + ++ lib.optional (qttranslations != null && !isCrossBuild) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations"; env.NIX_LDFLAGS = toString (lib.optionals stdenv.hostPlatform.isDarwin [ # Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc" @@ -253,6 +267,8 @@ stdenv.mkDerivation rec { dontStrip = debugSymbols; + dontWrapQtApps = true; + setupHook = ../hooks/qtbase-setup-hook.sh; meta = with lib; { @@ -260,6 +276,6 @@ stdenv.mkDerivation rec { description = "A cross-platform application framework for C++"; license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ]; maintainers = with maintainers; [ milahu nickcao LunNova ]; - platforms = platforms.unix; + platforms = platforms.unix ++ platforms.windows; }; }