Skip to content
blueboxd edited this page Aug 19, 2021 · 17 revisions

Build steps are almost the same as the original Chromium's one except for compatibility patches.

prerequisites

  • macOS 11.1 SDK
  • Xcode 12.2+
  • powerful CPUs
    • about 40mins to distributed build from scratch with Ryzen 9 5950X + 2 x Ryzen 9 3950X
    • about 3-4hrs+ to build from scratch with Core i9-9980HK

TL;DR

curl https://gist.githubusercontent.com/blueboxd/c1f355fb6fe829e98ff5453880683993/raw/778b1cf7aef1c7679389947b2c6d69e751f1344d/build.sh | bash

steps

first setup & build:

# setup working dir
mkdir -pv chromium-project && cd chromium-project

# prepare patched clang
mkdir -pv clang-master && pushd clang-master
curl -LOJ https://github.com/blueboxd/llvm-project/releases/download/main/main.tar.xz
tar xvf main.tar.xz
popd

# setup depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git && export PATH=`pwd`/depot_tools:"$PATH"

# setup project dir
mkdir -pv chromium-legacy && cd chromium-legacy
# place this repo as src
curl -OJ https://gist.githubusercontent.com/blueboxd/c1f355fb6fe829e98ff5453880683993/raw/97a23ba80d28005f6072053920d979be87213193/.gclient

# checkout sources & dependencies
gclient sync -v --no-history

# setup patched skia
pushd src/third_party/skia
git remote add for-lion https://github.com/blueboxd/skia.git
git fetch for-lion && git checkout for-lion && git checkout for-lion -- .
popd

# setup patch for v8
pushd src/v8/src
curl -OJ https://gist.githubusercontent.com/blueboxd/c1f355fb6fe829e98ff5453880683993/raw/97a23ba80d28005f6072053920d979be87213193/sp_mut.cc
cd ../
cat BUILD.gn | sed -e 's#"src/wasm/wasm-code-manager.h",#"src/wasm/wasm-code-manager.h",\'$'\n    "src/sp_mut.cc",#g' > BUILD.gn.tmp && mv -fv BUILD.gn.tmp BUILD.gn
popd

# setup patch for libANGLE
pushd src/third_party/angle/src/libANGLE/renderer/
curl -OJ https://gist.githubusercontent.com/blueboxd/c1f355fb6fe829e98ff5453880683993/raw/65ba4558a17eb47feb38729a87b8d8976d5bb8ad/driver_utils_mac.mm
cd metal
cat BUILD.gn| sed -e 's#"QuartzCore.framework",#"QuartzCore.framework",\'$'\n        "CoreServices.framework",#g'  > BUILD.gn.tmp && mv -fv BUILD.gn.tmp BUILD.gn
popd

# setup out dir
mkdir -pv out/release
pushd out/release
# setup args.gn with basic parameters
curl -OJ https://gist.githubusercontent.com/blueboxd/c1f355fb6fe829e98ff5453880683993/raw/d93b7f8aad3e79cdf1f751cc744ab34895de3d35/args.gn
popd

# use patched clang
pushd ../clang-master
echo "clang_base_path=\"`pwd`\"" >> ../chromium-legacy/out/release/args.gn
popd

# generate build files
cd src
gn gen ../out/release

# build
time ninja -C ../out/release chrome

# now your build is ready
open -R ../out/release/Chromium.app

to update src:

cd chromium-project/chromium-legacy/src
git pull
cd thrid_party/skia
git checkout origin/master -- .
cd ../../
gclient sync -D
cd thrid_party/skia
git fetch for-lion && git checkout for-lion && git checkout for-lion -- .

to build:

cd chromium-project/chromium-legacy/src
ninja -C ../out/release chrome
Clone this wiki locally