diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/browsers/chromium/common.nix')
-rw-r--r-- | nixpkgs/pkgs/applications/networking/browsers/chromium/common.nix | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/nixpkgs/pkgs/applications/networking/browsers/chromium/common.nix b/nixpkgs/pkgs/applications/networking/browsers/chromium/common.nix index 8ce7c89bf78..4e3960ee729 100644 --- a/nixpkgs/pkgs/applications/networking/browsers/chromium/common.nix +++ b/nixpkgs/pkgs/applications/networking/browsers/chromium/common.nix @@ -1,10 +1,10 @@ -{ stdenv, llvmPackages, gnChromium, ninja, which, nodejs, fetchpatch, gnutar +{ stdenv, lib, llvmPackages, gnChromium, ninja, which, nodejs, fetchpatch, fetchurl # default dependencies -, bzip2, flac, speex, libopus +, gnutar, bzip2, flac, speex, libopus , libevent, expat, libjpeg, snappy , libpng, libcap -, xdg_utils, yasm, minizip, libwebp +, xdg_utils, yasm, nasm, minizip, libwebp , libusb1, pciutils, nss, re2, zlib , python2Packages, perl, pkgconfig @@ -13,10 +13,12 @@ , bison, gperf , glib, gtk3, dbus-glib , glibc +, xorg , libXScrnSaver, libXcursor, libXtst, libGLU, libGL , protobuf, speechd, libXdamage, cups -, ffmpeg, libxslt, libxml2, at-spi2-core +, ffmpeg_3, libxslt, libxml2, at-spi2-core , jre +, pipewire_0_2 # optional dependencies , libgcrypt ? null # gnomeSupport || cupsSupport @@ -37,6 +39,7 @@ , cupsSupport ? true , pulseSupport ? false, libpulseaudio ? null +, channel , upstream-info }: @@ -72,7 +75,7 @@ let in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); gnSystemLibraries = [ - "flac" "libwebp" "libxslt" "yasm" "opus" "snappy" "libpng" + "flac" "libwebp" "libxslt" "opus" "snappy" "libpng" # "zlib" # version 77 reports unresolved dependency on //third_party/zlib:zlib_config # "libjpeg" # fails with multiple undefined references to chromium_jpeg_* # "re2" # fails with linker errors @@ -89,9 +92,10 @@ let bzip2 flac speex opusWithCustomModes libevent expat libjpeg snappy libpng libcap - xdg_utils yasm minizip libwebp + xdg_utils minizip libwebp libusb1 re2 zlib - ffmpeg libxslt libxml2 + ffmpeg_3 libxslt libxml2 + nasm # harfbuzz # in versions over 63 harfbuzz and freetype are being built together # so we can't build with one from system and other from source ]; @@ -105,7 +109,7 @@ let versionRange = min-version: upto-version: let inherit (upstream-info) version; result = versionAtLeast version min-version && versionOlder version upto-version; - stable-version = (import ./upstream-info.nix).stable.version; + stable-version = (importJSON ./upstream-info.json).stable.version; in if versionAtLeast stable-version upto-version then warn "chromium: stable version ${stable-version} is newer than a patchset bounded at ${upto-version}. You can safely delete it." result @@ -113,16 +117,20 @@ let base = rec { name = "${packageName}-unwrapped-${version}"; - inherit (upstream-info) channel version; - inherit packageName buildType buildPath; + inherit (upstream-info) version; + inherit channel packageName buildType buildPath; - src = upstream-info.main; + src = fetchurl { + url = "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${version}.tar.xz"; + inherit (upstream-info) sha256; + }; nativeBuildInputs = [ ninja which python2Packages.python perl pkgconfig python2Packages.ply python2Packages.jinja2 nodejs - gnutar - ] ++ optional (versionAtLeast version "83") python2Packages.setuptools; + gnutar python2Packages.setuptools + (xorg.xcbproto.override { python = python2Packages.python; }) + ]; buildInputs = defaultDependencies ++ [ nspr nss systemd @@ -132,6 +140,7 @@ let libXScrnSaver libXcursor libXtst libGLU libGL pciutils protobuf speechd libXdamage at-spi2-core jre + pipewire_0_2 ] ++ optional useVaapi libva ++ optional gnomeKeyringSupport libgnome-keyring3 ++ optionals gnomeSupport [ gnome.GConf libgcrypt ] @@ -139,8 +148,9 @@ let ++ optional pulseSupport libpulseaudio ++ optionals useOzone [ libdrm wayland mesa_drivers libxkbcommon ]; - patches = [ + patches = optionals (versionRange "68" "86") [ ./patches/nix_plugin_paths_68.patch + ] ++ [ ./patches/remove-webp-include-69.patch ./patches/no-build-timestamps.patch ./patches/widevine-79.patch @@ -154,12 +164,18 @@ let # # ++ optionals (channel == "dev") [ ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" ) ] # ++ optional (versionRange "68" "72") ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" ) - ] ++ optionals (useVaapi) [ # Improvements for the VA-API build: + ] ++ optionals (useVaapi && versionRange "68" "86") [ # Improvements for the VA-API build: ./patches/enable-vdpau-support-for-nvidia.patch # https://aur.archlinux.org/cgit/aur.git/tree/vdpau-support.patch?h=chromium-vaapi ./patches/enable-video-acceleration-on-linux.patch # Can be controlled at runtime (i.e. without rebuilding Chromium) ]; - postPatch = '' + postPatch = optionalString (!versionRange "0" "86") '' + # Required for patchShebangs (unsupported interpreter directive, basename: invalid option -- '*', etc.): + substituteInPlace native_client/SConstruct \ + --replace "#! -*- python -*-" "" + substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \ + --replace "/usr/bin/env -S make -f" "/usr/bin/make -f" + '' + '' # We want to be able to specify where the sandbox is via CHROME_DEVEL_SANDBOX substituteInPlace sandbox/linux/suid/client/setuid_sandbox_host.cc \ --replace \ @@ -177,10 +193,15 @@ let '/usr/share/locale/' \ '${glibc}/share/locale/' + substituteInPlace ui/gfx/x/BUILD.gn \ + --replace \ + '/usr/share/xcb' \ + '${xorg.xcbproto}/share/xcb/' + sed -i -e 's@"\(#!\)\?.*xdg-@"\1${xdg_utils}/bin/xdg-@' \ chrome/browser/shell_integration_linux.cc - sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \ + sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \ device/udev_linux/udev?_loader.cc sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \ @@ -225,7 +246,6 @@ let ''; gnFlags = mkGnFlags ({ - linux_use_bundled_binutils = false; use_lld = false; use_gold = true; gold_path = "${stdenv.cc}/bin"; @@ -243,6 +263,8 @@ let # added later in the wrapped -wv build or downloaded from Google. enable_widevine = true; use_cups = cupsSupport; + # Provides the enable-webrtc-pipewire-capturer flag to support Wayland screen capture. + rtc_use_pipewire = true; treat_warnings_as_errors = false; is_clang = stdenv.cc.isClang; @@ -326,9 +348,11 @@ let origRpath="$(patchelf --print-rpath "$chromiumBinary")" patchelf --set-rpath "${libGL}/lib:$origRpath" "$chromiumBinary" ''; + + passthru.updateScript = ./update.py; }; # Remove some extraAttrs we supplied to the base attributes already. in stdenv.mkDerivation (base // removeAttrs extraAttrs [ "name" "gnFlags" "buildTargets" -]) +] // { passthru = base.passthru // (extraAttrs.passthru or {}); }) |