diff --git a/.gitignore b/.gitignore index ce24e63b7eb0ade1cb7f3881e72486b7321d452b..84c0539c99ad108c2794c8c8dbf336752de5e95e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ src/ apks/ +bin/ _gclient_src*/ .ccache/ .cipd/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4fc43f0292280725a604a5cd302e0f1161746437..6b53b4e4bf431a431932beccc654ed8aec0dd11a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,7 @@ build-docker: name: "$CI_JOB_NAME" paths: - apks/* + - bin/* build-cromite-arm: stage: build diff --git a/Dockerfile b/Dockerfile index 4aeec0c761ad4e53105de1ca41092867e2817bab..c3ffed22e6a22034df3886f4cd35fd23f099b5b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:20.04 ENV CHROMIUM_DIR "/srv/chromium" -ENV CHROMIUM_VER "127.0.6533.103" +ENV CHROMIUM_VER "127.0.6533.106" RUN dpkg --add-architecture i386 diff --git a/build.sh b/build.sh index 4a8f8c3669d904cf56ecd5a8417fe8a62ad96e43..c4fa1abcdedc9497cf5ff0528f07783802e37c4f 100755 --- a/build.sh +++ b/build.sh @@ -99,6 +99,18 @@ build() { echo ">> [$(date)] Creating archive with debug apks" archive_name="${root_dir}/apks/${apk_arch}/browser_${apk_arch}_debug_apks.7z" 7z a -t7z -mx=9 "$archive_name" "out/${1}/apks"/*.apk + + if [ $1 '==' "x64" ]; then + echo ">> [$(date)] Building chromium subresource_filter_tools" + mkdir -p "${root_dir}/bin" + build_args=$(cat "${root_dir}"/build/filters.gn_args) + build_args+=' cc_wrapper="ccache"' + gn gen out/${1} --args="$build_args" + autoninja -C out/${1} subresource_filter_tools + if [ -f "out/${1}/ruleset_converter" ]; then + cp -r out/${1}/ruleset_converter ${root_dir}/bin/ruleset_converter + fi + fi } setup_ccache() { @@ -192,7 +204,7 @@ sync() { } gclient_config() { - cat < "$chromium_dir/.gclient" + cat <"$chromium_dir/.gclient" solutions = [{ "url": "$chromium_url@$chromium_commit_hash", "managed": False, @@ -205,7 +217,7 @@ target_os = ["android"] EOF } -init_repo(){ +init_repo() { echo ">> [$(date)] Init chromium $chromium_version" cd $chromium_dir rm -rf .gclient* @@ -221,7 +233,7 @@ while getopts ":a:cur:shp" opt; do a) arch="$OPTARG" ;; c) clean=1 ;; u) usage ;; - s) gsync=1 ;; + s) gsync=1 ;; h) history=0 ;; p) patchonly=1 ;; :) @@ -263,9 +275,9 @@ if [ $gsync -eq 1 ]; then cd $chromium_dir/src # Check if a rebase is in progress if [ -d "$(git rev-parse --git-dir)/rebase-apply" ] || [ -d "$(git rev-parse --git-dir)/rebase-merge" ]; then - git am --skip 2>/dev/null || true - git rebase --abort 2>/dev/null || true - echo ">> [$(date)] Rebase aborted." + git am --skip 2>/dev/null || true + git rebase --abort 2>/dev/null || true + echo ">> [$(date)] Rebase aborted." fi find ".git" -name "*.lock" -delete if [ ! -z $(find .git -name "*.lock") ]; then diff --git a/build/e_patches/0001-Browser-Change-adblock-url-to-ours.patch b/build/e_patches/0001-Browser-Change-adblock-url-to-ours.patch new file mode 100644 index 0000000000000000000000000000000000000000..28564aac84d1cf5219c1ddc681740e7036ef1f3e --- /dev/null +++ b/build/e_patches/0001-Browser-Change-adblock-url-to-ours.patch @@ -0,0 +1,85 @@ +From 9a9eda608ee4cf68f82f5d8060b4df134efa34fc Mon Sep 17 00:00:00 2001 +From: althafvly +Date: Tue, 10 Sep 2024 12:17:23 +0530 +Subject: [PATCH] Browser: Change adblock url to ours + +--- + chrome/android/java/res/values/values.xml | 2 +- + .../chromium/chrome/browser/settings/AdBlockEditor.java | 8 ++++++++ + chrome/browser/browser_process_impl.cc | 9 ++++++++- + chrome/browser/net/system_network_context_manager.cc | 2 +- + 4 files changed, 18 insertions(+), 3 deletions(-) + +diff --git a/chrome/android/java/res/values/values.xml b/chrome/android/java/res/values/values.xml +index 3b318d09034f4..09f051950404c 100644 +--- a/chrome/android/java/res/values/values.xml ++++ b/chrome/android/java/res/values/values.xml +@@ -24,7 +24,7 @@ found in the LICENSE file. + + Autoupdate enabled + Autoupdate disabled +- https://www.bromite.org/custom-filters ++ https://doc.e.foundation/browser-custom-filters + + Proxy configuration + chrome://proxy +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java +index ef6d1652c97f0..24cd56084827d 100644 +--- a/chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java +@@ -37,6 +37,14 @@ public class AdBlockEditor extends Fragment implements TextWatcher { + View scrollView = v.findViewById(R.id.scroll_view); + scrollView.getViewTreeObserver().addOnScrollChangedListener( + SettingsUtils.getShowShadowOnScrollListener(v, v.findViewById(R.id.shadow))); ++ ++ String defaultBromiteURL = "https://www.bromite.org/filters/filters.dat"; ++ if (defaultBromiteURL.equals(AdBlockNativeGateway.getAdBlockFiltersURL())) { ++ String newFiltersURL = "https://images.ecloud.global/apps/browser/filters.dat"; ++ AdBlockNativeGateway.setAdBlockFiltersURL( ++ UrlFormatter.fixupUrl(newFiltersURL).getSpec()); ++ } ++ + mAdBlockFiltersUrlEdit = (EditText) v.findViewById(R.id.adblock_url_edit); + mAdBlockFiltersUrlEdit.setText(AdBlockNativeGateway.getAdBlockFiltersURL()); + mAdBlockFiltersUrlEdit.addTextChangedListener(this); +diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc +index 74c5396245c07..fdbd35e786d0b 100644 +--- a/chrome/browser/browser_process_impl.cc ++++ b/chrome/browser/browser_process_impl.cc +@@ -1208,12 +1208,19 @@ BrowserProcessImpl::adblock_updater() { + std::unique_ptr scheduler = + std::make_unique(); + ++ std::string filters_url = local_state()->GetString(prefs::kAdBlockFiltersURL); ++ ++ // Check if the current URL is Bromite filters URL. If so, use the new URL ++ if (!filters_url.empty() && filters_url == "https://www.bromite.org/filters/filters.dat") { ++ filters_url = "https://images.ecloud.global/apps/browser/filters.dat"; ++ } ++ + adblock_updater_ = std::make_unique( + g_browser_process->system_network_context_manager()->GetSharedURLLoaderFactory(), + std::move(scheduler), + g_browser_process->subresource_filter_ruleset_service(), + local_state()->GetBoolean(prefs::kAdBlockEnabled), +- local_state()->GetString(prefs::kAdBlockFiltersURL)); ++ filters_url); + + return adblock_updater_.get(); + } +diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc +index 5aa4ba0c2dbc6..1232086093038 100644 +--- a/chrome/browser/net/system_network_context_manager.cc ++++ b/chrome/browser/net/system_network_context_manager.cc +@@ -647,7 +647,7 @@ void SystemNetworkContextManager::RegisterPrefs(PrefRegistrySimple* registry) { + + registry->RegisterBooleanPref(prefs::kAdBlockEnabled, false); + registry->RegisterStringPref(prefs::kAdBlockFiltersURL, +- "https://www.bromite.org/filters/filters.dat"); ++ "https://images.ecloud.global/apps/browser/filters.dat"); + + // Static auth params + registry->RegisterStringPref(prefs::kAuthSchemes, +-- +2.34.1 + diff --git a/build/e_patches_list.txt b/build/e_patches_list.txt index 8958172e2a4a7181ed40c4e0427d55e6147d38ea..1c11d330f0579dd2173f13f276c1592e6c2e5985 100644 --- a/build/e_patches_list.txt +++ b/build/e_patches_list.txt @@ -52,3 +52,4 @@ 0052-Browser-Hide-settings-when-parental-control-is-activ.patch 0053-Browser-Use-correct-switch-scale.patch +0001-Browser-Change-adblock-url-to-ours.patch diff --git a/build/filters.gn_args b/build/filters.gn_args new file mode 100644 index 0000000000000000000000000000000000000000..3313db3d2892deaff87b81f33ac75b35fb515331 --- /dev/null +++ b/build/filters.gn_args @@ -0,0 +1,7 @@ +target_cpu="x64" +target_os="linux" +enable_nacl=false +is_component_build=false +is_debug=false +blink_symbol_level=0 +enable_reporting=false diff --git a/build_subresource_filter_tools.sh b/build_subresource_filter_tools.sh new file mode 100755 index 0000000000000000000000000000000000000000..a33067a8e4772629eef04a1e439d4dbbeadbba89 --- /dev/null +++ b/build_subresource_filter_tools.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +chromium_dir="${CHROMIUM_DIR}" +root_dir=$(dirname "$(readlink -f "$0")") +if [ ! -d "$chromium_dir" ]; then + chromium_dir=$root_dir +fi + +build() { + echo ">> [$(date)] Building chromium subresource_filter_tools" + mkdir -p "${root_dir}/bin" + build_args=$(cat "${root_dir}"/build/filters.gn_args) + build_args+=' cc_wrapper="ccache"' + gn gen out/x64 --args="$build_args" + autoninja -C out/x64 subresource_filter_tools + if [ -f "out/x64/ruleset_converter" ]; then + cp -r out/x64/ruleset_converter ${root_dir}/bin/ruleset_converter + fi +} + +setup_ccache() { + echo ">> [$(date)] Settings up ccache" + export USE_CCACHE=1 + export CCACHE_EXEC=$(command -v ccache) + export PATH=$chromium_dir/src/third_party/llvm-build/Release+Asserts/bin:$PATH + export CCACHE_CPP2=yes + export CCACHE_SLOPPINESS=time_macros + export CCACHE_DIR=$chromium_dir/.ccache + ccache -M 200G +} + +export PATH="$chromium_dir/depot_tools:$PATH" + +cd $chromium_dir/src +. build/android/envsetup.sh +setup_ccache +build