Browse Source

Initial Commit

tags/74.0.3729.169-1
wchen342 2 years ago
commit
0a7cce9ea1
Signed by: wchen342 GPG Key ID: 720B70365E800508
9 changed files with 1543 additions and 0 deletions
  1. +37
    -0
      .gclient
  2. +55
    -0
      README.md
  3. +18
    -0
      android_flags.gn
  4. +153
    -0
      build.sh
  5. +1186
    -0
      download_file_types.pb.h
  6. +52
    -0
      patches/android-prune-domain-fix.patch
  7. +14
    -0
      patches/android-rlz-fix-missing-variable.patch
  8. +14
    -0
      patches/linker-android-support-remove.patch
  9. +14
    -0
      patches/ndk-native-window.patch

+ 37
- 0
.gclient View File

@ -0,0 +1,37 @@
solutions = [
{
"url": "https://chromium.googlesource.com/chromium/src.git",
"managed": False,
"name": "src",
"custom_deps": {
"src/chrome/browser/resources/media_router/extension/src": None,
"src/chrome/test/data/perf/canvas_bench": None,
"src/chrome/test/data/perf/frame_rate/content": None,
"src/chrome/test/data/xr/webvr_info": None,
"src/chrome/test/data/xr/webxr_samples": None,
"src/media/cdm/api": None,
"src/third_party/arcore-android-sdk/src": None,
"src/third_party/depot_tools": None,
"src/third_party/feed/src": None,
"src/third_party/shaderc/src": None,
"src/third_party/SPIRV-Tools/src": None,
"src/third_party/swiftshader": None,
"src/third_party/ub-uiautomator/lib": None,
"src/third_party/visualmetrics/src": None,
"src/third_party/webdriver/pylib": None,
"src/third_party/webgl/src": None,
"src/third_party/webrtc": None,
"src/third_party/yasm/source/patched-yasm": None,
"src/tools/gyp": None,
"src/tools/luci-go": None,
"src/tools/page_cycler/acid3": None,
"src/tools/swarming_client": None,
},
"custom_vars": {
"checkout_nacl": False,
},
},
]
target_os = ["android"]
target_os_only = "true"

+ 55
- 0
README.md View File

@ -0,0 +1,55 @@
# ungoogled-chromium-android
*A lightweight approach to removing Google web service dependency*
*Note: this is an **Android** build. It is currently experimental.*
**ungoogled-chromium is Google Chromium**, sans dependency on Google web services. It also features some tweaks to enhance privacy, control, and transparency *(almost all of which require manual activation or enabling)*.
**ungoogled-chromium retains the default Chromium experience as closely as possible**. Unlike other Chromium forks that have their own visions of a web browser, ungoogled-chromium is essentially a drop-in replacement for Chromium.
For more information on `ungoogled-chromium`, please visit the original repo: [Eloston/ungoogled-chromium](https://github.com/Eloston/ungoogled-chromium).
## Differences from ungoogled-chromium
*These are the differences between a Linux build of ungoogled-chromium and this Android build.*
* Several binaries are not pruned due to build time error.
* Default configuration build for `arm64` instead of `x64`.
## Supported Platforms and Distributions
The current build has been tested on:
* cpu_arch: `x86`, `arm64`
* Android: API 28 (Android 8.1), API 27 (Android 8.0), LineageOS 15.1
*This build requires a minimum API 24 (Nougat).*
## Building Instructions
*This build is built from Sylvain Beucler's [libre Android rebuilds](http://android-rebuilds.beuc.net/) instead of SDK/NDK binaries from Google.*
Clone this repository and run `build.sh`. Build time dependencies can be rougnly referred from [AUR](https://aur.archlinux.org/packages/ungoogled-chromium-archlinux/).
For a more customized building process, see building instructions from [the original repo](https://github.com/Eloston/ungoogled-chromium/blob/master/docs/building.md).
## TODO List
- [ ] Prune the binaries
- [ ] Remove dependencies on SDK tools and extras
- [ ] Remove Play Services dependencies
- [ ] Domain substitution in java files
- [ ] Java patches (mostly UI-related)
## Credits
* [The Chromium Project](//www.chromium.org/)
* [ungoogled-chromium](//github.com/Eloston/ungoogled-chromium)
* [xsmile's fork](//github.com/xsmile/ungoogled-chromium/tree/android)
* [Bromite](//github.com/bromite/bromite)
## Related Projects
* [Bromite](//github.com/bromite/bromite) (Another build for Android. Has some own features.)
## License
See [LICENSE](LICENSE)

+ 18
- 0
android_flags.gn View File

@ -0,0 +1,18 @@
android_channel="stable"
android32_ndk_api_level=21
android64_ndk_api_level=21
clang_base_path="/usr"
android_ndk_root = "//../android-ndk/android-ndk-r18b"
android_ndk_version = "r18b"
android_ndk_major_version = 18
disable_android_lint=true
enable_gvr_services=false
enable_resource_whitelist_generation=false
ffmpeg_branding="Chrome"
is_clang=true
is_component_build=false
target_os="android"
target_cpu="arm64"
use_jumbo_build=true
use_lld=true
use_sysroot=false

+ 153
- 0
build.sh View File

@ -0,0 +1,153 @@
#!/usr/bin/env bash
set -eux -o pipefail
chromium_version=74.0.3729.169
# Required tools: python2, python3, ninja, git, clang, lld, llvm, curl
# Assuming default python to be python2. This is true on most Linux distributions.
## Clone ungoogled-chromium repo
git clone https://github.com/Eloston/ungoogled-chromium.git -b $chromium_version-1
## Clone chromium repo
git clone --depth 1 --no-tags https://chromium.googlesource.com/chromium/src.git -b $chromium_version
## Fetch depot-tools
depot_tools_commit=$(grep 'depot_tools.git' src/DEPS | cut -d\' -f8)
mkdir -p depot_tools
pushd depot_tools
git init
git remote add origin https://chromium.googlesource.com/chromium/tools/depot_tools.git
git fetch --depth 1 --no-tags origin $depot_tools_commit
git reset --hard FETCH_HEAD
popd
export PATH="$(pwd -P)/depot_tools:$PATH"
## Sync files
## need .gclient under same folder
gclient.py sync --nohooks --no-history --shallow --revision=$chromium_version
## Fix repos
feed_commit=$(grep "'feed_revision':" src/DEPS | cut -d\' -f4)
mkdir src/third_party/feed/src
pushd src/third_party/feed/src
git init
git remote add origin https://chromium.googlesource.com/feed
git fetch --depth 1 --no-tags origin $feed_commit
git reset --hard FETCH_HEAD
popd
webrtc_commit=$(grep 'webrtc_git.*/src\.git' src/DEPS | cut -d\' -f8)
mkdir src/third_party/webrtc
pushd src/third_party/webrtc
git init
git remote add origin https://webrtc.googlesource.com/src.git
git fetch --depth 1 --no-tags origin $webrtc_commit
git reset --hard FETCH_HEAD
popd
libsync_commit=$(grep 'libsync\.git' src/DEPS | cut -d\' -f10)
mkdir src/third_party/libsync/src
pushd src/third_party/libsync/src
git init
git remote add origin https://chromium.googlesource.com/aosp/platform/system/core/libsync.git
git fetch --depth 1 --no-tags origin $libsync_commit
git reset --hard FETCH_HEAD
popd
GN_COMMIT=9bd94208ec741659d5126b990fdccd35a5c30b1f
mv src/tools/gn src/tools/gn.bak
git clone https://gn.googlesource.com/gn src/tools/gn
pushd src/tools/gn
git checkout $GN_COMMIT
popd
cp -r src/tools/gn.bak/bootstrap src/tools/gn
## Hooks
python src/build/util/lastchange.py -o src/build/util/LASTCHANGE
python src/chrome/android/profiles/update_afdo_profile.py
python src/build/util/lastchange.py -m GPU_LISTS_VERSION --revision-id-only --header src/gpu/config/gpu_lists_version.h
python src/build/util/lastchange.py -m SKIA_COMMIT_HASH -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h
## Run ungoogled-chromium scripts
# Patch prune list and domain substitution
# TODO some pruned binaries are excluded since they will cause android build to fail
patch -p1 --ignore-whitespace -i patches/android-prune-domain-fix.patch --no-backup-if-mismatch
# Remove the cache file if exists
cache_file=domsubcache.tar.gz
if [ -f ${cache_file} ] ; then
rm $cache_file
fi
# Ignore the pruning error
python3 ungoogled-chromium/utils/prune_binaries.py src ungoogled-chromium/pruning.list || true
python3 ungoogled-chromium/utils/patches.py apply src ungoogled-chromium/patches
python3 ungoogled-chromium/utils/domain_substitution.py apply -r ungoogled-chromium/domain_regex.list -f ungoogled-chromium/domain_substitution.list -c cache_file src
## Extra fixes for Chromium source
## Fix an error in chrome/browser/android/rlz/rlz_ping_handler.cc: line 79, -rlz_lib::kFinancialServer +"about:blank"
patch -p1 --ignore-whitespace -i patches/android-rlz-fix-missing-variable.patch --no-backup-if-mismatch
## Workaround for a building failure caused by safe browsing. The file is pre-generated with safe_browsing_mode=2. See https://github.com/nikolowry/bromite-builder/issues/1
# x86
mkdir -p out/Default/gen/chrome/common/safe_browsing
cp ../download_file_types.pb.h out/Default/gen/chrome/common/safe_browsing
# arm/arm64
cp ../download_file_types.pb.h chrome/common/safe_browsing/download_file_types.pb.h
## Set compiler flags
export AR=${AR:=llvm-ar}
export NM=${NM:=llvm-nm}
export CC=${CC:=clang}
export CXX=${CXX:=clang++}
## Genarate gn file
pushd src/tools/gn
build/gen.py
ninja -C out gn
popd
## Prepare Android SDK/NDK
## This is Sylvain Beucler's libre Android rebuild
sdk_link="https://android-rebuilds.beuc.net/dl/android-sdk_user.9.0.0_r21_linux-x86.zip"
ndk_link="https://android-rebuilds.beuc.net/dl/android-ndk-r18b-linux-x86_64.tar.bz2"
mkdir android-rebuilds
mkdir android-sdk
mkdir android-ndk
cd android-rebuilds && { curl -O $sdk_link ; curl -O $ndk_link ; cd -; }
unzip -qqo android-rebuilds/android-sdk_user.9.0.0_r21_linux-x86.zip -d android-sdk
tar xjf android-rebuilds/android-ndk-r18b-linux-x86_64.tar.bz2 -C android-ndk
# remove data_space.h, patch native_window.h
mv android-ndk/android-ndk-r18b/sysroot/usr/include/android/data_space.h android-ndk/android-ndk-r18b/sysroot/usr/include/android/data_space.h.bak
patch -p1 --ignore-whitespace -i patches/ndk-native-window.patch --no-backup-if-mismatch
# Create symbol links to sdk folders
# The rebuilt sdk has a different folder structure from the checked out version, so it is easier to create symbol links
# Currently extras and tools are not available from the rebuild
pushd src/third_party/android_tools/sdk
rm -rf add-ons emulator licenses platforms sources tools-lint build-tools ndk-bundle platform-tools
mkdir build-tools
ln -s ../../../../../android-sdk/android-sdk_user.9.0.0_r21_linux-x86/build-tools/android-9 build-tools/27.0.3
mkdir platforms
ln -s ../../../../../android-sdk/android-sdk_user.9.0.0_r21_linux-x86/platforms/android-9 platforms/android-28
ln -s ../../../../android-sdk/android-sdk_user.9.0.0_r21_linux-x86/platform-tools platform-tools
popd
## Configure output folder
## patch build/config/android/BUILD.gn
patch -p1 --ignore-whitespace -i patches/linker-android-support-remove.patch --no-backup-if-mismatch
cd src
mkdir -p out/Default
cat ../ungoogled-chromium/flags.gn ../android_flags.gn > out/Default/args.gn
tools/gn/out/gn gen out/Default --fail-on-unused-args
## Build
ninja -C out/Default monochrome_public_apk

+ 1186
- 0
download_file_types.pb.h
File diff suppressed because it is too large
View File


+ 52
- 0
patches/android-prune-domain-fix.patch View File

@ -0,0 +1,52 @@
description: remove some prune and fix a domain regex expression
author: Wengling Chen <[email protected]>
--- a/ungoogled-chromium/domain_regex.list
+++ b/ungoogled-chromium/domain_regex.list
@@ -16,5 +16,5 @@
ggpht(\\*?)\.com#99pht\g<1>.qjz9zk
microsoft(\\*?)\.com#m1cr050ft\g<1>.qjz9zk
1e100(\\*?)\.net#l3lOO\g<1>.qjz9zk
-android(\\*?)\.com#8n6r01d\g<1>.qjz9zk
+(?<!http://schemas.)android(\\*?)\.com#8n6r01d\g<1>.qjz9zk
goo\.gl#goo.gl.qjz9zk
--- a/ungoogled-chromium/pruning.list
+++ b/ungoogled-chromium/pruning.list
@@ -12,11 +12,9 @@ base/test/data/file_version_info_unittest/FileVersionInfoTest2.dll
base/test/data/pe_image/pe_image_test_32.dll
base/test/data/pe_image/pe_image_test_64.dll
build/android/CheckInstallApk-debug.apk
-build/android/chromium-debug.keystore
build/android/tests/symbolize/liba.so
build/android/tests/symbolize/libb.so
build/linux/sysroot_scripts/debian-archive-sid-stable.gpg
-buildtools/third_party/eu-strip/bin/eu-strip
chrome/browser/chromeos/power/ml/smart_dim/example_preprocessor_config.pb
chrome/browser/chromeos/power/ml/smart_dim/lite_example_preprocessor_config.pb
chrome/browser/resources/chromeos/assistant_optin/voice_laptop_1x.webm
@@ -3068,7 +3066,6 @@ third_party/angle/third_party/glmark2/src/data/models/cat.3ds
third_party/angle/third_party/glmark2/src/data/models/cube.3ds
third_party/angle/third_party/glmark2/src/data/models/horse.3ds
third_party/angle/third_party/vulkan-loader/src/loader/loader.aps
-third_party/bazel/desugar/Desugar-runtime.jar
third_party/blink/manual_tests/WebKitSite.webarchive
third_party/blink/manual_tests/accessibility/resources/AppletTest.class
third_party/blink/manual_tests/plugins/test.swf
@@ -7763,7 +7760,6 @@ third_party/chromite/lib/datafiles/arch.sparc.elf
third_party/chromite/lib/datafiles/arch.sparc64.elf
third_party/chromite/lib/datafiles/arch.x32.elf
third_party/chromite/lib/datafiles/arch.x86_64.elf
-third_party/closure_compiler/compiler/compiler.jar
third_party/crashpad/crashpad/handler/win/z7_test.dll
third_party/crashpad/crashpad/snapshot/elf/elf_image_reader_fuzzer_corpus/crashpad_snapshot_test_both_dt_hash_styles.so
third_party/crashpad/crashpad/snapshot/elf/elf_image_reader_fuzzer_corpus/ret42
@@ -12796,7 +12792,6 @@ third_party/hunspell/fuzz/bdict_corpus/en-US-7-1.bdic
third_party/hunspell/fuzz/bdict_corpus/en-US-8-0.bdic
third_party/hunspell/fuzz/bdict_corpus/f95048cdc0fc231dd712bad106578a9eeecd869b
third_party/hunspell/fuzz/bdict_corpus/fda69541054125551c41ab3e591e0482405ca2dc
-third_party/icu/android/icudtl.dat
third_party/icu/cast/icudtl.dat
third_party/icu/common/icudtb.dat
third_party/icu/flutter/icudtl.dat

+ 14
- 0
patches/android-rlz-fix-missing-variable.patch View File

@ -0,0 +1,14 @@
description: fix a missing variable
author: Wengling Chen <[email protected]>
--- a/src/chrome/browser/android/rlz/rlz_ping_handler.cc
+++ b/src/chrome/browser/android/rlz/rlz_ping_handler.cc
@@ -76,7 +76,7 @@ void RlzPingHandler::Ping(
DCHECK_EQ(id.length(), 50u);
GURL request_url(base::StringPrintf(
- "https://%s%s?", rlz_lib::kFinancialServer, rlz_lib::kFinancialPingPath));
+ "https://%s%s?", "about:blank", rlz_lib::kFinancialPingPath));
request_url = net::AppendQueryParameter(
request_url, rlz_lib::kProductSignatureCgiVariable, "chrome");
request_url =

+ 14
- 0
patches/linker-android-support-remove.patch View File

@ -0,0 +1,14 @@
description: remove linker flag -landroid_support. We build MonoChrome targets API 24+, which won't need support library anyway
author: Wengling Chen <[email protected]>
--- a/src/build/config/android/BUILD.gn
+++ b/src/build/config/android/BUILD.gn
@@ -117,7 +117,7 @@
lib_dirs = [ android_libcpp_lib_dir ]
libs = []
- libs += [ "android_support" ]
+ # libs += [ "android_support" ]
# arm builds of libc++ starting in NDK r12 depend on unwind.
if (current_cpu == "arm") {

+ 14
- 0
patches/ndk-native-window.patch View File

@ -0,0 +1,14 @@
description: remove reference to data_space.h due to a ENUM redefined error
author: Wengling Chen <[email protected]>
--- a/android-ndk/android-ndk-r18b/sysroot/usr/include/android/native_window.h
+++ b/android-ndk/android-ndk-r18b/sysroot/usr/include/android/native_window.h
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
-#include <android/data_space.h>
+//#include <android/data_space.h>
#include <android/hardware_buffer.h>
#include <android/rect.h>

Loading…
Cancel
Save