c594a97518
GitOrigin-RevId: 301aada7a64812853f2e2634a530ef5d34505048
249 lines
5 KiB
Nix
249 lines
5 KiB
Nix
{ qtModule
|
|
, qtdeclarative
|
|
, qtwebchannel
|
|
, qtpositioning
|
|
, qtwebsockets
|
|
, buildPackages
|
|
, bison
|
|
, coreutils
|
|
, flex
|
|
, git
|
|
, gperf
|
|
, ninja
|
|
, pkg-config
|
|
, python3
|
|
, which
|
|
, nodejs
|
|
, qtbase
|
|
, perl
|
|
, xorg
|
|
, libXcursor
|
|
, libXScrnSaver
|
|
, libXrandr
|
|
, libXtst
|
|
, libxshmfence
|
|
, libXi
|
|
, fontconfig
|
|
, freetype
|
|
, harfbuzz
|
|
, icu
|
|
, dbus
|
|
, libdrm
|
|
, zlib
|
|
, minizip
|
|
, libjpeg
|
|
, libpng
|
|
, libtiff
|
|
, libwebp
|
|
, libopus
|
|
, jsoncpp
|
|
, protobuf
|
|
, libvpx
|
|
, srtp
|
|
, snappy
|
|
, nss
|
|
, libevent
|
|
, openssl
|
|
, alsa-lib
|
|
, pulseaudio
|
|
, libcap
|
|
, pciutils
|
|
, systemd
|
|
, pipewire
|
|
, gn
|
|
, cups
|
|
, openbsm
|
|
, runCommand
|
|
, writeScriptBin
|
|
, ffmpeg
|
|
, lib
|
|
, stdenv
|
|
, glib
|
|
, libxml2
|
|
, libxslt
|
|
, lcms2
|
|
, re2
|
|
, libkrb5
|
|
, mesa
|
|
, xkeyboard_config
|
|
, enableProprietaryCodecs ? true
|
|
}:
|
|
|
|
qtModule {
|
|
pname = "qtwebengine";
|
|
qtInputs = [ qtdeclarative qtwebchannel qtwebsockets qtpositioning ];
|
|
nativeBuildInputs = [
|
|
bison
|
|
coreutils
|
|
flex
|
|
git
|
|
gperf
|
|
ninja
|
|
pkg-config
|
|
(python3.withPackages (ps: with ps; [ html5lib ]))
|
|
which
|
|
gn
|
|
nodejs
|
|
];
|
|
doCheck = true;
|
|
outputs = [ "out" "dev" ];
|
|
|
|
dontUseGnConfigure = true;
|
|
|
|
# ninja builds some components with -Wno-format,
|
|
# which cannot be set at the same time as -Wformat-security
|
|
hardeningDisable = [ "format" ];
|
|
|
|
patches = [
|
|
# fixes consistent crashing in github on 6.4.0, can probably remove when there is a patch release
|
|
# https://codereview.qt-project.org/c/qt/qtwebengine/+/436316
|
|
../patches/qtwebengine-fix.patch
|
|
];
|
|
|
|
postPatch = ''
|
|
# Patch Chromium build tools
|
|
(
|
|
cd src/3rdparty/chromium;
|
|
|
|
# Manually fix unsupported shebangs
|
|
substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
|
|
--replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true
|
|
substituteInPlace third_party/webgpu-cts/src/tools/run_deno \
|
|
--replace "/usr/bin/env -S deno" "/usr/bin/deno" || true
|
|
patchShebangs .
|
|
)
|
|
|
|
substituteInPlace cmake/Functions.cmake \
|
|
--replace "/bin/bash" "${buildPackages.bash}/bin/bash"
|
|
|
|
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
|
|
src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
|
|
|
|
sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
|
|
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
|
|
|
|
substituteInPlace src/3rdparty/chromium/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc \
|
|
--replace "/usr/share/X11/xkb" "${xkeyboard_config}/share/X11/xkb"
|
|
|
|
# Patch library paths in sources
|
|
substituteInPlace src/core/web_engine_library_info.cpp \
|
|
--replace "QLibraryInfo::path(QLibraryInfo::DataPath)" "\"$out\"" \
|
|
--replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \
|
|
--replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\""
|
|
'';
|
|
|
|
cmakeFlags = [
|
|
"-DQT_FEATURE_qtpdf_build=ON"
|
|
"-DQT_FEATURE_qtpdf_widgets_build=ON"
|
|
"-DQT_FEATURE_qtpdf_quick_build=ON"
|
|
"-DQT_FEATURE_pdf_v8=ON"
|
|
"-DQT_FEATURE_pdf_xfa=ON"
|
|
"-DQT_FEATURE_pdf_xfa_bmp=ON"
|
|
"-DQT_FEATURE_pdf_xfa_gif=ON"
|
|
"-DQT_FEATURE_pdf_xfa_png=ON"
|
|
"-DQT_FEATURE_pdf_xfa_tiff=ON"
|
|
"-DQT_FEATURE_webengine_system_icu=ON"
|
|
"-DQT_FEATURE_webengine_system_libevent=ON"
|
|
"-DQT_FEATURE_webengine_system_libxml=ON"
|
|
"-DQT_FEATURE_webengine_system_ffmpeg=ON"
|
|
# android only. https://bugreports.qt.io/browse/QTBUG-100293
|
|
# "-DQT_FEATURE_webengine_native_spellchecker=ON"
|
|
"-DQT_FEATURE_webengine_sanitizer=ON"
|
|
"-DQT_FEATURE_webengine_webrtc_pipewire=ON"
|
|
"-DQT_FEATURE_webengine_kerberos=ON"
|
|
] ++ lib.optional enableProprietaryCodecs "-DQT_FEATURE_webengine_proprietary_codecs=ON";
|
|
|
|
propagatedBuildInputs = [
|
|
# Image formats
|
|
libjpeg
|
|
libpng
|
|
libtiff
|
|
libwebp
|
|
|
|
# Video formats
|
|
srtp
|
|
libvpx
|
|
|
|
# Audio formats
|
|
libopus
|
|
|
|
# Text rendering
|
|
harfbuzz
|
|
icu
|
|
|
|
openssl
|
|
glib
|
|
libxml2
|
|
libxslt
|
|
lcms2
|
|
re2
|
|
|
|
libevent
|
|
ffmpeg
|
|
|
|
dbus
|
|
zlib
|
|
minizip
|
|
snappy
|
|
nss
|
|
protobuf
|
|
jsoncpp
|
|
|
|
# Audio formats
|
|
alsa-lib
|
|
pulseaudio
|
|
|
|
# Text rendering
|
|
fontconfig
|
|
freetype
|
|
|
|
libcap
|
|
pciutils
|
|
|
|
# X11 libs
|
|
xorg.xrandr
|
|
libXScrnSaver
|
|
libXcursor
|
|
libXrandr
|
|
xorg.libpciaccess
|
|
libXtst
|
|
xorg.libXcomposite
|
|
xorg.libXdamage
|
|
libdrm
|
|
xorg.libxkbfile
|
|
libxshmfence
|
|
libXi
|
|
xorg.libXext
|
|
|
|
# Pipewire
|
|
pipewire
|
|
|
|
libkrb5
|
|
mesa
|
|
];
|
|
|
|
buildInputs = [
|
|
cups
|
|
];
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
preConfigure = ''
|
|
export NINJAFLAGS="-j$NIX_BUILD_CORES"
|
|
'';
|
|
|
|
postInstall = ''
|
|
# This is required at runtime
|
|
mkdir $out/libexec
|
|
mv $dev/libexec/QtWebEngineProcess $out/libexec
|
|
'';
|
|
|
|
meta = with lib; {
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
|
description = "A web engine based on the Chromium web browser";
|
|
platforms = platforms.linux;
|
|
# This build takes a long time; particularly on slow architectures
|
|
# 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz
|
|
timeout = 24 * 3600;
|
|
};
|
|
}
|