diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 022e459c3945ab1..073df78797c728b 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -100,6 +100,32 @@ rec { ]; }; + # given two patterns, return a pattern which is their logical AND. + # Since a pattern is a list-of-disjuncts, this needs to + patternLogicalAnd = pat1_: pat2_: + let + # patterns can be either a list or a (bare) singleton; turn + # them into singletons for uniform handling + pat1 = lib.toList pat1_; + pat2 = lib.toList pat2_; + in + lib.concatMap (attr1: + map (attr2: + lib.recursiveUpdateUntil + (path: subattr1: subattr2: + if (builtins.intersectAttrs subattr1 subattr2) == {} || subattr1 == subattr2 + then true + else throw '' + pattern conflict at path ${toString path}: + ${builtins.toJSON subattr1} + ${builtins.toJSON subattr2} + '') + attr1 + attr2 + ) + pat2) + pat1; + matchAnyAttrs = patterns: if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns else matchAttrs patterns; diff --git a/pkgs/applications/networking/browsers/qutebrowser/default.nix b/pkgs/applications/networking/browsers/qutebrowser/default.nix index 03b03724aeef19a..62bed5a34f0e640 100644 --- a/pkgs/applications/networking/browsers/qutebrowser/default.nix +++ b/pkgs/applications/networking/browsers/qutebrowser/default.nix @@ -12,9 +12,11 @@ , widevine-cdm , enableVulkan ? stdenv.isLinux , vulkan-loader +, buildPackages }: let + isQt6 = lib.versions.major qtbase.version == "6"; pdfjs = let version = "3.9.179"; in @@ -50,10 +52,14 @@ python3.pkgs.buildPythonApplication { ]; propagatedBuildInputs = with python3.pkgs; ([ - pyyaml pyqt6-webengine jinja2 pygments + pyyaml (if isQt6 then pyqt6-webengine else pyqtwebengine) jinja2 pygments # scripts and userscripts libs tldextract beautifulsoup4 - readability-lxml pykeepass stem + readability-lxml pykeepass + ] ++ lib.optionals ((builtins.tryEval stem.outPath).success) [ + # error: stem-1.8.2 not supported for interpreter python3.11 + stem + ] ++ [ pynacl # extensive ad blocking adblock @@ -80,7 +86,7 @@ python3.pkgs.buildPythonApplication { runHook preInstall make -f misc/Makefile \ - PYTHON=${python3}/bin/python3 \ + PYTHON=${buildPackages.python3}/bin/python3 \ PREFIX=. \ DESTDIR="$out" \ DATAROOTDIR=/share \ diff --git a/pkgs/by-name/ja/jasper/package.nix b/pkgs/by-name/ja/jasper/package.nix index 4e10eaa80ad83be..23171c71fbecbb1 100644 --- a/pkgs/by-name/ja/jasper/package.nix +++ b/pkgs/by-name/ja/jasper/package.nix @@ -48,5 +48,8 @@ stdenv.mkDerivation (finalAttrs: { license = lib.licenses.mit; maintainers = with lib.maintainers; [ AndersonTorres ]; platforms = lib.platforms.unix; + + # The value of __STDC_VERSION__ cannot be automatically determined when cross-compiling. + broken = stdenv.buildPlatform != stdenv.hostPlatform; }; }) diff --git a/pkgs/development/libraries/qt-5/5.15/default.nix b/pkgs/development/libraries/qt-5/5.15/default.nix index 8a859af37e9d56f..79b7ba1a79fc73f 100644 --- a/pkgs/development/libraries/qt-5/5.15/default.nix +++ b/pkgs/development/libraries/qt-5/5.15/default.nix @@ -11,6 +11,7 @@ Check for any minor version changes. , lib, stdenv, fetchurl, fetchgit, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper , bison, cups ? null, harfbuzz, libGL, perl, python3 , gstreamer, gst-plugins-base, gtk3, dconf +, buildPackages , darwin # options @@ -313,18 +314,20 @@ let qmake = callPackage ({ qtbase }: makeSetupHook { name = "qmake-hook"; - propagatedBuildInputs = [ qtbase.dev ]; + depsTargetTargetPropagated = [ qtbase.dev ]; substitutions = { inherit debug; fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh; }; } ../hooks/qmake-hook.sh) { }; - wrapQtAppsHook = callPackage ({ makeBinaryWrapper, qtbase, qtwayland }: makeSetupHook { + wrapQtAppsHook = callPackage ({ makeBinaryWrapper, qtbase, qtwayland }: makeSetupHook ({ name = "wrap-qt5-apps-hook"; - propagatedBuildInputs = [ qtbase.dev makeBinaryWrapper ] + propagatedBuildInputs = [ buildPackages.makeBinaryWrapper ]; + depsTargetTargetPropagated = [ qtbase.dev ] ++ lib.optional stdenv.isLinux qtwayland.dev; - } ../hooks/wrap-qt-apps-hook.sh) { }; + }) + ../hooks/wrap-qt-apps-hook.sh) { }; }; baseScope = makeScopeWithSplicing' { @@ -338,6 +341,12 @@ let }); finalScope = baseScope.overrideScope(final: prev: { - qttranslations = bootstrapScope.qttranslations; + # qttranslations causes eval-time infinite recursion when + # cross-compiling; disabled for now. + qttranslations = + if stdenv.buildPlatform == stdenv.hostPlatform + then bootstrapScope.qttranslations + else null; + qutebrowser = final.callPackage ../../../../applications/networking/browsers/qutebrowser { }; }); in finalScope diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh index 1b57d676e1fc5da..ccd7592dfd37efe 100644 --- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh @@ -1,3 +1,13 @@ +if [[ "x$stdenv" != "x@qtbase_stdenv@" ]]; then + echo "skipping qtbase-setup-hook.sh because of mismatch:" + echo " stdenv of current derivation: $stdenv" + echo " stdenv of qtbase.dev dependency: @qtbase_stdenv@" + echo " qtbase = @dev@" + return +fi + +echo "running qtbase-setup-hook.sh with hostOffset=$hostOffset targetOffset=$targetOffset: @out@" + if [[ -n "${__nix_qtbase-}" ]]; then # Throw an error if a different version of Qt was already set up. if [[ "$__nix_qtbase" != "@dev@" ]]; then diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 9f0feaf94e58412..3e51ffa5792ea45 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -29,13 +29,18 @@ , developerBuild ? false , decryptSslTraffic ? false , testers +, buildPackages }: let debugSymbols = debug || developerBuild; + qtPlatformCross = plat: with plat; + if isLinux + then "linux-generic-g++" + else throw "Please add a qtPlatformCross entry for ${plat.config}"; in -stdenv.mkDerivation (finalAttrs: { +stdenv.mkDerivation (finalAttrs: ({ pname = "qtbase"; inherit qtCompatVersion src version; debug = debugSymbols; @@ -83,6 +88,13 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which ] ++ lib.optionals stdenv.isDarwin [ xcbuild ]; + } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + # `qtbase` expects to find `cc` (with no prefix) in the + # `$PATH`, so the following is needed even if + # `stdenv.buildPlatform.canExecute stdenv.hostPlatform` + depsBuildBuild = [ buildPackages.stdenv.cc ]; + } // { + propagatedNativeBuildInputs = [ lndir ]; # libQt5Core links calls CoreFoundation APIs that call into the system ICU. Binaries linked @@ -162,6 +174,13 @@ stdenv.mkDerivation (finalAttrs: { export MAKEFLAGS+=" -j$NIX_BUILD_CORES" ./bin/syncqt.pl -version $version + '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + # QT's configure script will refuse to use pkg-config unless these two environment variables are set + export PKG_CONFIG_SYSROOT_DIR=/ + export PKG_CONFIG_LIBDIR=${lib.getLib pkg-config}/lib + echo "QMAKE_LFLAGS=''${LDFLAGS}" >> mkspecs/devices/${qtPlatformCross stdenv.hostPlatform}/qmake.conf + echo "QMAKE_CFLAGS=''${CFLAGS}" >> mkspecs/devices/${qtPlatformCross stdenv.hostPlatform}/qmake.conf + echo "QMAKE_CXXFLAGS=''${CXXFLAGS}" >> mkspecs/devices/${qtPlatformCross stdenv.hostPlatform}/qmake.conf ''; postConfigure = '' @@ -186,21 +205,35 @@ stdenv.mkDerivation (finalAttrs: { done ''; - env.NIX_CFLAGS_COMPILE = toString ([ - "-Wno-error=sign-compare" # freetype-2.5.4 changed signedness of some struct fields - ''-DNIXPKGS_QTCOMPOSE="${libX11.out}/share/X11/locale"'' - ''-DLIBRESOLV_SO="${stdenv.cc.libc.out}/lib/libresolv"'' - ''-DNIXPKGS_LIBXCURSOR="${libXcursor.out}/lib/libXcursor"'' - ] ++ lib.optional libGLSupported ''-DNIXPKGS_MESA_GL="${libGL.out}/lib/libGL"'' + env = { + qtbase_stdenv = stdenv.outPath; + NIX_CFLAGS_COMPILE = toString ([ + "-Wno-error=sign-compare" # freetype-2.5.4 changed signedness of some struct fields + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "-Wno-warn=free-nonheap-object" + "-Wno-free-nonheap-object" + "-w" + ] ++ [ + ''-DNIXPKGS_QTCOMPOSE="${libX11.out}/share/X11/locale"'' + ''-DLIBRESOLV_SO="${stdenv.cc.libc.out}/lib/libresolv"'' + ''-DNIXPKGS_LIBXCURSOR="${libXcursor.out}/lib/libXcursor"'' + ] ++ lib.optional libGLSupported ''-DNIXPKGS_MESA_GL="${libGL.out}/lib/libGL"'' ++ lib.optional stdenv.isLinux "-DUSE_X11" ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-darwin") [ # ignore "is only available on macOS 10.12.2 or newer" in obj-c code "-Wno-error=unguarded-availability" ] ++ lib.optionals withGtk3 [ - ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"'' - ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"'' - ] ++ lib.optional decryptSslTraffic "-DQT_DECRYPT_SSL_TRAFFIC"); + ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"'' + ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"'' + ] ++ lib.optional decryptSslTraffic "-DQT_DECRYPT_SSL_TRAFFIC"); + } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + NIX_CFLAGS_COMPILE_FOR_BUILD = toString ([ + "-Wno-warn=free-nonheap-object" + "-Wno-free-nonheap-object" + "-w" + ]); + }; prefixKey = "-prefix "; @@ -209,6 +242,9 @@ stdenv.mkDerivation (finalAttrs: { # To prevent these failures, we need to override PostgreSQL detection. PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq"; + } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + configurePlatforms = [ ]; + } // { # TODO Remove obsolete and useless flags once the build will be totally mastered configureFlags = [ "-plugindir $(out)/$(qtPluginPrefix)" @@ -235,11 +271,16 @@ stdenv.mkDerivation (finalAttrs: { "-L" "${icu.out}/lib" "-I" "${icu.dev}/include" "-pch" + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "-device ${qtPlatformCross stdenv.hostPlatform}" + "-device-option CROSS_COMPILE=${stdenv.cc.targetPrefix}" ] ++ lib.optional debugSymbols "-debug" ++ lib.optionals developerBuild [ "-developer-build" "-no-warnings-are-errors" + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "-no-warnings-are-errors" ] ++ (if (!stdenv.hostPlatform.isx86_64) then [ "-no-sse2" ] else [ @@ -381,4 +422,4 @@ stdenv.mkDerivation (finalAttrs: { platforms = platforms.unix; }; -}) +})) diff --git a/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix b/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix index 892498da43b29de..3e2136f39bcd9a1 100644 --- a/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix +++ b/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix @@ -1,4 +1,6 @@ -{ qtModule, lib, python3, qtbase, qtsvg }: +{ lib +, stdenv +, qtModule, python3, qtbase, qtsvg }: qtModule { pname = "qtdeclarative"; @@ -21,4 +23,10 @@ qtModule { "bin/qmlscene" "bin/qmltestrunner" ]; + postFixup = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + mv $dev/bin/qmlformat $bin/bin/qmlformat + mv $dev/bin/qmltyperegistrar $bin/bin/qmltyperegistrar + ln -s $bin/bin/qmlformat $dev/bin/qmlformat + ln -s $bin/bin/qmltyperegistrar $dev/bin/qmltyperegistrar + ''; } diff --git a/pkgs/development/libraries/qt-5/modules/qtimageformats.nix b/pkgs/development/libraries/qt-5/modules/qtimageformats.nix index f099fc6799b50f0..4775bb0b0383f6f 100644 --- a/pkgs/development/libraries/qt-5/modules/qtimageformats.nix +++ b/pkgs/development/libraries/qt-5/modules/qtimageformats.nix @@ -1,4 +1,6 @@ -{ qtModule +{ lib +, stdenv +, qtModule , qtbase , libwebp , jasper @@ -8,5 +10,11 @@ qtModule { pname = "qtimageformats"; - propagatedBuildInputs = [ qtbase libwebp jasper libmng libtiff ]; + propagatedBuildInputs = [ + qtbase libwebp + ] ++ lib.optionals (!jasper.meta.broken) [ + jasper + ] ++ [ + libmng libtiff + ]; } diff --git a/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix b/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix index 118a5d4f96f6904..e7d6be534409e61 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix @@ -1,7 +1,12 @@ -{ qtModule, qtbase, qtdeclarative }: +{ lib +, stdenv +, qtModule +, qtbase +, qtdeclarative +}: qtModule { pname = "qtwebchannel"; propagatedBuildInputs = [ qtbase qtdeclarative ]; - outputs = [ "out" "dev" "bin" ]; + outputs = [ "out" "dev" ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "bin" ]; } diff --git a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix index 777430af0217fc0..58f90763a2452ea 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix @@ -1,8 +1,11 @@ { qtModule , qtdeclarative, qtquickcontrols, qtlocation, qtwebchannel -, bison, flex, git, gperf, ninja, pkg-config, python, which +, bison, flex, git, gperf, ninja, pkg-config, python, which, python3 , nodejs, qtbase, perl +, buildPackages +, pkgsBuildTarget +, pkgsBuildBuild , xorg, libXcursor, libXScrnSaver, libXrandr, libXtst , fontconfig, freetype, harfbuzz, icu, dbus, libdrm @@ -27,12 +30,45 @@ , pipewireSupport ? stdenv.isLinux , pipewire_0_2 , postPatch ? "" +, nspr +, lndir +, dbusSupport ? !stdenv.isDarwin, expat }: -qtModule { +let + # qtwebengine expects to find an executable in $PATH which runs on + # the build platform yet knows about the host `.pc` files. Most + # configury allows setting $PKG_CONFIG to point to an + # arbitrarily-named script which serves this purpose; however QT + # insists that it is named `pkg-config` with no target prefix. So + # we re-wrap the host platform's pkg-config. + pkg-config-wrapped-without-prefix = stdenv.mkDerivation { + name = "pkg-config-wrapper-without-target-prefix"; + dontUnpack = true; + dontBuild = true; + installPhase = '' + mkdir -p $out/bin + ln -s '${buildPackages.pkg-config}/bin/${buildPackages.pkg-config.targetPrefix}pkg-config' $out/bin/pkg-config + ''; + }; + + qtPlatformCross = plat: with plat; + if isLinux + then "linux-generic-g++" + else throw "Please add a qtPlatformCross entry for ${plat.config}"; + +in + +qtModule ({ pname = "qtwebengine"; nativeBuildInputs = [ bison flex git gperf ninja pkg-config python which gn nodejs + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + perl + lndir (lib.getDev pkgsBuildTarget.targetPackages.qt5.qtbase) + pkgsBuildBuild.pkg-config + (lib.getDev pkgsBuildTarget.targetPackages.qt5.qtquickcontrols) + pkg-config-wrapped-without-prefix ] ++ lib.optional stdenv.isDarwin xcbuild; doCheck = true; outputs = [ "bin" "dev" "out" ]; @@ -108,16 +144,25 @@ qtModule { --replace "-Wl,-fatal_warnings" "" '') + postPatch; - env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [ - # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit - "-Wno-class-memaccess" - ] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [ - # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940 - # TODO: investigate and fix properly - "-march=westmere" - ] ++ lib.optionals stdenv.cc.isClang [ - "-Wno-elaborated-enum-base" - ]); + env = { + NIX_CFLAGS_COMPILE = + toString ( + lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "-w " + ] ++ lib.optionals stdenv.cc.isGNU [ + # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit + "-Wno-class-memaccess" + ] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [ + # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940 + # TODO: investigate and fix properly + "-march=westmere" + ] ++ lib.optionals stdenv.cc.isClang [ + "-Wno-elaborated-enum-base" + ]); + } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + NIX_CFLAGS_LINK = "-Wl,--no-warn-search-mismatch"; + "NIX_CFLAGS_LINK_${buildPackages.stdenv.cc.suffixSalt}" = "-Wl,--no-warn-search-mismatch"; + }; preConfigure = '' export NINJAFLAGS=-j$NIX_BUILD_CORES @@ -125,10 +170,15 @@ qtModule { if [ -d "$PWD/tools/qmake" ]; then QMAKEPATH="$PWD/tools/qmake''${QMAKEPATH:+:}$QMAKEPATH" fi + '' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + export QMAKE_CC=$CC + export QMAKE_CXX=$CXX + export QMAKE_LINK=$CXX + export QMAKE_AR=$AR ''; qmakeFlags = [ "--" "-system-ffmpeg" ] - ++ lib.optional pipewireSupport "-webengine-webrtc-pipewire" + ++ lib.optional (pipewireSupport && stdenv.buildPlatform == stdenv.hostPlatform) "-webengine-webrtc-pipewire" ++ lib.optional enableProprietaryCodecs "-proprietary-codecs"; propagatedBuildInputs = [ @@ -226,7 +276,9 @@ qtModule { dontUseNinjaBuild = true; dontUseNinjaInstall = true; - postInstall = lib.optionalString stdenv.isLinux '' + postInstall = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + mkdir -p $out/libexec + '' + lib.optionalString stdenv.isLinux '' cat > $out/libexec/qt.conf <> pyproject.toml < PyQt_PrintDialog + # QT_NO_PRINTER => PyQt_Printer + # QT_NO_PRINTPREVIEWDIALOG => PyQt_PrintPreviewDialog + # QT_NO_PRINTPREVIEWWIDGET => PyQt_PrintPreviewWidget + # QT_NO_SSL => PyQt_SSL + # QT_SHARED || QT_DLL => shared (otherwise static) + # QT_NO_PROCESS => PyQt_Process + # QT_NO_FPU || Q_PROCESSOR_ARM || Q_OS_WINCE => PyQt_qreal_double + # sizeof (qreal) != sizeof (double) => PyQt_qreal_double + # !Q_COMPILER_CONSTEXPR !Q_COMPILER_UNIFORM_INIT => PyQt_CONSTEXPR + # QT_NO_ACCESSIBILITY => PyQt_Accessibility + # QT_NO_OPENGL => PyQt_OpenGL PyQt_Desktop_OpenGL + # defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_ES_3) => PyQt_Desktop_OpenGL + # QT_NO_RAWFONT => PyQt_RawFont + # QT_NO_SESSIONMANAGER => PyQt_SessionManager + # + + lib.optionalString (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) '' + rm config-tests/cfgtest_QtCore.cpp + rm config-tests/cfgtest_QtGui.cpp + rm config-tests/cfgtest_QtNetwork.cpp + rm config-tests/cfgtest_QtPrintSupport.cpp ''; enableParallelBuilding = true; @@ -68,16 +104,27 @@ buildPythonPackage rec { export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}" ''; + # tons of warnings from subpackages, no point in playing whack-a-mole + env = lib.optionalAttrs (!enableVerbose) { + NIX_CFLAGS_COMPILE = "-w"; + }; + outputs = [ "out" "dev" ]; dontWrapQtApps = true; - nativeBuildInputs = with libsForQt5; [ + nativeBuildInputs = [ pkg-config - qmake + ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ + libsForQt5.qmake + ] ++ [ setuptools lndir sip + ] ++ (with pkgsBuildTarget.targetPackages.libsForQt5; [ + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + qmake + ] ++ [ qtbase qtsvg qtdeclarative @@ -90,11 +137,13 @@ buildPythonPackage rec { ++ lib.optional withLocation qtlocation ++ lib.optional withSerialPort qtserialport ++ lib.optional withTools qttools - ; + ); buildInputs = with libsForQt5; [ dbus + ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ qtbase + ] ++ [ qtsvg qtdeclarative pyqt-builder diff --git a/pkgs/development/python-modules/pyqtwebengine/default.nix b/pkgs/development/python-modules/pyqtwebengine/default.nix index 7ad39633b7e51e5..71abe839a7893e1 100644 --- a/pkgs/development/python-modules/pyqtwebengine/default.nix +++ b/pkgs/development/python-modules/pyqtwebengine/default.nix @@ -1,13 +1,14 @@ { lib, stdenv, pythonPackages, fetchPypi, pkg-config -, qmake, qtbase, qtsvg, qtwebengine +, qmake, qtbase, qtsvg, qtwebengine, qtwebchannel, qtdeclarative , wrapQtAppsHook , darwin +, buildPackages }: let inherit (pythonPackages) buildPythonPackage python isPy27 pyqt5 sip pyqt-builder; inherit (darwin) autoSignDarwinBinariesHook; -in buildPythonPackage rec { +in buildPythonPackage (rec { pname = "PyQtWebEngine"; version = "5.15.4"; format = "pyproject"; @@ -29,12 +30,18 @@ in buildPythonPackage rec { nativeBuildInputs = [ pkg-config qmake + ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ sip + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + buildPackages.python3Packages.sip + ] ++ [ qtbase qtsvg qtwebengine pyqt-builder pythonPackages.setuptools + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + qtdeclarative ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]; @@ -44,6 +51,9 @@ in buildPythonPackage rec { qtbase qtsvg qtwebengine + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + qtwebchannel + qtdeclarative ]; propagatedBuildInputs = [ pyqt5 ]; @@ -71,6 +81,13 @@ in buildPythonPackage rec { description = "Python bindings for Qt5"; homepage = "http://www.riverbankcomputing.co.uk"; license = licenses.gpl3; - platforms = lib.lists.intersectLists qtwebengine.meta.platforms platforms.mesaPlatforms; + hydraPlatforms = lib.lists.intersectLists qtwebengine.meta.platforms platforms.mesaPlatforms; }; -} +} // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + # TODO: figure out why the env hooks aren't adding these inclusions automatically + env.NIX_CFLAGS_COMPILE = + lib.concatStringsSep " " [ + "-I${lib.getDev qtbase}/include/QtPrintSupport/" + "-I${lib.getDev qtwebchannel}/include/QtWebChannel/" + ]; +}) diff --git a/pkgs/test/cross/default.nix b/pkgs/test/cross/default.nix index f844fc2b8ec5547..9f8209de17ed294 100644 --- a/pkgs/test/cross/default.nix +++ b/pkgs/test/cross/default.nix @@ -151,6 +151,10 @@ let # lots of interesting corner cases. Only expected to work for # x86_64-linux buildPlatform. pkgs.pkgsMusl.pkgsCross.gnu64.hello + + # Two web browsers -- exercises almost the entire packageset + pkgs.pkgsCross.aarch64-multiplatform.qt5.qutebrowser + pkgs.pkgsCross.aarch64-multiplatform.firefox ]; in { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index af609d1e8a3ad6b..6d88b572739b737 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24670,6 +24670,7 @@ with pkgs; inherit (__splicedPackages) makeScopeWithSplicing' generateSplicesForMkScope lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper bison cups dconf harfbuzz libGL perl gtk3 python3 + buildPackages darwin; inherit (__splicedPackages.gst_all_1) gstreamer gst-plugins-base; inherit config;