Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 75 additions & 56 deletions pkgs/development/libraries/qt-6/modules/qtwebengine/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
buildPackages,
bison,
coreutils,
fetchpatch2,
flex,
gperf,
ninja,
Expand Down Expand Up @@ -119,77 +118,97 @@ qtModule {
./gn-object-sorted.patch
];

postPatch = ''
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"

''
(
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"
''
# 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\""

substituteInPlace configure.cmake src/gn/CMakeLists.txt \
--replace "AppleClang" "Clang"

+ ''
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\""
''
+ ''
substituteInPlace configure.cmake src/gn/CMakeLists.txt \
--replace "AppleClang" "Clang"
''
# Disable metal shader compilation, Xcode only
substituteInPlace src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni \
--replace-fail 'angle_has_build && !is_ios && target_os == host_os' "false"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
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
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/QtToolchainHelpers.cmake \
--replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
'';
+ ''
substituteInPlace src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni \
--replace-fail 'angle_has_build && !is_ios && target_os == host_os' "false"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
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
''
+ lib.optionalString stdenv.hostPlatform.isDarwin (
''
substituteInPlace cmake/QtToolchainHelpers.cmake \
--replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
''
# Chromium's mac toolchain invokes `$clang_base_path/bin/clang++` directly,
# bypassing the cc-wrapper. Since the build uses the system libc++
# (use_custom_libcxx=false, use_libcxx=true), the raw clang cannot find the
# libc++ headers, which in nixpkgs live in a separate package and are only
# added by the wrapper. Point clang_base_path at the wrapped compiler so
# `-isystem .../c++/v1` is injected, matching livekit-libwebrtc.
+ ''
substituteInPlace cmake/QtToolchainHelpers.cmake \
--replace-fail \
'clang_base_path="''${QWELibClang_BASE_PATH}"' \
'clang_base_path="${stdenv.cc}"'
''
);

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"
(lib.cmakeBool "QT_FEATURE_qtpdf_build" true)
(lib.cmakeBool "QT_FEATURE_qtpdf_widgets_build" true)
(lib.cmakeBool "QT_FEATURE_qtpdf_quick_build" true)
(lib.cmakeFeature "QT_FEATURE_pdf_v8" "ON")
(lib.cmakeFeature "QT_FEATURE_pdf_xfa" "ON")
(lib.cmakeFeature "QT_FEATURE_pdf_xfa_bmp" "ON")
(lib.cmakeFeature "QT_FEATURE_pdf_xfa_gif" "ON")
(lib.cmakeFeature "QT_FEATURE_pdf_xfa_png" "ON")
(lib.cmakeFeature "QT_FEATURE_pdf_xfa_tiff" "ON")
(lib.cmakeBool "QT_FEATURE_webengine_system_libevent" true)
(lib.cmakeBool "QT_FEATURE_webengine_system_ffmpeg" true)
# 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"
(lib.cmakeBool "-DQT_FEATURE_webengine_sanitizer" true)
(lib.cmakeBool "-DQT_FEATURE_webengine_kerberos" true)
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"-DQT_FEATURE_webengine_system_libxml=ON"
"-DQT_FEATURE_webengine_webrtc_pipewire=ON"
(lib.cmakeBool "-DQT_FEATURE_webengine_system_libxml" true)
(lib.cmakeBool "-DQT_FEATURE_webengine_webrtc_pipewire" true)

# Appears not to work on some platforms
# https://github.com/Homebrew/homebrew-core/issues/104008
"-DQT_FEATURE_webengine_system_icu=ON"
(lib.cmakeBool "-DQT_FEATURE_webengine_system_icu" true)
]
++ lib.optionals enableProprietaryCodecs [
"-DQT_FEATURE_webengine_proprietary_codecs=ON"
(lib.cmakeBool "-DQT_FEATURE_webengine_proprietary_codecs" true)
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0" # Per Qt 6’s deployment target (why doesn’t the hook work?)
# Per Qt 6’s deployment target (why doesn’t the hook work?)
(lib.cmakeFeature "CMAKE_OSX_DEPLOYMENT_TARGET" "11.0")
];

propagatedBuildInputs = [
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/python-modules/qtconsole/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ buildPythonPackage (finalAttrs: {
pname = "qtconsole";
version = "5.7.2";
pyproject = true;
__structuredAttrs = true;

src = fetchFromGitHub {
owner = "jupyter";
Expand Down
Loading