summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO102
-rw-r--r--PKGBUILD749
-rw-r--r--brave-1.43-bat-native-ads-hash_vectorizer_fix-cstring.patch13
-rw-r--r--brave-1.43-bat-native-ads-vector_data_fix-cmath.patch12
-rw-r--r--brave-1.43-bitcoin-core_remove-serialize.h.patch116
-rw-r--r--brave-1.43-brave_today-base_utf_string_conversions.patch61
-rw-r--r--brave-1.43-debounce-debounce_navigation_throttle_fix.patch13
-rw-r--r--brave-1.43-ntp_background_images-std-size_t.patch32
-rw-r--r--brave-browser.desktop126
-rw-r--r--brave-launcher29
-rw-r--r--chromium-launcher-electron-app.patch81
-rw-r--r--chromium-no-history.patch12
-rw-r--r--rust-autocxx-use_sysroot.patch18
-rw-r--r--system-rust-utils.patch77
14 files changed, 916 insertions, 525 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0b5196fb9889..e21c046cbffc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,70 +1,86 @@
pkgbase = brave
pkgdesc = A web browser that stops ads and trackers by default
- pkgver = 1.30.87
+ pkgver = 1.44.112
pkgrel = 1
url = https://www.brave.com/download
arch = x86_64
- license = custom
+ license = BSD
+ license = MPL
+ license = custom:chromium
+ makedepends = cargo-audit
+ makedepends = cbindgen
makedepends = clang
+ makedepends = cxxbridge
makedepends = git
- makedepends = glibc
+ makedepends = gn
makedepends = gperf
- makedepends = icu
makedepends = java-runtime-headless
+ makedepends = jq
+ makedepends = lld
makedepends = llvm
+ makedepends = ninja
makedepends = npm
makedepends = pipewire
- makedepends = python
makedepends = python-protobuf
- makedepends = ncurses5-compat-libs
depends = alsa-lib
+ depends = dbus
+ depends = desktop-file-utils
depends = gtk3
- depends = json-glib
+ depends = hicolor-icon-theme
+ depends = libcups
+ depends = libgcrypt
+ depends = libpulse
depends = libva
depends = libxss
depends = nss
- depends = ttf-font
+ depends = pciutils
+ depends = systemd
+ depends = ttf-liberation
+ depends = xdg-utils
optdepends = pipewire: WebRTC desktop sharing under Wayland
optdepends = kdialog: support for native dialogs in Plasma
- optdepends = org.freedesktop.secrets: password storage backend on GNOME / Xfce
- optdepends = kwallet: support for storing passwords in KWallet on Plasma
- optdepends = sccache: For faster builds
- options = !lto
- source = brave-browser::git+https://github.com/brave/brave-browser.git#tag=v1.30.87
- source = chromium::git+https://github.com/chromium/chromium.git
- source = git+https://chromium.googlesource.com/chromium/tools/depot_tools.git
- source = git+https://github.com/brave/brave-core.git#tag=v1.30.87
- source = git+https://github.com/brave/adblock-rust.git
- source = brave-launcher
- source = brave-browser.desktop
- source = chromium-launcher-8.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v8.tar.gz
- source = https://github.com/stha09/chromium-patches/releases/download/chromium-94-patchset-3/chromium-94-patchset-3.tar.xz
- source = chromium-no-history.patch
- source = replace-blacklist-with-ignorelist.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/replace-blacklist-with-ignorelist.patch
- source = add-a-TODO-about-a-missing-pnacl-flag.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/add-a-TODO-about-a-missing-pnacl-flag.patch
- source = use-ffile-compilation-dir.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/use-ffile-compilation-dir.patch
- source = sql-make-VirtualCursor-standard-layout-type.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/sql-make-VirtualCursor-standard-layout-type.patch
- source = chromium-93-ffmpeg-4.4.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/chromium-93-ffmpeg-4.4.patch
- source = chromium-94-ffmpeg-roll.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/chromium-94-ffmpeg-roll.patch
- source = unexpire-accelerated-video-decode-flag.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/unexpire-accelerated-video-decode-flag.patch
- source = use-oauth2-client-switches-as-default.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/d1911c4fdd73fad51b38c5ff29e2457975312f1b/chromium/trunk/use-oauth2-client-switches-as-default.patch
+ optdepends = org.freedesktop.secrets: password storage backend
+ source = brave-browser::git+https://github.com/brave/brave-browser.git#tag=v1.44.112
+ source = brave::git+https://github.com/brave/brave-core.git#tag=v1.44.112
+ source = chromium::git+https://chromium.googlesource.com/chromium/src.git#tag=106.0.5249.119
+ source = depot_tools::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git
+ source = https://github.com/foutrelis/chromium-launcher/archive/refs/tags/v8/chromium-launcher-8.tar.gz
+ source = https://github.com/stha09/chromium-patches/releases/download/chromium-106-patchset-2/chromium-106-patchset-2.tar.xz
+ source = https://gitlab.com/hadogenes/brave-patches/-/archive/brave-1.28-patches-1/brave-patches-brave-1.28-patches-1.zip
+ source = chromium-launcher-electron-app.patch
+ source = rust-autocxx-use_sysroot.patch
+ source = system-rust-utils.patch
+ source = brave-1.43-bat-native-ads-hash_vectorizer_fix-cstring.patch
+ source = brave-1.43-bat-native-ads-vector_data_fix-cmath.patch
+ source = brave-1.43-bitcoin-core_remove-serialize.h.patch
+ source = brave-1.43-brave_today-base_utf_string_conversions.patch
+ source = brave-1.43-debounce-debounce_navigation_throttle_fix.patch
+ source = brave-1.43-ntp_background_images-std-size_t.patch
+ source = unbundle-jsoncpp-avoid-CFI-faults-with-is_cfi-true.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/bf2401407df5bcc938382eb03748fbef41e41c89/trunk/unbundle-jsoncpp-avoid-CFI-faults-with-is_cfi-true.patch
+ source = REVERT-enable-GlobalMediaControlsCastStartStop.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/bf2401407df5bcc938382eb03748fbef41e41c89/trunk/REVERT-enable-GlobalMediaControlsCastStartStop.patch
+ source = REVERT-roll-src-third_party-ffmpeg-m102.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/bf2401407df5bcc938382eb03748fbef41e41c89/trunk/REVERT-roll-src-third_party-ffmpeg-m102.patch
+ source = REVERT-roll-src-third_party-ffmpeg-m106.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/bf2401407df5bcc938382eb03748fbef41e41c89/trunk/REVERT-roll-src-third_party-ffmpeg-m106.patch
+ source = angle-wayland-include-protocol.patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/bf2401407df5bcc938382eb03748fbef41e41c89/trunk/angle-wayland-include-protocol.patch
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
- sha256sums = SKIP
- sha256sums = e4478c79e2eed500777117bb1d48f4be1866908dcda8d75003a5d055618dfdca
- sha256sums = fa6ed4341e5fc092703535b8becaa3743cb33c72f683ef450edd3ef66f70d42d
sha256sums = 213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a
- sha256sums = 22692bddaf2761c6ddf9ff0bc4722972bca4d4c5b2fd3e5dbdac7eb60d914320
- sha256sums = ea3446500d22904493f41be69e54557e984a809213df56f3cdf63178d2afb49e
- sha256sums = d3344ba39b8c6ed202334ba7f441c70d81ddf8cdb15af1aa8c16e9a3a75fbb35
- sha256sums = d53da216538f2e741a6e048ed103964a91a98e9a3c10c27fdfa34d4692fdc455
- sha256sums = 921010cd8fab5f30be76c68b68c9b39fac9e21f4c4133bb709879592bbdf606e
- sha256sums = dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150
- sha256sums = 1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57
- sha256sums = 56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace
- sha256sums = 2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b
- sha256sums = e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711
+ sha256sums = 2ad419439379d17385b7fd99039aca875ba36ca31b591b9cd4ccef84273be121
+ sha256sums = c63c8eeac709293991418a09ac7d8c0adde10c151495876794e025bd2b0fb8fe
+ sha256sums = 9235485adc4acbfaf303605f4428a6995a7b0b3b5a95181b185afbcb9f1f6ae5
+ sha256sums = 8fc41a0d98b328a12b17d6b6702a65c13292332ed8a843e7f35392424e545913
+ sha256sums = f4345b63200a8bcf00876fa2f6eba99c49c97af1b6253b159072fbfad8fefeef
+ sha256sums = 754cecaf8bc6707f95265b5b0d56a3837e115f6583b6125c8e6b9ee37c4d6d8e
+ sha256sums = 5c1e562b25d4fe614f3a77e00accc53001541b7b3f308fb7512cce1138878d7e
+ sha256sums = 0b5764355b9201d201b1e08f700bbb5a7fa238bef127b95d36cbf8ce2afa73a6
+ sha256sums = ca7f3edbf17aeca84ec595b0cedcca47fb098fa8600651dcea6b396af3af8d93
+ sha256sums = 30a6a9ca2a6dd965cb2d9f02639079130948bf45d483f0c629f2cf8394a1c22f
+ sha256sums = ea0cd714ccaa839baf7c71e9077264016aa19415600f16b77d5398fd49f5a70b
+ sha256sums = b908f37c5a886e855953f69e4dd6b90baa35e79f5c74673f7425f2cdb642eb00
+ sha256sums = 779fb13f2494209d3a7f1f23a823e59b9dded601866d3ab095937a1a04e19ac6
+ sha256sums = 30df59a9e2d95dcb720357ec4a83d9be51e59cc5551365da4c0073e68ccdec44
+ sha256sums = 4c12d31d020799d31355faa7d1fe2a5a807f7458e7f0c374adf55edb37032152
+ sha256sums = cd0d9d2a1d6a522d47c3c0891dabe4ad72eabbebc0fe5642b9e22efa3d5ee572
pkgname = brave
diff --git a/PKGBUILD b/PKGBUILD
index cb391b4c9622..3d974e2706a8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,5 @@
# Maintainer: Caleb Maclennana <caleb@alerque.com>
+# Contributor: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
# Contributor: Monarc <warcraft99@web.de>
# Contributor: Joan Figueras <ffigue at gmail dot com>
# Contributor: Jacek Szafarkiewicz <szafar@linux.pl>
@@ -23,93 +24,116 @@
## 2 -> static
## 3 -> debug
## 4 -> release with custom cflags and system libs
-: "${COMPONENT:=1}"
+: "${COMPONENT:=4}"
pkgname=brave
-pkgver=1.30.87
+pkgver=1.44.112
pkgrel=1
pkgdesc='A web browser that stops ads and trackers by default'
arch=(x86_64)
url='https://www.brave.com/download'
-license=(custom)
+license=(BSD MPL custom:chromium)
depends=(alsa-lib
+ dbus
+ desktop-file-utils
gtk3
- json-glib
+ hicolor-icon-theme
+ libcups
+ libgcrypt
+ libpulse
libva
libxss
nss
- ttf-font)
-makedepends=(clang
+ pciutils
+ systemd
+ ttf-liberation
+ xdg-utils)
+makedepends=(cargo-audit
+ cbindgen
+ clang
+ cxxbridge
git
- glibc
+ gn
gperf
- icu
java-runtime-headless
+ jq
+ lld
llvm
+ ninja
npm
pipewire
- python
python-protobuf)
optdepends=('pipewire: WebRTC desktop sharing under Wayland'
'kdialog: support for native dialogs in Plasma'
- 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
- 'kwallet: support for storing passwords in KWallet on Plasma'
- 'sccache: For faster builds')
-options=(!lto)
-_chromium_base_ver=94
-_patchset=3
-_patchset_name="chromium-$_chromium_base_ver-patchset-$_patchset"
+ 'org.freedesktop.secrets: password storage backend')
+_chromium_ver=106.0.5249.119
+_gcc_patchset=2
+_patchset_name="chromium-${_chromium_ver%%.*}-patchset-$_gcc_patchset"
_launcher_ver=8
+_brave_base_ver="1.28"
+_brave_patchset="1"
+_brave_patchset_name="brave-$_brave_base_ver-patches-$_brave_patchset"
source=("brave-browser::git+https://github.com/brave/brave-browser.git#tag=v$pkgver"
- 'chromium::git+https://github.com/chromium/chromium.git'
- 'git+https://chromium.googlesource.com/chromium/tools/depot_tools.git'
- "git+https://github.com/brave/brave-core.git#tag=v$pkgver"
- 'git+https://github.com/brave/adblock-rust.git'
- brave-launcher
- brave-browser.desktop
- "chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz"
+ "brave::git+https://github.com/brave/brave-core.git#tag=v$pkgver"
+ "chromium::git+https://chromium.googlesource.com/chromium/src.git#tag=$_chromium_ver"
+ 'depot_tools::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git'
+ "https://github.com/foutrelis/chromium-launcher/archive/refs/tags/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz"
"https://github.com/stha09/chromium-patches/releases/download/$_patchset_name/$_patchset_name.tar.xz"
- chromium-no-history.patch)
-_arch_revision=d1911c4fdd73fad51b38c5ff29e2457975312f1b
-_patches=(replace-blacklist-with-ignorelist.patch
- add-a-TODO-about-a-missing-pnacl-flag.patch
- use-ffile-compilation-dir.patch
- sql-make-VirtualCursor-standard-layout-type.patch
- chromium-93-ffmpeg-4.4.patch
- chromium-94-ffmpeg-roll.patch
- unexpire-accelerated-video-decode-flag.patch
- use-oauth2-client-switches-as-default.patch)
+ "https://gitlab.com/hadogenes/brave-patches/-/archive/$_brave_patchset_name/brave-patches-$_brave_patchset_name.zip"
+ chromium-launcher-electron-app.patch
+ rust-autocxx-use_sysroot.patch
+ system-rust-utils.patch
+ brave-1.43-bat-native-ads-hash_vectorizer_fix-cstring.patch
+ brave-1.43-bat-native-ads-vector_data_fix-cmath.patch
+ brave-1.43-bitcoin-core_remove-serialize.h.patch
+ brave-1.43-brave_today-base_utf_string_conversions.patch
+ brave-1.43-debounce-debounce_navigation_throttle_fix.patch
+ brave-1.43-ntp_background_images-std-size_t.patch)
+_arch_revision=bf2401407df5bcc938382eb03748fbef41e41c89
+_patches=(unbundle-jsoncpp-avoid-CFI-faults-with-is_cfi-true.patch
+ REVERT-enable-GlobalMediaControlsCastStartStop.patch
+ REVERT-roll-src-third_party-ffmpeg-m102.patch
+ REVERT-roll-src-third_party-ffmpeg-m106.patch
+ angle-wayland-include-protocol.patch)
for _patch in "${_patches[@]}"; do
- source+=("$_patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/$_arch_revision/chromium/trunk/$_patch")
+ source+=("$_patch::https://raw.githubusercontent.com/archlinux/svntogit-packages/$_arch_revision/trunk/$_patch")
done
sha256sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
- 'SKIP'
- 'e4478c79e2eed500777117bb1d48f4be1866908dcda8d75003a5d055618dfdca'
- 'fa6ed4341e5fc092703535b8becaa3743cb33c72f683ef450edd3ef66f70d42d'
'213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
- '22692bddaf2761c6ddf9ff0bc4722972bca4d4c5b2fd3e5dbdac7eb60d914320'
- 'ea3446500d22904493f41be69e54557e984a809213df56f3cdf63178d2afb49e'
- 'd3344ba39b8c6ed202334ba7f441c70d81ddf8cdb15af1aa8c16e9a3a75fbb35'
- 'd53da216538f2e741a6e048ed103964a91a98e9a3c10c27fdfa34d4692fdc455'
- '921010cd8fab5f30be76c68b68c9b39fac9e21f4c4133bb709879592bbdf606e'
- 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150'
- '1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57'
- '56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace'
- '2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b'
- 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711')
+ '2ad419439379d17385b7fd99039aca875ba36ca31b591b9cd4ccef84273be121'
+ 'c63c8eeac709293991418a09ac7d8c0adde10c151495876794e025bd2b0fb8fe'
+ '9235485adc4acbfaf303605f4428a6995a7b0b3b5a95181b185afbcb9f1f6ae5'
+ '8fc41a0d98b328a12b17d6b6702a65c13292332ed8a843e7f35392424e545913'
+ 'f4345b63200a8bcf00876fa2f6eba99c49c97af1b6253b159072fbfad8fefeef'
+ '754cecaf8bc6707f95265b5b0d56a3837e115f6583b6125c8e6b9ee37c4d6d8e'
+ '5c1e562b25d4fe614f3a77e00accc53001541b7b3f308fb7512cce1138878d7e'
+ '0b5764355b9201d201b1e08f700bbb5a7fa238bef127b95d36cbf8ce2afa73a6'
+ 'ca7f3edbf17aeca84ec595b0cedcca47fb098fa8600651dcea6b396af3af8d93'
+ '30a6a9ca2a6dd965cb2d9f02639079130948bf45d483f0c629f2cf8394a1c22f'
+ 'ea0cd714ccaa839baf7c71e9077264016aa19415600f16b77d5398fd49f5a70b'
+ 'b908f37c5a886e855953f69e4dd6b90baa35e79f5c74673f7425f2cdb642eb00'
+ '779fb13f2494209d3a7f1f23a823e59b9dded601866d3ab095937a1a04e19ac6'
+ '30df59a9e2d95dcb720357ec4a83d9be51e59cc5551365da4c0073e68ccdec44'
+ '4c12d31d020799d31355faa7d1fe2a5a807f7458e7f0c374adf55edb37032152'
+ 'cd0d9d2a1d6a522d47c3c0891dabe4ad72eabbebc0fe5642b9e22efa3d5ee572')
# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
# Keys are the names in the above script; values are the dependencies in Arch
declare -gA _system_libs=(
+ [brotli]=brotli
+ [dav1d]=dav1d
[ffmpeg]=ffmpeg
[flac]=flac
[fontconfig]=fontconfig
[freetype]=freetype2
[harfbuzz-ng]=harfbuzz
[icu]=icu
+ [jsoncpp]=jsoncpp
+ [libaom]=aom
+ #[libavif]=libavif # needs https://github.com/AOMediaCodec/libavif/commit/d22d4de94120
[libdrm]=
[libjpeg]=libjpeg
[libpng]=libpng
@@ -120,284 +144,379 @@ declare -gA _system_libs=(
[opus]=opus
[re2]=re2
[snappy]=snappy
+ [woff2]=woff2
[zlib]=minizip
)
_unwanted_bundled_libs=(
- "$(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')"
+ "$(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')"
)
-# Add depends if user wants a release with custom cflags and system libs
-if [ "$COMPONENT" = "4" ]; then
- # echo "Build with system libs is disabled for now" && exit 1
- brave_base_ver="$(echo "$pkgver" | cut -d . -f 1-2)"
- brave_patchset="1"
- brave_patchset_name="brave-$brave_base_ver-patches-$brave_patchset"
- source+=("https://gitlab.com/hadogenes/brave-patches/-/archive/$brave_patchset_name/brave-patches-$brave_patchset_name.zip")
- sha256sums+=("c63c8eeac709293991418a09ac7d8c0adde10c151495876794e025bd2b0fb8fe")
-
- depends+=('libpulse' 'pciutils')
- depends+=("${_system_libs[@]}")
- makedepends+=('lld' 'libva' 'pipewire')
-else
- makedepends+=('ncurses5-compat-libs')
-fi
-
-_msg() {
- printf " -> %s" "$@"
-}
-
prepare() {
- cd brave-browser
-
- _msg "Prepare the environment..."
- npm install
- patch -Np1 -i ../chromium-no-history.patch
-
- git submodule init
- git config submodule.chromium.url "$srcdir"/chromium
- git config submodule.brave-core.url "$srcdir"/brave
- git config submodule.depot_tools.url "$srcdir"/depot_tools
- git config submodule.adblock-rust.url "$srcdir"/adblock-rust
- git submodule update
- cp -rT "$srcdir"/chromium src
- cp -rT "$srcdir"/brave-core src/brave
- cp -r "$srcdir"/depot_tools src/brave/vendor/
- cp -rT "$srcdir"/adblock-rust src/components/adblock_rust_ffi
-
- # checkout pgo profiles
- sed -i 's/"checkout_pgo_profiles": "%False%"/"checkout_pgo_profiles": "%True%"/g' src/brave/build/commands/lib/util.js
-
- _msg "Running \"npm run\""
- if [ -d src/out/Release ]; then
- npm run sync -- --force
- else
- npm run init
- fi
-
- _msg "Apply Chromium patches..."
- cd src/
-
- # https://crbug.com/893950
- sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
- third_party/blink/renderer/core/xml/*.cc \
- third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
- third_party/libxml/chromium/*.cc
-
- # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
- # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
- # runtime -- this allows signing into Chromium without baked-in values
- patch -Np1 -i ../../use-oauth2-client-switches-as-default.patch
-
- # Fix build with older ffmpeg
- patch -Np1 -i ../chromium-93-ffmpeg-4.4.patch
-
- # Revert change to custom function av_stream_get_first_dts; will need to
- # switch to bundled ffmpeg when we're no longer using ffmpeg 4.4 in Arch
- # Upstream commit that made first_dts internal causing Chromium to add a
- # custom function: https://github.com/FFmpeg/FFmpeg/commit/591b88e6787c4
- # https://crbug.com/1251779
- patch -Rp1 -i ../chromium-94-ffmpeg-roll.patch
-
- # https://crbug.com/1207478
- patch -Np0 -i ../../unexpire-accelerated-video-decode-flag.patch
-
- # Revert transition to -fsanitize-ignorelist (needs newer clang)
- patch -Rp1 -i ../../replace-blacklist-with-ignorelist.patch
-
- # Revert addition of -ffile-compilation-dir= (needs newer clang)
- patch -Rp1 -i ../../add-a-TODO-about-a-missing-pnacl-flag.patch
- patch -Rp1 -i ../../use-ffile-compilation-dir.patch
-
- # https://chromium-review.googlesource.com/c/chromium/src/+/2862724
- patch -Np1 -i ../../sql-make-VirtualCursor-standard-layout-type.patch
-
- # Fixes for building with libstdc++ instead of libc++
- patch -Np1 -i ../patches/chromium-90-ruy-include.patch
- patch -Np1 -i ../patches/chromium-94-CustomSpaces-include.patch
-
- # Link to system tools required by the build
- mkdir -p third_party/node/linux/node-linux-x64/bin
- ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
- ln -s /usr/bin/java third_party/jdk/current/bin/
-
-
- # Hacky patching
- sed -e 's/enable_distro_version_check = true/enable_distro_version_check = false/g' -i chrome/installer/linux/BUILD.gn
-
- # don't overwrite makepkg.conf RUSTFLAGS
- sed -i 's/= args.rust_flags/+= args.rust_flags/g' brave/script/cargo.py
-
- if [ "$COMPONENT" = "4" ]; then
- _msg "Add patches for custom build"
-
- # Allow building against system libraries in official builds
- sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
- tools/generate_shim_headers/generate_shim_headers.py
-
- # Remove bundled libraries for which we will use the system copies; this
- # *should* do what the remove_bundled_libraries.py script does, with the
- # added benefit of not having to list all the remaining libraries
- local _lib
- for _lib in "${_unwanted_bundled_libs[@]}"; do
- find "third_party/$_lib" -type f \
- \! -path "third_party/$_lib/chromium/*" \
- \! -path "third_party/$_lib/google/*" \
- \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
- \! -regex '.*\.\(gn\|gni\|isolate\)' \
- -delete
- done
-
- ./build/linux/unbundle/replace_gn_files.py \
- --system-libraries "${!_system_libs[@]}"
- fi
+ cd chromium-launcher-$_launcher_ver
+ patch -Np1 -i ../chromium-launcher-electron-app.patch
+
+ cd ../brave-browser
+
+ export DEPOT_TOOLS_UPDATE=0
+ export PATH="${PATH}:${srcdir:?}/depot_tools"
+
+ echo "Prepare the environment..."
+ npm install
+
+ cp -r ../brave src
+ cp -r ../depot_tools src/brave/vendor
+
+ cd src/brave || exit
+
+ if [ "$COMPONENT" = "4" ]; then
+ patch -Np1 -i "${srcdir}/system-rust-utils.patch"
+ fi
+
+ jq ".config.projects.chrome.repository.url = \"file://${srcdir}/chromium@${_chromium_ver}\"" package.json > tmp.json
+ mv {tmp,package}.json
+
+ npm install
+
+ cd ../..
+
+ echo "Running \"npm run\""
+ if [ -d src/out/Release ]; then
+ npm run sync -- --force --nohooks
+ else
+ npm run init -- --nohooks
+ fi
+
+ echo "Running hooks..."
+ # python "${srcdir}/depot_tools/gclient.py" runhooks
+ src/build/landmines.py
+ src/build/util/lastchange.py -o src/build/util/LASTCHANGE
+ src/build/util/lastchange.py -m GPU_LISTS_VERSION \
+ --revision-id-only --header src/gpu/config/gpu_lists_version.h
+ src/build/util/lastchange.py -m SKIA_COMMIT_HASH \
+ -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h
+ src/build/util/lastchange.py -s src/third_party/dawn \
+ --revision src/gpu/webgpu/DAWN_VERSION
+ # Create sysmlink to system clang-format
+ ln -sf /usr/bin/clang-format src/buildtools/linux64
+ # Create sysmlink to system Node.js
+ mkdir -p src/third_party/node/linux/node-linux-x64/bin
+ ln -sf /usr/bin/node src/third_party/node/linux/node-linux-x64/bin
+ src/third_party/depot_tools/download_from_google_storage.py \
+ --no_resume --extract --no_auth --bucket chromium-nodejs \
+ -s src/third_party/node/node_modules.tar.gz.sha1
+ python src/tools/download_optimization_profile.py \
+ --newest_state=src/chrome/android/profiles/newest.txt \
+ --local_state=src/chrome/android/profiles/local.txt \
+ --output_name=src/chrome/android/profiles/afdo.prof \
+ --gs_url_base=chromeos-prebuilt/afdo-job/llvm
+ # ln -s /usr/bin/java third_party/jdk/current/bin
+
+ # Brave specific hooks
+ cd src/brave
+ # python script/bootstrap.py
+ echo > vendor/depot_tools/python3_bin_reldir.txt
+ ln -sf /usr/bin/python vendor/depot_tools/python3
+ npm install --no-save --yes
+ python script/web_discovery_project.py --install
+ python script/generate_licenses.py
+ cd ../..
+
+ echo "Apply Chromium patches..."
+ cd src
+
+ # https://crbug.com/893950
+ sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
+ third_party/blink/renderer/core/xml/*.cc \
+ third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
+ third_party/libxml/chromium/*.cc \
+ third_party/maldoca/src/maldoca/ole/oss_utils.h
+
+ # Upstream fixes
+ patch -Np1 -i "${srcdir}/unbundle-jsoncpp-avoid-CFI-faults-with-is_cfi-true.patch"
+
+ # Revert kGlobalMediaControlsCastStartStop enabled by default
+ # https://crbug.com/1314342
+ patch -Rp1 -F3 -i "${srcdir}/REVERT-enable-GlobalMediaControlsCastStartStop.patch"
+
+ # Revert ffmpeg roll requiring new channel layout API support
+ # https://crbug.com/1325301
+ patch -Rp1 -i "${srcdir}/REVERT-roll-src-third_party-ffmpeg-m102.patch"
+ # Revert switch from AVFrame::pkt_duration to AVFrame::duration
+ patch -Rp1 -i "${srcdir}/REVERT-roll-src-third_party-ffmpeg-m106.patch"
+
+ # https://crbug.com/angleproject/7582
+ patch -Np0 -i "${srcdir}/angle-wayland-include-protocol.patch"
+
+ # Fixes for building with libstdc++ instead of libc++
+ patch -Np1 -i "${srcdir}/patches/chromium-103-VirtualCursor-std-layout.patch"
+ patch -Np1 -i "${srcdir}/patches/chromium-105-compiler.patch"
+ patch -Np1 -i "${srcdir}/patches/chromium-106-AutofillPopupControllerImpl-namespace.patch"
+
+ # Sysroot usage in autocxx for Rust
+ patch -Np1 -i "${srcdir}/rust-autocxx-use_sysroot.patch"
+
+ # Hacky patching
+ sed -e 's/\(enable_distro_version_check =\) true/\1 false/g' -i chrome/installer/linux/BUILD.gn
+
+ # Allow building against system libraries in official builds
+ if [ "$COMPONENT" = "4" ]; then
+ sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
+ tools/generate_shim_headers/generate_shim_headers.py
+
+ echo "Add patches for custom build"
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*logging*.patch
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*ads-dismissed*.patch
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*ads-hash*.patch
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*ads-vector*.patch
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*ads-ad*.patch
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*ads-eligible*.patch
+ rm "$srcdir/brave-patches-$_brave_patchset_name"/brave-*bitcoin*.patch
+ for _patch in "$srcdir/brave-patches-$_brave_patchset_name"/*.patch; do
+ patch -Np1 -i "$_patch"
+ done
+ for _patch in "$srcdir/brave"*.patch; do
+ patch -Np1 -i "$_patch"
+ done
+
+ # Remove bundled libraries for which we will use the system copies; this
+ # *should* do what the remove_bundled_libraries.py script does, with the
+ # added benefit of not having to list all the remaining libraries and
+ # preserving their git directories
+ local _lib
+ for _lib in ${_unwanted_bundled_libs[@]}; do
+ find "third_party/$_lib" -type f \
+ \! -path "third_party/$_lib/chromium/*" \
+ \! -path "third_party/$_lib/google/*" \
+ \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
+ \! -regex '.*\.\(git.*\|gn\|gni\|isolate\)' \
+ -delete
+ done
+
+ ./build/linux/unbundle/replace_gn_files.py \
+ --system-libraries "${!_system_libs[@]}"
+ fi
}
build() {
- cd "brave-browser"
-
- if check_buildoption ccache y; then
- # Avoid falling back to preprocessor mode when sources contain time macros
- export CCACHE_SLOPPINESS=time_macros
- fi
-
- export CC=clang
- export CXX=clang++
- export AR=llvm-ar
- export NM=llvm-nm
-
- if [ "$USE_SCCACHE" -eq "1" ]; then
- echo "sccache = /usr/bin/sccache" >> .npmrc
- fi
-
- echo 'brave_variations_server_url = https://variations.brave.com/seed' >> .npmrc
- echo 'brave_stats_updater_url = https://laptop-updates.brave.com' >> .npmrc
- echo 'brave_stats_api_key = fe033168-0ff8-4af6-9a7f-95e2cbfc' >> .npmrc
- echo 'brave_sync_endpoint = https://sync-v2.brave.com/v2' >> .npmrc
- echo "uphold_client_id = 6d8d9473ed20be627f71ed46e207f40c004c5b1a" >> .npmrc
- echo "uphold_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> .npmrc
- echo "uphold_staging_client_id = 4c2b665ca060d912fec5c735c734859a06118cc8" >> .npmrc
- echo "uphold_staging_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> .npmrc
- echo "gemini_api_url = https://api.gemini.com/v1" >> .npmrc
- echo "gemini_oauth_url = https://api.gemini.com/v1/oauth" >> .npmrc
- echo "gemini_wallet_client_id = 6d8d9473ed20be627f71ed46e207f40c004c5b1a" >> .npmrc
- echo "gemini_wallet_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> .npmrc
-
- npm_args=()
- if [ "$COMPONENT" = "4" ]; then
- local _flags=(
- 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
- 'host_toolchain="//build/toolchain/linux/unbundle:default"'
- 'clang_use_chrome_plugins=false'
- 'is_official_build=true' # implies is_cfi=true on x86_64
- 'treat_warnings_as_errors=false'
- 'disable_fieldtrial_testing_config=true'
- 'blink_enable_generated_code_formatting=false'
- 'ffmpeg_branding="Chrome"'
- 'proprietary_codecs=true'
- 'rtc_use_pipewire=true'
- 'link_pulseaudio=true'
- 'use_gnome_keyring=false'
- 'use_sysroot=false'
- 'use_custom_libcxx=false'
- 'enable_hangout_services_extension=true'
- 'enable_widevine=true'
- 'enable_nacl=false'
- 'target_sysroot=/'
- 'use_vaapi=true'
- 'is_clang=true'
- 'use_lld=true'
- 'chrome_pgo_phase=2'
- )
-
- if [[ -n ${_system_libs[icu]+set} ]]; then
- _flags+=('icu_use_data_file=false')
- fi
-
- if check_option strip y; then
- _flags+=('symbol_level=0'
- 'blink_symbol_level=0')
- fi
-
- # Filter known bad flags
- CFLAGS=${CFLAGS/Ofast/O3}
- CXXFLAGS=${CXXFLAGS/Ofast/O3}
-
- # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
- CFLAGS+=' -Wno-builtin-macro-redefined'
- CXXFLAGS+=' -Wno-builtin-macro-redefined'
- CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
-
- # Do not warn about unknown warning options
- CFLAGS+=' -Wno-unknown-warning-option'
- CXXFLAGS+=' -Wno-unknown-warning-option'
-
- npm_args+=(
- "$(echo "${_flags[@]}" | tr ' ' '\n' | sed -e 's/=/:/' -e 's/^/--gn=/')"
- )
- fi
-
- ## See explanation on top to select your build
- case $COMPONENT in
- 0)
- _msg "Normal build (with debug)"
- npm run build
- ;;
- 2)
- _msg "Static build"
- npm run build -- Static
- ;;
- 3)
- _msg "Debug build"
- npm run build -- Debug
- ;;
- 4)
- _msg "Release custom build"
- npm run build Release -- "${npm_args[@]}"
- ;;
- 1|*)
- _msg "Release build"
- npm run build Release
- ;;
- esac
+ make CHROMIUM_APP=Brave CHROMIUM_NAME=brave -C chromium-launcher-$_launcher_ver
+
+ cd "brave-browser"
+
+ if check_buildoption ccache y; then
+ # Avoid falling back to preprocessor mode when sources contain time macros
+ export CCACHE_SLOPPINESS=time_macros
+ fi
+
+ export PATH="${PATH}:${srcdir:?}/brave-browser/src/brave/vendor/depot_tools"
+
+ export CC=clang
+ export CXX=clang++
+ export AR=llvm-ar
+ export NM=llvm-nm
+
+ if [ "$USE_SCCACHE" -eq "1" ]; then
+ echo "sccache = /usr/bin/sccache" >> .npmrc
+ fi
+
+ echo "brave_services_key = qjVKcxtUybh8WpKNoQ7EbgbkJTMu7omjDHKk=VrPApb8PwJyPE9eqchxedTsMEWg" > .npmrc
+ echo "brave_variations_server_url = https://variations.brave.com/seed" >> .npmrc
+ echo "brave_stats_updater_url = https://laptop-updates.brave.com" >> .npmrc
+ echo "brave_stats_api_key = fe033168-0ff8-4af6-9a7f-95e2cbfc" >> .npmrc
+ echo "brave_sync_endpoint = https://sync-v2.brave.com/v2" >> .npmrc
+ echo "updater_dev_endpoint = https://go-updater-dev.bravesoftware.com/extensions" >> .npmrc
+ echo "updater_prod_endpoint = https://go-updater.brave.com/extensions" >> .npmrc
+ echo "rewards_grant_dev_endpoint = https://grant.rewards.brave.com" >> .npmrc
+ echo "rewards_grant_staging_endpoint = https://grant.rewards.brave.com" >> .npmrc
+ echo "rewards_grant_prod_endpoint = https://grant.rewards.brave.com" >> .npmrc
+ echo "uphold_client_id = 6d8d9473ed20be627f71ed46e207f40c004c5b1a" >> .npmrc
+ echo "uphold_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> .npmrc
+ echo "uphold_staging_client_id = 4c2b665ca060d912fec5c735c734859a06118cc8" >> .npmrc
+ echo "uphold_staging_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> .npmrc
+ echo "gemini_api_url = https://api.gemini.com/v1" >> .npmrc
+ echo "gemini_oauth_url = https://api.gemini.com/v1/oauth" >> .npmrc
+ echo "gemini_wallet_client_id = 6d8d9473ed20be627f71ed46e207f40c004c5b1a" >> .npmrc
+ echo "gemini_wallet_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> .npmrc
+ echo "sardine_client_id = 7ca8433c-7e61-4e25-b76e-25aa2da68df1" >> .npmrc
+ echo "sardine_client_secret = 7ca8433c-7e61-4e25-b76e-25aa2da68df1" >> .npmrc
+
+ npm_args=()
+ if [ "$COMPONENT" = "4" ]; then
+ local _flags=(
+ 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'host_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'clang_base_path="/usr"'
+ 'clang_use_chrome_plugins=false'
+ 'symbol_level=0' # sufficient for backtraces on x86(_64)
+ 'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile
+ 'treat_warnings_as_errors=false'
+ 'disable_fieldtrial_testing_config=true'
+ 'blink_enable_generated_code_formatting=false'
+ 'ffmpeg_branding="Chrome"'
+ 'proprietary_codecs=true'
+ 'rtc_use_pipewire=true'
+ 'link_pulseaudio=true'
+ 'use_gnome_keyring=false'
+ 'use_sysroot=false'
+ 'use_custom_libcxx=false'
+ 'enable_hangout_services_extension=true'
+ 'enable_widevine=true'
+ 'enable_nacl=false'
+ 'use_vaapi=true'
+ )
+ _flags+=("rustup_path=\"$HOME/.rustup\"" "cargo_path=\"$HOME/.cargo\"")
+
+ if [[ -n ${_system_libs[icu]+set} ]]; then
+ _flags+=('icu_use_data_file=false')
+ fi
+
+ # This specific tool requires to be built outside of an official build
+ echo "${_flags[@]}" | tr ' ' '\n' >> src/brave/tools/redirect_cc/args.gni
+
+ _flags+=('is_official_build=true') # implies is_cfi=true on x86_64
+
+ # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
+ CFLAGS+=' -Wno-builtin-macro-redefined'
+ CXXFLAGS+=' -Wno-builtin-macro-redefined'
+ CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
+
+ # Do not warn about unknown warning options
+ CFLAGS+=' -Wno-unknown-warning-option'
+ CXXFLAGS+=' -Wno-unknown-warning-option'
+
+ npm_args+=(
+ $(echo "${_flags[@]}" | tr ' ' '\n' | sed -e 's/=/:/' -e 's/^/--gn=/')
+ )
+ fi
+
+ # Let Chromium set its own symbol level
+ CFLAGS=${CFLAGS/-g }
+ CXXFLAGS=${CXXFLAGS/-g }
+
+ # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
+ CFLAGS=${CFLAGS/-fexceptions}
+ CFLAGS=${CFLAGS/-fcf-protection}
+ CXXFLAGS=${CXXFLAGS/-fexceptions}
+ CXXFLAGS=${CXXFLAGS/-fcf-protection}
+
+ # This appears to cause random segfaults when combined with ThinLTO
+ # https://bugs.archlinux.org/task/73518
+ CFLAGS=${CFLAGS/-fstack-clash-protection}
+ CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}
+
+ # https://crbug.com/957519#c122
+ CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
+
+ ## See explanation on top to select your build
+ case $COMPONENT in
+ 0)
+ echo "Normal build (with debug)"
+ npm run build
+ npm run build -- --target chrome_sandbox
+ npm run build -- --target chromedriver.unstripped
+ ;;
+ 2)
+ echo "Static build"
+ npm run build Static
+ npm run build Static -- --target chrome_sandbox
+ npm run build Static -- --target chromedriver.unstripped
+ ;;
+ 3)
+ echo "Debug build"
+ npm run build Debug
+ npm run build Debug -- --target chrome_sandbox
+ npm run build Debug -- --target chromedriver.unstripped
+ ;;
+ 4)
+ echo "Release custom build"
+ npm run build Release -- "${npm_args[@]}"
+ npm run build Release -- --target chrome_sandbox "${npm_args[@]}"
+ npm run build Release -- --target chromedriver.unstripped "${npm_args[@]}"
+ ;;
+ 1|*)
+ echo "Release build"
+ npm run build Release
+ npm run build Release -- --target chrome_sandbox
+ npm run build Release -- --target chromedriver.unstripped
+ ;;
+ esac
}
package() {
- install -d -m0755 "$pkgdir/usr/lib/$pkgname/"{,swiftshader,locales,resources}
-
- # Copy necessary release files
- cd "brave-browser/src/out/Release"
- cp -a --reflink=auto \
- MEIPreload \
- brave \
- brave_*.pak \
- chrome_*.pak \
- resources.pak \
- v8_context_snapshot.bin \
- libGLESv2.so \
- libEGL.so \
- chrome_crashpad_handler \
- "$pkgdir/usr/lib/$pkgname/"
- cp -a --reflink=auto \
- swiftshader/libGLESv2.so \
- swiftshader/libEGL.so \
- "$pkgdir/usr/lib/$pkgname/swiftshader/"
- cp -a --reflink=auto \
- locales/*.pak \
- "$pkgdir/usr/lib/$pkgname/locales/"
- cp -a --reflink=auto \
- resources/brave_extension \
- resources/brave_rewards \
- "$pkgdir/usr/lib/$pkgname/resources/"
-
- if [ "$COMPONENT" != "4" ] || [[ -z ${_system_libs[icu]+set} ]]; then
- cp -a --reflink=auto \
- icudtl.dat \
- "$pkgdir/usr/lib/$pkgname/"
- fi
-
- cd "$srcdir"
- install -Dm0755 brave-launcher "$pkgdir/usr/bin/$pkgname"
- install -Dm0644 -t "$pkgdir/usr/share/applications/" brave-browser.desktop
- install -Dm0644 "brave-browser/src/brave/app/theme/brave/product_logo_128.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"
- install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname" "brave-browser/LICENSE"
+ cd chromium-launcher-$_launcher_ver
+ make PREFIX=/usr DESTDIR="$pkgdir" CHROMIUM_NAME=brave install
+
+ install -Dm644 LICENSE \
+ "$pkgdir/usr/share/licenses/$pkgname/LICENSE.launcher"
+
+ install -d -m0755 "$pkgdir/usr/lib/$pkgname/"{,locales,resources}
+
+ # Copy necessary release files
+ cd ../brave-browser/src
+
+ install -Dm755 out/Release/$pkgname "$pkgdir/usr/lib/$pkgname/$pkgname"
+ install -Dm755 out/Release/chromedriver.unstripped "$pkgdir/usr/bin/bravedriver"
+ install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/$pkgname/chrome-sandbox"
+ ln -s $pkgname "$pkgdir/usr/bin/$pkgname-browser"
+ ln -s $pkgname "$pkgdir/usr/lib/$pkgname/$pkgname-browser"
+
+ install -Dm644 chrome/installer/linux/common/desktop.template \
+ "$pkgdir/usr/share/applications/$pkgname-browser.desktop"
+ sed -i \
+ -e 's/@@MENUNAME@@/Brave/g' \
+ -e 's/@@PACKAGE@@/brave/g' \
+ -e 's/@@USR_BIN_SYMLINK_NAME@@/brave/g' \
+ "$pkgdir/usr/share/applications/$pkgname-browser.desktop"
+
+ install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
+ "$pkgdir/usr/share/metainfo/$pkgname-browser.appdata.xml"
+ sed -ni \
+ -e 's/chromium-browser\.desktop/brave-browser.desktop/' \
+ -e '/<update_contact>/d' \
+ -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
+ -e '/^<?xml/,$p' \
+ "$pkgdir/usr/share/metainfo/$pkgname-browser.appdata.xml"
+
+ local toplevel_files=(
+ brave_100_percent.pak
+ brave_200_percent.pak
+ brave_resources.pak
+
+ # Chromium
+ chrome_100_percent.pak
+ chrome_200_percent.pak
+ chrome_crashpad_handler
+ resources.pak
+ v8_context_snapshot.bin
+
+ # ANGLE
+ libEGL.so
+ libGLESv2.so
+
+ # SwiftShader ICD
+ libvk_swiftshader.so
+ vk_swiftshader_icd.json
+ )
+
+ if [[ -z ${_system_libs[icu]+set} ]]; then
+ toplevel_files+=(icudtl.dat)
+ fi
+
+ cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/$pkgname/"
+ install -Dm644 -t "$pkgdir/usr/lib/$pkgname/locales" out/Release/locales/*.pak
+ install -Dm644 -t "$pkgdir/usr/lib/$pkgname/MEIPreload" out/Release/MEIPreload/*.*
+
+ cp -r out/Release/resources/brave_* "$pkgdir/usr/lib/$pkgname/resources/"
+
+ for size in 24 48 64 128 256; do
+ install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
+ "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/$pkgname.png"
+ done
+
+ for size in 16 32; do
+ install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
+ "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/$pkgname.png"
+ done
+
+ install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE.chromium"
+ install -Dm0644 brave/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
diff --git a/brave-1.43-bat-native-ads-hash_vectorizer_fix-cstring.patch b/brave-1.43-bat-native-ads-hash_vectorizer_fix-cstring.patch
new file mode 100644
index 000000000000..6d4b47074186
--- /dev/null
+++ b/brave-1.43-bat-native-ads-hash_vectorizer_fix-cstring.patch
@@ -0,0 +1,13 @@
+diff --git a/vendor/bat-native-ads/src/bat/ads/internal/ml/transformation/hash_vectorizer.cc b/vendor/bat-native-ads/src/bat/ads/internal/ml/transformation/hash_vectorizer.cc
+index 7933b7d988..1a9498dd43 100644
+--- a/brave/vendor/bat-native-ads/src/bat/ads/internal/ml/transformation/hash_vectorizer.cc
++++ b/brave/vendor/bat-native-ads/src/bat/ads/internal/ml/transformation/hash_vectorizer.cc
+@@ -5,6 +5,8 @@
+
+ #include "bat/ads/internal/ml/transformation/hash_vectorizer.h"
+
++#include <cstring>
++
+ #include "bat/ads/internal/ml/data/text_data.h"
+ #include "third_party/zlib/zlib.h"
+
diff --git a/brave-1.43-bat-native-ads-vector_data_fix-cmath.patch b/brave-1.43-bat-native-ads-vector_data_fix-cmath.patch
new file mode 100644
index 000000000000..9be651d17d8b
--- /dev/null
+++ b/brave-1.43-bat-native-ads-vector_data_fix-cmath.patch
@@ -0,0 +1,12 @@
+diff --git a/vendor/bat-native-ads/src/bat/ads/internal/ml/data/vector_data.cc b/vendor/bat-native-ads/src/bat/ads/internal/ml/data/vector_data.cc
+index 9f53602351..f7365fc0aa 100644
+--- a/brave/vendor/bat-native-ads/src/bat/ads/internal/ml/data/vector_data.cc
++++ b/brave/vendor/bat-native-ads/src/bat/ads/internal/ml/data/vector_data.cc
+@@ -8,6 +8,7 @@
+ #include <limits>
+ #include <numeric>
+ #include <utility>
++#include <cmath>
+
+ #include "base/check_op.h"
+
diff --git a/brave-1.43-bitcoin-core_remove-serialize.h.patch b/brave-1.43-bitcoin-core_remove-serialize.h.patch
new file mode 100644
index 000000000000..eb6948e896d3
--- /dev/null
+++ b/brave-1.43-bitcoin-core_remove-serialize.h.patch
@@ -0,0 +1,116 @@
+diff --git a/brave/chromium_src/brave/third_party/bitcoin-core/src/src/serialize.h b/brave/chromium_src/brave/third_party/bitcoin-core/src/src/serialize.h
+deleted file mode 100644
+index 84ed46ed35..0000000000
+--- a/brave/chromium_src/brave/third_party/bitcoin-core/src/src/serialize.h
++++ /dev/null
+@@ -1,28 +0,0 @@
+-/* Copyright (c) 2021 The Brave Authors. All rights reserved.
+- * This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#ifndef BRAVE_CHROMIUM_SRC_BRAVE_THIRD_PARTY_BITCOIN_CORE_SRC_SRC_SERIALIZE_H_
+-#define BRAVE_CHROMIUM_SRC_BRAVE_THIRD_PARTY_BITCOIN_CORE_SRC_SRC_SERIALIZE_H_
+-
+-#include <ios>
+-#include <string>
+-
+-#include "base/check.h"
+-
+-namespace std {
+-namespace brave {
+-using string = ::std::string;
+-}
+-} // namespace std
+-
+-#define throw CHECK(false) <<
+-#define ios_base brave
+-#define failure string
+-#include "src/brave/third_party/bitcoin-core/src/src/serialize.h"
+-#undef throw
+-#undef ios_base
+-#undef string
+-
+-#endif // BRAVE_CHROMIUM_SRC_BRAVE_THIRD_PARTY_BITCOIN_CORE_SRC_SRC_SERIALIZE_H_
+diff --git a/brave/third_party/bitcoin-core/src/src/serialize.h b/brave/third_party/bitcoin-core/src/src/serialize.h
+index d9ca984f9..f23f8c412 100644
+--- a/brave/third_party/bitcoin-core/src/src/serialize.h
++++ b/brave/third_party/bitcoin-core/src/src/serialize.h
+@@ -24,6 +24,8 @@
+ #include <prevector.h>
+ #include <span.h>
+
++#include "base/check.h"
++
+ /**
+ * The maximum size of a serialized object in bytes or number of elements
+ * (for eg vectors) when the size is encoded as CompactSize.
+@@ -327,22 +329,22 @@ uint64_t ReadCompactSize(Stream& is, bool range_check = true)
+ {
+ nSizeRet = ser_readdata16(is);
+ if (nSizeRet < 253)
+- throw std::ios_base::failure("non-canonical ReadCompactSize()");
++ CHECK(false) << std::string("non-canonical ReadCompactSize()");
+ }
+ else if (chSize == 254)
+ {
+ nSizeRet = ser_readdata32(is);
+ if (nSizeRet < 0x10000u)
+- throw std::ios_base::failure("non-canonical ReadCompactSize()");
++ CHECK(false) << std::string("non-canonical ReadCompactSize()");
+ }
+ else
+ {
+ nSizeRet = ser_readdata64(is);
+ if (nSizeRet < 0x100000000ULL)
+- throw std::ios_base::failure("non-canonical ReadCompactSize()");
++ CHECK(false) << std::string("non-canonical ReadCompactSize()");
+ }
+ if (range_check && nSizeRet > MAX_SIZE) {
+- throw std::ios_base::failure("ReadCompactSize(): size too large");
++ CHECK(false) << std::string("ReadCompactSize(): size too large");
+ }
+ return nSizeRet;
+ }
+@@ -435,12 +437,12 @@ I ReadVarInt(Stream& is)
+ while(true) {
+ unsigned char chData = ser_readdata8(is);
+ if (n > (std::numeric_limits<I>::max() >> 7)) {
+- throw std::ios_base::failure("ReadVarInt(): size too large");
++ CHECK(false) << std::string("ReadVarInt(): size too large");
+ }
+ n = (n << 7) | (chData & 0x7F);
+ if (chData & 0x80) {
+ if (n == std::numeric_limits<I>::max()) {
+- throw std::ios_base::failure("ReadVarInt(): size too large");
++ CHECK(false) << std::string("ReadVarInt(): size too large");
+ }
+ n++;
+ } else {
+@@ -512,7 +514,7 @@ struct CustomUintFormatter
+
+ template <typename Stream, typename I> void Ser(Stream& s, I v)
+ {
+- if (v < 0 || v > MAX) throw std::ios_base::failure("CustomUintFormatter value out of range");
++ if (v < 0 || v > MAX) CHECK(false) << std::string("CustomUintFormatter value out of range");
+ if (BigEndian) {
+ uint64_t raw = htobe64(v);
+ s.write(((const char*)&raw) + 8 - Bytes, Bytes);
+@@ -548,7 +550,7 @@ struct CompactSizeFormatter
+ {
+ uint64_t n = ReadCompactSize<Stream>(s, RangeCheck);
+ if (n < std::numeric_limits<I>::min() || n > std::numeric_limits<I>::max()) {
+- throw std::ios_base::failure("CompactSize exceeds limit of type");
++ CHECK(false) << std::string("CompactSize exceeds limit of type");
+ }
+ v = n;
+ }
+@@ -571,7 +573,7 @@ struct LimitedStringFormatter
+ {
+ size_t size = ReadCompactSize(s);
+ if (size > Limit) {
+- throw std::ios_base::failure("String length limit exceeded");
++ CHECK(false) << std::string("String length limit exceeded");
+ }
+ v.resize(size);
+ if (size != 0) s.read((char*)v.data(), size);
diff --git a/brave-1.43-brave_today-base_utf_string_conversions.patch b/brave-1.43-brave_today-base_utf_string_conversions.patch
new file mode 100644
index 000000000000..99bdafee92b9
--- /dev/null
+++ b/brave-1.43-brave_today-base_utf_string_conversions.patch
@@ -0,0 +1,61 @@
+diff --git a/brave/components/brave_today/browser/feed_parsing.cc b/brave/components/brave_today/browser/feed_parsing.cc
+index 82a4a7205b..4369774a34 100644
+--- a/brave/components/brave_today/browser/feed_parsing.cc
++++ b/brave/components/brave_today/browser/feed_parsing.cc
+@@ -5,13 +5,13 @@
+
+ #include "brave/components/brave_today/browser/feed_parsing.h"
+
+-#include <codecvt>
+ #include <string>
+ #include <utility>
+ #include <vector>
+
+ #include "base/json/json_reader.h"
+ #include "base/logging.h"
++#include "base/strings/utf_string_conversions.h"
+ #include "base/time/time.h"
+ #include "brave/components/brave_today/common/brave_news.mojom-forward.h"
+ #include "brave/components/brave_today/common/brave_news.mojom-shared.h"
+@@ -78,9 +78,8 @@ bool ParseFeedItem(const base::Value& feed_item_raw,
+ // Successful, get language-specific relative time
+ base::TimeDelta relative_time_delta =
+ base::Time::Now() - metadata->publish_time;
+- std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
+ metadata->relative_time_description =
+- converter.to_bytes(ui::TimeFormat::Simple(
++ base::UTF16ToUTF8(ui::TimeFormat::Simple(
+ ui::TimeFormat::Format::FORMAT_ELAPSED,
+ ui::TimeFormat::Length::LENGTH_LONG, relative_time_delta));
+ }
+diff --git a/brave/components/brave_today/browser/direct_feed_controller.cc b/brave/components/brave_today/browser/direct_feed_controller.cc
+index 70d232eb9b..815e0df867 100644
+--- a/brave/components/brave_today/browser/direct_feed_controller.cc
++++ b/brave/components/brave_today/browser/direct_feed_controller.cc
+@@ -6,7 +6,6 @@
+ #include "brave/components/brave_today/browser/direct_feed_controller.h"
+
+ #include <algorithm>
+-#include <codecvt>
+ #include <iterator>
+ #include <memory>
+ #include <string>
+@@ -20,6 +19,7 @@
+ #include "base/location.h"
+ #include "base/logging.h"
+ #include "base/strings/string_util.h"
++#include "base/strings/utf_string_conversions.h"
+ #include "base/task/thread_pool.h"
+ #include "base/time/time.h"
+ #include "brave/components/brave_private_cdn/headers.h"
+@@ -59,9 +59,8 @@ mojom::ArticlePtr RustFeedItemToArticle(const FeedItem& rust_feed_item) {
+ // Get language-specific relative time
+ base::TimeDelta relative_time_delta =
+ base::Time::Now() - metadata->publish_time;
+- std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
+ metadata->relative_time_description =
+- converter.to_bytes(ui::TimeFormat::Simple(
++ base::UTF16ToUTF8(ui::TimeFormat::Simple(
+ ui::TimeFormat::Format::FORMAT_ELAPSED,
+ ui::TimeFormat::Length::LENGTH_LONG, relative_time_delta));
+ auto article = mojom::Article::New();
diff --git a/brave-1.43-debounce-debounce_navigation_throttle_fix.patch b/brave-1.43-debounce-debounce_navigation_throttle_fix.patch
new file mode 100644
index 000000000000..2e2c193947f2
--- /dev/null
+++ b/brave-1.43-debounce-debounce_navigation_throttle_fix.patch
@@ -0,0 +1,13 @@
+diff --git a/brave/components/debounce/browser/debounce_navigation_throttle.cc b/brave/components/debounce/browser/debounce_navigation_throttle.cc
+index ebdbfb38c6..85669affc3 100644
+--- a/brave/components/debounce/browser/debounce_navigation_throttle.cc
++++ b/brave/components/debounce/browser/debounce_navigation_throttle.cc
+@@ -56,7 +56,7 @@ class DebounceTabHelper
+ private:
+ friend class content::WebContentsUserData<DebounceTabHelper>;
+
+- std::vector<const std::string> redirects_;
++ std::vector<std::string> redirects_;
+ WEB_CONTENTS_USER_DATA_KEY_DECL();
+ };
+
diff --git a/brave-1.43-ntp_background_images-std-size_t.patch b/brave-1.43-ntp_background_images-std-size_t.patch
new file mode 100644
index 000000000000..526b89a3dcbb
--- /dev/null
+++ b/brave-1.43-ntp_background_images-std-size_t.patch
@@ -0,0 +1,32 @@
+diff --git a/brave/components/ntp_background_images/browser/view_counter_model.h b/brave/components/ntp_background_images/browser/view_counter_model.h
+index 940d8c4e47..13c0b9561c 100644
+--- a/brave/components/ntp_background_images/browser/view_counter_model.h
++++ b/brave/components/ntp_background_images/browser/view_counter_model.h
+@@ -23,10 +23,10 @@ class ViewCounterModel {
+
+ // Set each campaigns total image count.
+ void SetCampaignsTotalBrandedImageCount(
+- const std::vector<size_t>& campaigns_total_image_count);
++ const std::vector<std::size_t>& campaigns_total_image_count);
+
+ // Returns current campaign index and its bg index.
+- std::tuple<size_t, size_t> GetCurrentBrandedImageIndex() const;
++ std::tuple<std::size_t, std::size_t> GetCurrentBrandedImageIndex() const;
+
+ int current_wallpaper_image_index() const {
+ return current_wallpaper_image_index_;
+@@ -68,10 +68,10 @@ class ViewCounterModel {
+ int count_to_branded_wallpaper_ = 0;
+ bool always_show_branded_wallpaper_ = false;
+ bool show_branded_wallpaper_ = true;
+- size_t current_campaign_index_ = 0;
+- size_t total_campaign_count_ = 0;
+- std::vector<size_t> campaigns_total_branded_image_count_;
+- std::vector<size_t> campaigns_current_branded_image_index_;
++ std::size_t current_campaign_index_ = 0;
++ std::size_t total_campaign_count_ = 0;
++ std::vector<std::size_t> campaigns_total_branded_image_count_;
++ std::vector<std::size_t> campaigns_current_branded_image_index_;
+
+ // For NTP BI.
+ int current_wallpaper_image_index_ = 0;
diff --git a/brave-browser.desktop b/brave-browser.desktop
deleted file mode 100644
index 9a0f56020728..000000000000
--- a/brave-browser.desktop
+++ /dev/null
@@ -1,126 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Name=Brave
-# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
-# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
-GenericName=Web Browser
-GenericName[ar]=متصفح الشبكة
-GenericName[bg]=Уеб браузър
-GenericName[ca]=Navegador web
-GenericName[cs]=WWW prohlížeč
-GenericName[da]=Browser
-GenericName[de]=Web-Browser
-GenericName[el]=Περιηγητής ιστού
-GenericName[en_GB]=Web Browser
-GenericName[es]=Navegador web
-GenericName[et]=Veebibrauser
-GenericName[fi]=WWW-selain
-GenericName[fr]=Navigateur Web
-GenericName[gu]=વેબ બ્રાઉઝર
-GenericName[he]=דפדפן אינטרנט
-GenericName[hi]=वेब ब्राउज़र
-GenericName[hu]=Webböngésző
-GenericName[it]=Browser Web
-GenericName[ja]=ウェブブラウザ
-GenericName[kn]=ಜಾಲ ವೀಕ್ಷಕ
-GenericName[ko]=웹 브라우저
-GenericName[lt]=Žiniatinklio naršyklė
-GenericName[lv]=Tīmekļa pārlūks
-GenericName[ml]=വെബ് ബ്രൌസര്‍
-GenericName[mr]=वेब ब्राऊजर
-GenericName[nb]=Nettleser
-GenericName[nl]=Webbrowser
-GenericName[pl]=Przeglądarka WWW
-GenericName[pt]=Navegador Web
-GenericName[pt_BR]=Navegador da Internet
-GenericName[ro]=Navigator de Internet
-GenericName[ru]=Веб-браузер
-GenericName[sl]=Spletni brskalnik
-GenericName[sv]=Webbläsare
-GenericName[ta]=இணைய உலாவி
-GenericName[th]=เว็บเบราว์เซอร์
-GenericName[tr]=Web Tarayıcı
-GenericName[uk]=Навігатор Тенет
-GenericName[zh_CN]=网页浏览器
-GenericName[zh_HK]=網頁瀏覽器
-GenericName[zh_TW]=網頁瀏覽器
-# Not translated in KDE, from Epiphany 2.26.1-0ubuntu1.
-GenericName[bn]=ওয়েব ব্রাউজার
-GenericName[fil]=Web Browser
-GenericName[hr]=Web preglednik
-GenericName[id]=Browser Web
-GenericName[or]=ଓ୍ବେବ ବ୍ରାଉଜର
-GenericName[sk]=WWW prehliadač
-GenericName[sr]=Интернет прегледник
-GenericName[te]=మహాతల అన్వేషి
-GenericName[vi]=Bộ duyệt Web
-# Gnome and KDE 3 uses Comment.
-Comment=Access the Internet
-Comment[ar]=الدخول إلى الإنترنت
-Comment[bg]=Достъп до интернет
-Comment[bn]=ইন্টারনেটটি অ্যাক্সেস করুন
-Comment[ca]=Accedeix a Internet
-Comment[cs]=Přístup k internetu
-Comment[da]=Få adgang til internettet
-Comment[de]=Internetzugriff
-Comment[el]=Πρόσβαση στο Διαδίκτυο
-Comment[en_GB]=Access the Internet
-Comment[es]=Accede a Internet.
-Comment[et]=Pääs Internetti
-Comment[fi]=Käytä internetiä
-Comment[fil]=I-access ang Internet
-Comment[fr]=Accéder à Internet
-Comment[gu]=ઇંટરનેટ ઍક્સેસ કરો
-Comment[he]=גישה אל האינטרנט
-Comment[hi]=इंटरनेट तक पहुंच स्थापित करें
-Comment[hr]=Pristup Internetu
-Comment[hu]=Internetelérés
-Comment[id]=Akses Internet
-Comment[it]=Accesso a Internet
-Comment[ja]=インターネットにアクセス
-Comment[kn]=ಇಂಟರ್ನೆಟ್ ಅನ್ನು ಪ್ರವೇಶಿಸಿ
-Comment[ko]=인터넷 연결
-Comment[lt]=Interneto prieiga
-Comment[lv]=Piekļūt internetam
-Comment[ml]=ഇന്റര്‍‌നെറ്റ് ആക്‌സസ് ചെയ്യുക
-Comment[mr]=इंटरनेटमध्ये प्रवेश करा
-Comment[nb]=Gå til Internett
-Comment[nl]=Verbinding maken met internet
-Comment[or]=ଇଣ୍ଟର୍ନେଟ୍ ପ୍ରବେଶ କରନ୍ତୁ
-Comment[pl]=Skorzystaj z internetu
-Comment[pt]=Aceder à Internet
-Comment[pt_BR]=Acessar a internet
-Comment[ro]=Accesaţi Internetul
-Comment[ru]=Доступ в Интернет
-Comment[sk]=Prístup do siete Internet
-Comment[sl]=Dostop do interneta
-Comment[sr]=Приступите Интернету
-Comment[sv]=Gå ut på Internet
-Comment[ta]=இணையத்தை அணுகுதல்
-Comment[te]=ఇంటర్నెట్‌ను ఆక్సెస్ చెయ్యండి
-Comment[th]=เข้าถึงอินเทอร์เน็ต
-Comment[tr]=İnternet'e erişin
-Comment[uk]=Доступ до Інтернету
-Comment[vi]=Truy cập Internet
-Comment[zh_CN]=访问互联网
-Comment[zh_HK]=連線到網際網路
-Comment[zh_TW]=連線到網際網路
-StartupNotify=true
-StartupWMClass=brave-browser
-TryExec=brave
-Exec=brave %U
-Terminal=false
-Icon=brave
-Type=Application
-Categories=Network;WebBrowser;
-MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
-Actions=new-window;new-private-window;
-
-[Desktop Action new-window]
-Name=New Window
-Exec=brave
-
-[Desktop Action new-private-window]
-Name=New Incognito Window
-Exec=brave --incognito
-MimeType=x-scheme-handler/unknown;x-scheme-handler/about;text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
diff --git a/brave-launcher b/brave-launcher
deleted file mode 100644
index b576c9577668..000000000000
--- a/brave-launcher
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
-BRAVE_USE_FLASH_IF_AVAILABLE="${BRAVE_USE_FLASH_IF_AVAILABLE:-true}"
-
-# Allow users to override command-line options
-USER_FLAGS_FILE="$XDG_CONFIG_HOME/brave-flags.conf"
-if [[ -f $USER_FLAGS_FILE ]]; then
- USER_FLAGS="$(cat $USER_FLAGS_FILE | sed 's/#.*//')"
-fi
-
-[[
- ( -r $(echo /proc/config.*)
- && -z $(bsdcat /proc/config.* | grep CONFIG_USER_NS=y) )
- || ( -r /proc/sys/kernel/unprivileged_userns_clone
- && $(< /proc/sys/kernel/unprivileged_userns_clone) != 1 )
-]] && SANDBOX_FLAG="--no-sandbox" && echo "User namespaces are not detected as enabled on your system, Brave will run with the sandbox disabled"
-
-BRAVE_PEPPER_FLASH_SO=${BRAVE_PEPPER_FLASH_SO:-/usr/lib/PepperFlash/libpepflashplayer.so}
-if [[ -f $BRAVE_PEPPER_FLASH_SO && $BRAVE_USE_FLASH_IF_AVAILABLE == "true" ]]; then
- BRAVE_PEPPER_FLASH_VERSION=${BRAVE_PEPPER_FLASH_VERSION:-$(LANG=C pacman -Qi pepper-flash | grep Version | sed 's/.*: //; s/\-[^-]*$//')}
- PEPPER_FLASH_FLAG="--ppapi-flash-path=$BRAVE_PEPPER_FLASH_SO --ppapi-flash-version=$BRAVE_PEPPER_FLASH_VERSION"
-fi
-
-# OR true included because Brave currently segfaults when a second
-# window is opened from running the brave binary.
-# GH Issue: https://github.com/brave/brave-browser/issues/4142
-# NOTE: Replace with an exec call once we don't have to work around
-# this bug by having the browser be a subprocess of this script
-/usr/lib/brave/brave "$@" $SANDBOX_FLAG $PEPPER_FLASH_FLAG $USER_FLAGS || true
diff --git a/chromium-launcher-electron-app.patch b/chromium-launcher-electron-app.patch
new file mode 100644
index 000000000000..6346f3f5d146
--- /dev/null
+++ b/chromium-launcher-electron-app.patch
@@ -0,0 +1,81 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,7 @@
+ PREFIX = /usr/local
+
+ CHROMIUM_SUFFIX =
++CHROMIUM_APP = Chromium
+ CHROMIUM_NAME = chromium$(CHROMIUM_SUFFIX)
+ CHROMIUM_BINARY = /usr/lib/$(CHROMIUM_NAME)/$(CHROMIUM_NAME)
+ CHROMIUM_VENDOR = $(shell . /etc/os-release; echo $$NAME)
+@@ -9,6 +10,7 @@ override CFLAGS += $(shell pkg-config --
+ override LDLIBS += $(shell pkg-config --libs glib-2.0)
+ override CPPFLAGS += \
+ -DLAUNCHER_VERSION=\"$(shell git describe 2>/dev/null || echo v8)\" \
++ -DCHROMIUM_APP="\"$(CHROMIUM_APP)\"" \
+ -DCHROMIUM_NAME=\"$(CHROMIUM_NAME)\" \
+ -DCHROMIUM_BINARY=\"$(CHROMIUM_BINARY)\" \
+ -DCHROMIUM_VENDOR="\"$(CHROMIUM_VENDOR)\""
+@@ -17,9 +19,20 @@ ifeq ($(ENABLE_GCOV),1)
+ RUNTESTS_CFLAGS = -fprofile-arcs -ftest-coverage
+ endif
+
+-$(CHROMIUM_NAME): launcher.c
++ifneq ($(CHROMIUM_ARGS),)
++ , := ,
++ ARGS_FILE = args.h
++ override CPPFLAGS += -DCHROMIUM_ARGS
++endif
++
++$(CHROMIUM_NAME): launcher.c $(ARGS_FILE)
+ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS)
+
++$(ARGS_FILE):
++ echo "static char *default_system_flags[] = {" > $@
++ echo "$(addprefix \",$(addsuffix \"$(,),$(CHROMIUM_ARGS)))" >> $@
++ echo "NULL};" >> $@
++
+ runtests: launcher_test.c minunit.h launcher.c
+ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(RUNTESTS_CFLAGS) $(LDFLAGS) $< $(LDLIBS)
+
+@@ -38,4 +51,4 @@ uninstall:
+ clean:
+ $(RM) $(CHROMIUM_NAME) runtests *.o *.{gcda,gcno,gcov}
+
+-.PHONY: check install install-strip uninstall clean
++.PHONY: check install install-strip uninstall clean $(ARGS_FILE)
+--- a/launcher.c
++++ b/launcher.c
+@@ -5,6 +5,10 @@
+
+ #include <glib.h>
+
++#ifdef CHROMIUM_ARGS
++#include "args.h"
++#endif
++
+ static char *
+ #ifdef TESTING
+ real_default_system_flags_conf_path()
+@@ -66,7 +70,7 @@ static void show_help(const char *system
+ fprintf(
+ stderr,
+ "\n"
+- "Chromium launcher %s -- for Chromium help, see `man %s`\n"
++ CHROMIUM_APP " launcher %s -- for " CHROMIUM_APP " help, see `man %s`\n"
+ "\n"
+ "Custom flags are read in order from the following files:\n\n"
+ " %s\n %s\n\n"
+@@ -104,6 +108,12 @@ static int launcher(int argc, char const
+ free(user_flags_conf_path);
+
+ args = g_slist_append(args, g_strdup(CHROMIUM_BINARY));
++
++#ifdef CHROMIUM_ARGS
++ for (i = 0; default_system_flags[i] != NULL; i++)
++ args = g_slist_append(args, g_strdup(default_system_flags[i]));
++#endif
++
+ args = g_slist_concat(args, flags);
+
+ for (i = 1; i < argc; i++)
diff --git a/chromium-no-history.patch b/chromium-no-history.patch
deleted file mode 100644
index 5310ec3de25e..000000000000
--- a/chromium-no-history.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/scripts/init.js 2021-02-13 18:13:49.659921427 +0100
-+++ b/scripts/init.js 2021-02-14 00:04:32.098634830 +0100
-@@ -17,8 +17,7 @@
- if (!fs.existsSync(path.join(braveCoreDir, '.git'))) {
- Log.status(`Cloning brave-core [${braveCoreRef}] into ${braveCoreDir}...`)
- fs.mkdirSync(braveCoreDir)
-- util.runGit(braveCoreDir, ['clone', util.getNPMConfig(['projects', 'brave-core', 'repository', 'url']), '.'])
-- util.runGit(braveCoreDir, ['checkout', braveCoreRef])
-+ util.runGit(braveCoreDir, ['clone', '--depth=1', util.getNPMConfig(['projects', 'brave-core', 'repository', 'url']), '-b', braveCoreRef, '.'])
- }
-
- let npmCommand = 'npm'
diff --git a/rust-autocxx-use_sysroot.patch b/rust-autocxx-use_sysroot.patch
new file mode 100644
index 000000000000..a1b28b019745
--- /dev/null
+++ b/rust-autocxx-use_sysroot.patch
@@ -0,0 +1,18 @@
+diff --git a/third_party/rust/autocxx/chromium_integration/rust_autocxx.gni b/third_party/rust/autocxx/chromium_integration/rust_autocxx.gni
+index 51b4aaf63ca0..0585ab4fb814 100644
+--- a/third_party/rust/autocxx/chromium_integration/rust_autocxx.gni
++++ b/third_party/rust/autocxx/chromium_integration/rust_autocxx.gni
+@@ -183,10 +183,12 @@ template("rust_autocxx") {
+ "-nostdinc++",
+ "-isystem" + rebase_path(libcxx_prefix + "/include"),
+ "-isystem" + rebase_path(libcxxabi_prefix + "/include"),
+- "--sysroot=" + rebase_path(sysroot),
+ "-isystem" + rebase_path(
+ clang_base_path + "/lib/clang/" + clang_version + "/include"),
+ ]
++ if (use_sysroot) {
++ args += ["--sysroot=" + rebase_path(sysroot) ]
++ }
+ }
+
+ static_library(target_name) {
diff --git a/system-rust-utils.patch b/system-rust-utils.patch
new file mode 100644
index 000000000000..0f4dc32c38d3
--- /dev/null
+++ b/system-rust-utils.patch
@@ -0,0 +1,77 @@
+diff --git a/build/rust/run_cxxbridge.py b/build/rust/run_cxxbridge.py
+index 5aa1f56ec2..370c181a47 100644
+--- a/build/rust/run_cxxbridge.py
++++ b/build/rust/run_cxxbridge.py
+@@ -22,7 +22,8 @@ import subprocess
+
+ def run(cargo_path, args, output, is_header):
+ cargo_home = os.path.join(cargo_path, RUST_DEPS_PACKAGE_VERSION)
+- exe = os.path.abspath(os.path.join(cargo_home, 'bin', 'cxxbridge'))
++ # exe = os.path.abspath(os.path.join(cargo_home, 'bin', 'cxxbridge'))
++ exe = os.path.abspath(os.path.join('/usr', 'bin', 'cxxbridge'))
+
+ if sys.platform == "win32":
+ exe = exe + '.exe'
+diff --git a/script/cargo.py b/script/cargo.py
+index d7d872ef5b..6c550f56fc 100755
+--- a/script/cargo.py
++++ b/script/cargo.py
+@@ -23,7 +23,8 @@ def run_cargo(command, args):
+ env['RUSTUP_HOME'] = rustup_home
+ env['CARGO_HOME'] = rustup_home
+
+- rustup_bin = os.path.abspath(os.path.join(rustup_home, 'bin'))
++ # rustup_bin = os.path.abspath(os.path.join(rustup_home, 'bin'))
++ rustup_bin = os.path.abspath(os.path.join('/usr', 'bin'))
+ cargo_exe = os.path.join(rustup_bin, 'cargo')
+ if sys.platform == "win32":
+ cargo_exe += ".exe"
+diff --git a/script/cargo_cbindgen.py b/script/cargo_cbindgen.py
+index 97a69b6625..fdd05a43a5 100755
+--- a/script/cargo_cbindgen.py
++++ b/script/cargo_cbindgen.py
+@@ -22,7 +22,8 @@ def run(args):
+ cargo_home = os.path.join(args.cargo_path, RUST_DEPS_PACKAGE_VERSION)
+ env["CARGO_HOME"] = cargo_home
+
+- rustup_bin = os.path.abspath(os.path.join(rustup_home, "bin"))
++ # rustup_bin = os.path.abspath(os.path.join(rustup_home, "bin"))
++ rustup_bin = os.path.abspath(os.path.join("/usr", "bin"))
+ cbindgen_bin = os.path.join(
+ rustup_bin, "cbindgen" if sys.platform != "win32" else "cbindgen.exe"
+ )
+diff --git a/script/deps_config.py b/script/deps_config.py
+index 999ce5f74c..e463b24ff9 100755
+--- a/script/deps_config.py
++++ b/script/deps_config.py
+@@ -8,7 +8,7 @@ import os
+ # Version number and URL for pre-configured rust dependency package
+ # e.g. rust_deps_mac_0.1.0.gz
+ DEPS_PACKAGES_URL = "https://brave-build-deps-public.s3.brave.com"
+-RUST_DEPS_PACKAGE_VERSION = "1.0.0"
++RUST_DEPS_PACKAGE_VERSION = "" # "1.0.0"
+ MAC_TOOLCHAIN_ROOT = os.path.join(os.path.dirname(os.path.dirname(
+ os.path.dirname(__file__))),
+ 'build', 'mac_files')
+diff --git a/script/download_rust_deps.py b/script/download_rust_deps.py
+index 920f5f837a..655fb832f2 100755
+--- a/script/download_rust_deps.py
++++ b/script/download_rust_deps.py
+@@ -7,6 +7,7 @@
+
+ import argparse
+ import os
++import shutil
+ import subprocess
+ import sys
+
+@@ -207,7 +208,8 @@ def main():
+ }
+ ]
+ for tool in tools:
+- cargo_install(tool)
++ if shutil.which(tool["name"]) is None:
++ cargo_install(tool)
+
+ return 0
+