nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 311 lines 6.9 kB view raw
1{ 2 qtModule, 3 qtdeclarative, 4 qtwebchannel, 5 qtpositioning, 6 qtwebsockets, 7 buildPackages, 8 bison, 9 coreutils, 10 fetchpatch2, 11 flex, 12 gperf, 13 ninja, 14 pkg-config, 15 python3, 16 which, 17 nodejs, 18 libxext, 19 libxdamage, 20 libxcomposite, 21 xrandr, 22 libxkbfile, 23 libpciaccess, 24 libXcursor, 25 libXScrnSaver, 26 libXrandr, 27 libXtst, 28 libxshmfence, 29 libXi, 30 cups, 31 fontconfig, 32 freetype, 33 harfbuzz, 34 icu, 35 dbus, 36 libdrm, 37 zlib, 38 minizip, 39 libjpeg, 40 libpng, 41 libtiff, 42 libwebp, 43 libopus, 44 jsoncpp, 45 protobuf, 46 srtp, 47 snappy, 48 nss, 49 libevent, 50 openssl, 51 alsa-lib, 52 pulseaudio, 53 libcap, 54 pciutils, 55 systemd, 56 pipewire, 57 gn, 58 ffmpeg, 59 lib, 60 stdenv, 61 glib, 62 libxml2, 63 libxslt, 64 lcms2, 65 libkrb5, 66 libgbm, 67 libva, 68 enableProprietaryCodecs ? true, 69 # darwin 70 bootstrap_cmds, 71 cctools, 72 xcbuild, 73}: 74 75qtModule { 76 pname = "qtwebengine"; 77 nativeBuildInputs = [ 78 bison 79 coreutils 80 flex 81 gperf 82 ninja 83 pkg-config 84 (python3.withPackages (ps: with ps; [ html5lib ])) 85 which 86 gn 87 nodejs 88 ] 89 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 90 bootstrap_cmds 91 cctools 92 xcbuild 93 ]; 94 doCheck = true; 95 outputs = [ 96 "out" 97 "dev" 98 ]; 99 100 dontUseGnConfigure = true; 101 102 # ninja builds some components with -Wno-format, 103 # which cannot be set at the same time as -Wformat-security 104 hardeningDisable = [ "format" ]; 105 106 patches = [ 107 # Don't assume /usr/share/X11, and also respect the XKB_CONFIG_ROOT 108 # environment variable, since NixOS relies on it working. 109 # See https://github.com/NixOS/nixpkgs/issues/226484 for more context. 110 ./xkb-includes.patch 111 112 ./link-pulseaudio.patch 113 114 # Override locales install path so they go to QtWebEngine's $out 115 ./locales-path.patch 116 117 # Reproducibility QTBUG-136068 118 ./gn-object-sorted.patch 119 120 # Backport crash fix 121 (fetchpatch2 { 122 url = "https://invent.kde.org/qt/qt/qtwebengine/-/commit/ecf90f65ef738ae20b114691d02fb15c82e6babe.diff"; 123 hash = "sha256-TW+EmCxasH5LdZ80y/0YHird3NsrVdlwciDJpgSD9x0="; 124 }) 125 ] 126 ++ lib.optionals stdenv.cc.isClang [ 127 # https://chromium-review.googlesource.com/c/chromium/src/+/6633292 128 (fetchpatch2 { 129 url = "https://github.com/chromium/chromium/commit/b0ff8c3b258a8816c05bdebf472dbba719d3c491.patch?full_index=1"; 130 stripLen = 1; 131 extraPrefix = "src/3rdparty/chromium/"; 132 hash = "sha256-zDIlHd8bBtrThkFnrcyA13mhXYIQt6sKsi6qAyQ34yo="; 133 }) 134 ]; 135 136 postPatch = '' 137 # Patch Chromium build tools 138 ( 139 cd src/3rdparty/chromium; 140 141 # Manually fix unsupported shebangs 142 substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \ 143 --replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true 144 substituteInPlace third_party/webgpu-cts/src/tools/run_deno \ 145 --replace "/usr/bin/env -S deno" "/usr/bin/deno" || true 146 patchShebangs . 147 ) 148 149 substituteInPlace cmake/Functions.cmake \ 150 --replace "/bin/bash" "${buildPackages.bash}/bin/bash" 151 152 # Patch library paths in sources 153 substituteInPlace src/core/web_engine_library_info.cpp \ 154 --replace "QLibraryInfo::path(QLibraryInfo::DataPath)" "\"$out\"" \ 155 --replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \ 156 --replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\"" 157 158 substituteInPlace configure.cmake src/gn/CMakeLists.txt \ 159 --replace "AppleClang" "Clang" 160 161 # Disable metal shader compilation, Xcode only 162 substituteInPlace src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni \ 163 --replace-fail 'angle_has_build && !is_ios && target_os == host_os' "false" 164 '' 165 + lib.optionalString stdenv.hostPlatform.isLinux '' 166 sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \ 167 src/3rdparty/chromium/device/udev_linux/udev?_loader.cc 168 169 sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \ 170 src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc 171 '' 172 + lib.optionalString stdenv.hostPlatform.isDarwin '' 173 substituteInPlace cmake/QtToolchainHelpers.cmake \ 174 --replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun" 175 ''; 176 177 cmakeFlags = [ 178 "-DQT_FEATURE_qtpdf_build=ON" 179 "-DQT_FEATURE_qtpdf_widgets_build=ON" 180 "-DQT_FEATURE_qtpdf_quick_build=ON" 181 "-DQT_FEATURE_pdf_v8=ON" 182 "-DQT_FEATURE_pdf_xfa=ON" 183 "-DQT_FEATURE_pdf_xfa_bmp=ON" 184 "-DQT_FEATURE_pdf_xfa_gif=ON" 185 "-DQT_FEATURE_pdf_xfa_png=ON" 186 "-DQT_FEATURE_pdf_xfa_tiff=ON" 187 "-DQT_FEATURE_webengine_system_libevent=ON" 188 "-DQT_FEATURE_webengine_system_ffmpeg=ON" 189 # android only. https://bugreports.qt.io/browse/QTBUG-100293 190 # "-DQT_FEATURE_webengine_native_spellchecker=ON" 191 "-DQT_FEATURE_webengine_sanitizer=ON" 192 "-DQT_FEATURE_webengine_kerberos=ON" 193 ] 194 ++ lib.optionals stdenv.hostPlatform.isLinux [ 195 "-DQT_FEATURE_webengine_system_libxml=ON" 196 "-DQT_FEATURE_webengine_webrtc_pipewire=ON" 197 198 # Appears not to work on some platforms 199 # https://github.com/Homebrew/homebrew-core/issues/104008 200 "-DQT_FEATURE_webengine_system_icu=ON" 201 ] 202 ++ lib.optionals enableProprietaryCodecs [ 203 "-DQT_FEATURE_webengine_proprietary_codecs=ON" 204 ] 205 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 206 "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0" # Per Qt 6’s deployment target (why doesn’t the hook work?) 207 ]; 208 209 propagatedBuildInputs = [ 210 qtdeclarative 211 qtwebchannel 212 qtwebsockets 213 qtpositioning 214 215 # Image formats 216 libjpeg 217 libpng 218 libtiff 219 libwebp 220 221 # Video formats 222 srtp 223 224 # Audio formats 225 libopus 226 227 # Text rendering 228 harfbuzz 229 230 openssl 231 glib 232 libxslt 233 lcms2 234 235 libevent 236 ffmpeg 237 ] 238 ++ lib.optionals stdenv.hostPlatform.isLinux [ 239 dbus 240 zlib 241 minizip 242 snappy 243 nss 244 protobuf 245 jsoncpp 246 247 icu 248 libxml2 249 250 # Audio formats 251 alsa-lib 252 pulseaudio 253 254 # Text rendering 255 fontconfig 256 freetype 257 258 libcap 259 pciutils 260 261 # X11 libs 262 xrandr 263 libXScrnSaver 264 libXcursor 265 libXrandr 266 libpciaccess 267 libXtst 268 libxcomposite 269 libxdamage 270 libdrm 271 libxkbfile 272 libxshmfence 273 libXi 274 libxext 275 276 # Pipewire 277 pipewire 278 279 libkrb5 280 libgbm 281 libva 282 ]; 283 284 buildInputs = [ 285 cups 286 ]; 287 288 requiredSystemFeatures = [ "big-parallel" ]; 289 290 preConfigure = '' 291 export NINJAFLAGS="-j$NIX_BUILD_CORES" 292 ''; 293 294 # Debug info is too big to link with LTO. 295 separateDebugInfo = false; 296 297 meta = { 298 description = "Web engine based on the Chromium web browser"; 299 platforms = [ 300 "x86_64-darwin" 301 "aarch64-darwin" 302 "aarch64-linux" 303 "armv7a-linux" 304 "armv7l-linux" 305 "x86_64-linux" 306 ]; 307 # This build takes a long time; particularly on slow architectures 308 # 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz 309 timeout = 24 * 3600; 310 }; 311}