qt5.qtwebengine: fix cross
This commit is contained in:
parent
49e8d9db2f
commit
d1df34dc10
1 changed files with 90 additions and 27 deletions
|
@ -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 <<EOF
|
||||
[Paths]
|
||||
Prefix = ..
|
||||
|
@ -245,21 +297,32 @@ 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))
|
||||
];
|
||||
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)
|
||||
]);
|
||||
broken = stdenv.isDarwin && stdenv.isx86_64;
|
||||
|
||||
# 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
|
||||
];
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue