diff options
Diffstat (limited to 'pkgs/development/libraries/qt-5/modules/qtwebengine.nix')
-rw-r--r-- | pkgs/development/libraries/qt-5/modules/qtwebengine.nix | 127 |
1 files changed, 98 insertions, 29 deletions
diff --git a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix index 1794e3f8ca6..3503067aca7 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,13 +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"; - qtInputs = [ qtdeclarative qtquickcontrols qtlocation qtwebchannel ]; 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" ]; @@ -58,6 +93,12 @@ qtModule { # TODO: be more precise patchShebangs . + + # Fix compatibility with python3.11 + substituteInPlace tools/metrics/ukm/ukm_model.py \ + --replace "r'^(?i)(|true|false)$'" "r'(?i)^(|true|false)$'" + substituteInPlace tools/grit/grit/util.py \ + --replace "mode = 'rU'" "mode = 'r'" ) '' # Prevent Chromium build script from making the path to `clang` relative to @@ -103,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 @@ -120,13 +170,20 @@ 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 = [ + qtdeclarative qtquickcontrols qtlocation qtwebchannel + # Image formats libjpeg libpng libtiff libwebp @@ -219,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 <<EOF [Paths] Prefix = .. @@ -238,21 +297,31 @@ qtModule { # qtwebengine-5.15.8: "QtWebEngine can only be built for x86, # x86-64, ARM, Aarch64, and MIPSel architectures." - platforms = - lib.trivial.pipe lib.systems.doubles.all [ - (map (double: lib.systems.elaborate { system = double; })) - (lib.lists.filter (parsedPlatform: with parsedPlatform; - isUnix && - (isx86_32 || - isx86_64 || - isAarch32 || - isAarch64 || - (isMips && isLittleEndian)))) - (map (plat: plat.system)) - ]; - broken = stdenv.isDarwin && stdenv.isx86_64; + platforms = with lib.systems.inspect.patterns; + let inherit (lib.systems.inspect) patternLogicalAnd; + in concatMap (patternLogicalAnd isUnix) (lib.concatMap lib.toList [ + isx86_32 + isx86_64 + isAarch32 + isAarch64 + (patternLogicalAnd isMips isLittleEndian) + ]); # This build takes a long time; particularly on slow architectures timeout = 24 * 3600; }; -} + +} // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { + configurePlatforms = [ ]; + # to get progress output in `nix-build` and `nix build -L` + preBuild = '' + export TERM=dumb + ''; + depsBuildBuild = [ + pkgsBuildBuild.stdenv + zlib + nss + nspr + ]; + +}) |