2021-10-16 14:22:24 +02:00
|
|
|
|
{
|
|
|
|
|
qtModule,
|
|
|
|
|
qtdeclarative,
|
|
|
|
|
qtwebchannel,
|
|
|
|
|
qtpositioning,
|
|
|
|
|
qtwebsockets,
|
2022-07-16 14:55:12 +02:00
|
|
|
|
buildPackages,
|
2021-10-16 14:22:24 +02:00
|
|
|
|
bison,
|
|
|
|
|
coreutils,
|
|
|
|
|
flex,
|
|
|
|
|
git,
|
|
|
|
|
gperf,
|
|
|
|
|
ninja,
|
|
|
|
|
pkg-config,
|
|
|
|
|
python3,
|
|
|
|
|
which,
|
|
|
|
|
nodejs,
|
|
|
|
|
xorg,
|
|
|
|
|
libXcursor,
|
|
|
|
|
libXScrnSaver,
|
|
|
|
|
libXrandr,
|
|
|
|
|
libXtst,
|
|
|
|
|
libxshmfence,
|
|
|
|
|
libXi,
|
2024-09-23 18:41:13 -04:00
|
|
|
|
cups,
|
2021-10-16 14:22:24 +02:00
|
|
|
|
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,
|
2024-08-27 22:52:44 +01:00
|
|
|
|
ffmpeg,
|
2021-10-16 14:22:24 +02:00
|
|
|
|
lib,
|
|
|
|
|
stdenv,
|
|
|
|
|
glib,
|
|
|
|
|
libxml2,
|
|
|
|
|
libxslt,
|
|
|
|
|
lcms2,
|
2022-05-25 09:51:34 +08:00
|
|
|
|
libkrb5,
|
2024-12-04 14:57:48 +03:00
|
|
|
|
libgbm,
|
2021-10-16 14:22:24 +02:00
|
|
|
|
enableProprietaryCodecs ? true,
|
2023-04-16 04:07:30 +03:00
|
|
|
|
# darwin
|
2024-01-20 19:44:52 +01:00
|
|
|
|
autoSignDarwinBinariesHook,
|
2023-04-16 04:07:30 +03:00
|
|
|
|
bootstrap_cmds,
|
|
|
|
|
cctools,
|
|
|
|
|
xcbuild,
|
2024-12-25 14:33:46 +03:00
|
|
|
|
fetchpatch,
|
2021-10-16 14:22:24 +02:00
|
|
|
|
}:
|
|
|
|
|
|
2022-10-07 12:54:29 -06:00
|
|
|
|
qtModule {
|
2021-10-16 14:22:24 +02:00
|
|
|
|
pname = "qtwebengine";
|
|
|
|
|
nativeBuildInputs =
|
|
|
|
|
[
|
|
|
|
|
bison
|
|
|
|
|
coreutils
|
|
|
|
|
flex
|
|
|
|
|
git
|
|
|
|
|
gperf
|
|
|
|
|
ninja
|
|
|
|
|
pkg-config
|
|
|
|
|
(python3.withPackages (ps: with ps; [ html5lib ]))
|
|
|
|
|
which
|
|
|
|
|
gn
|
|
|
|
|
nodejs
|
2024-02-19 21:35:44 -05:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
|
2024-01-20 19:44:52 +01:00
|
|
|
|
autoSignDarwinBinariesHook
|
2024-02-19 21:35:44 -05:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-04-16 04:07:30 +03:00
|
|
|
|
bootstrap_cmds
|
|
|
|
|
cctools
|
|
|
|
|
xcbuild
|
2021-10-16 14:22:24 +02:00
|
|
|
|
];
|
|
|
|
|
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" ];
|
|
|
|
|
|
2023-04-18 18:48:33 +03:00
|
|
|
|
patches = [
|
2023-04-19 22:04:11 +09:00
|
|
|
|
# Don't assume /usr/share/X11, and also respect the XKB_CONFIG_ROOT
|
|
|
|
|
# environment variable, since NixOS relies on it working.
|
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/226484 for more context.
|
2024-12-02 13:34:55 +03:00
|
|
|
|
./xkb-includes.patch
|
2023-07-29 17:21:34 +03:00
|
|
|
|
|
2024-12-02 13:34:55 +03:00
|
|
|
|
./link-pulseaudio.patch
|
2023-08-18 16:02:27 -07:00
|
|
|
|
|
2023-07-29 17:21:34 +03:00
|
|
|
|
# Override locales install path so they go to QtWebEngine's $out
|
2024-12-02 13:34:55 +03:00
|
|
|
|
./locales-path.patch
|
2024-12-25 14:33:46 +03:00
|
|
|
|
|
|
|
|
|
# Fix build of vendored xnnpack on aarch64/gcc14
|
|
|
|
|
# FIXME: remove when upstream updates
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
url = "https://github.com/google/XNNPACK/commit/1b11a8b0620afe8c047304273674c4c57c289755.patch";
|
|
|
|
|
stripLen = 1;
|
|
|
|
|
extraPrefix = "src/3rdparty/chromium/third_party/xnnpack/src/";
|
|
|
|
|
hash = "sha256-GUESVNR88I1K2V5xr0e09ec4j2eselMhNN06+PCcINM=";
|
|
|
|
|
})
|
2023-04-18 18:48:33 +03:00
|
|
|
|
];
|
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
postPatch =
|
|
|
|
|
''
|
|
|
|
|
# Patch Chromium build tools
|
|
|
|
|
(
|
|
|
|
|
cd src/3rdparty/chromium;
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# 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
|
2022-09-29 19:49:43 +08:00
|
|
|
|
substituteInPlace third_party/webgpu-cts/src/tools/run_deno \
|
2021-10-16 14:22:24 +02:00
|
|
|
|
--replace "/usr/bin/env -S deno" "/usr/bin/deno" || true
|
|
|
|
|
patchShebangs .
|
|
|
|
|
)
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2022-07-16 14:55:12 +02:00
|
|
|
|
substituteInPlace cmake/Functions.cmake \
|
|
|
|
|
--replace "/bin/bash" "${buildPackages.bash}/bin/bash"
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2023-04-14 21:34:17 +03:00
|
|
|
|
# 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\""
|
2024-12-31 20:11:07 +08:00
|
|
|
|
|
|
|
|
|
substituteInPlace configure.cmake src/gn/CMakeLists.txt \
|
|
|
|
|
--replace "AppleClang" "Clang"
|
2023-04-14 21:34:17 +03:00
|
|
|
|
''
|
2024-02-19 21:35:44 -05:00
|
|
|
|
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
2021-10-16 14:22:24 +02:00
|
|
|
|
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
|
|
|
|
|
src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
|
|
|
|
|
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
|
2023-04-16 04:07:30 +03:00
|
|
|
|
''
|
2024-02-19 21:35:44 -05:00
|
|
|
|
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2023-04-16 04:07:30 +03:00
|
|
|
|
substituteInPlace cmake/Functions.cmake \
|
|
|
|
|
--replace "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
|
2021-10-16 14:22:24 +02:00
|
|
|
|
'';
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
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_libevent=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_kerberos=ON"
|
2024-02-19 21:35:44 -05:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
2024-01-20 04:01:29 +01:00
|
|
|
|
"-DQT_FEATURE_webengine_system_libxml=ON"
|
2023-04-14 21:34:17 +03:00
|
|
|
|
"-DQT_FEATURE_webengine_webrtc_pipewire=ON"
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2024-01-13 03:02:40 +09:00
|
|
|
|
# Appears not to work on some platforms
|
|
|
|
|
# https://github.com/Homebrew/homebrew-core/issues/104008
|
|
|
|
|
"-DQT_FEATURE_webengine_system_icu=ON"
|
2023-04-14 21:34:17 +03:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals enableProprietaryCodecs [
|
|
|
|
|
"-DQT_FEATURE_webengine_proprietary_codecs=ON"
|
2024-02-19 21:35:44 -05:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-09-23 18:41:13 -04:00
|
|
|
|
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0" # Per Qt 6’s deployment target (why doesn’t the hook work?)
|
2023-04-14 21:34:17 +03:00
|
|
|
|
];
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
propagatedBuildInputs =
|
|
|
|
|
[
|
2023-09-16 17:15:17 +00:00
|
|
|
|
qtdeclarative
|
|
|
|
|
qtwebchannel
|
|
|
|
|
qtwebsockets
|
|
|
|
|
qtpositioning
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Image formats
|
|
|
|
|
libjpeg
|
|
|
|
|
libpng
|
|
|
|
|
libtiff
|
|
|
|
|
libwebp
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Video formats
|
|
|
|
|
srtp
|
|
|
|
|
libvpx
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Audio formats
|
|
|
|
|
libopus
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Text rendering
|
|
|
|
|
harfbuzz
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
openssl
|
|
|
|
|
glib
|
|
|
|
|
libxslt
|
|
|
|
|
lcms2
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
libevent
|
2024-08-27 22:52:44 +01:00
|
|
|
|
ffmpeg
|
2024-02-19 21:35:44 -05:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
2021-10-16 14:22:24 +02:00
|
|
|
|
dbus
|
|
|
|
|
zlib
|
|
|
|
|
minizip
|
|
|
|
|
snappy
|
|
|
|
|
nss
|
|
|
|
|
protobuf
|
|
|
|
|
jsoncpp
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2024-01-20 04:01:29 +01:00
|
|
|
|
icu
|
|
|
|
|
libxml2
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Audio formats
|
|
|
|
|
alsa-lib
|
|
|
|
|
pulseaudio
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Text rendering
|
|
|
|
|
fontconfig
|
|
|
|
|
freetype
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
libcap
|
|
|
|
|
pciutils
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# X11 libs
|
|
|
|
|
xorg.xrandr
|
|
|
|
|
libXScrnSaver
|
|
|
|
|
libXcursor
|
|
|
|
|
libXrandr
|
|
|
|
|
xorg.libpciaccess
|
|
|
|
|
libXtst
|
|
|
|
|
xorg.libXcomposite
|
|
|
|
|
xorg.libXdamage
|
|
|
|
|
libdrm
|
|
|
|
|
xorg.libxkbfile
|
|
|
|
|
libxshmfence
|
|
|
|
|
libXi
|
|
|
|
|
xorg.libXext
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# Pipewire
|
|
|
|
|
pipewire
|
2024-12-10 20:23:58 +01:00
|
|
|
|
|
2022-05-25 09:51:34 +08:00
|
|
|
|
libkrb5
|
2024-12-04 14:57:48 +03:00
|
|
|
|
libgbm
|
2021-10-16 14:22:24 +02:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
|
cups
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
|
2022-10-16 09:34:23 +08:00
|
|
|
|
preConfigure = ''
|
|
|
|
|
export NINJAFLAGS="-j$NIX_BUILD_CORES"
|
|
|
|
|
'';
|
|
|
|
|
|
2024-10-19 22:26:40 +03:00
|
|
|
|
# Debug info is too big to link with LTO.
|
|
|
|
|
separateDebugInfo = false;
|
|
|
|
|
|
2021-10-16 14:22:24 +02:00
|
|
|
|
meta = with lib; {
|
|
|
|
|
description = "Web engine based on the Chromium web browser";
|
2023-11-25 12:18:16 +01:00
|
|
|
|
platforms = [
|
|
|
|
|
"x86_64-darwin"
|
|
|
|
|
"aarch64-darwin"
|
|
|
|
|
"aarch64-linux"
|
|
|
|
|
"armv7a-linux"
|
|
|
|
|
"armv7l-linux"
|
|
|
|
|
"x86_64-linux"
|
|
|
|
|
];
|
2021-10-16 14:22:24 +02:00
|
|
|
|
# This build takes a long time; particularly on slow architectures
|
|
|
|
|
# 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz
|
|
|
|
|
timeout = 24 * 3600;
|
|
|
|
|
};
|
|
|
|
|
}
|