-
-
Notifications
You must be signed in to change notification settings - Fork 17
Building
Build steps are almost the same as the original Chromium's one except for compatibility patches.
- macOS 12.0 SDK
- to build for 10.7, need patch for SDK: NSArray.h and NSDictionary.h
- Xcode 12.2+
- to build for 10.7, need patched clang
- powerful CPUs
- about 40mins to distributed build from scratch with
Ryzen 9 5950X
+ 2 xRyzen 9 3950X
- about 3-4hrs+ to build from scratch with
Core i9-9980HK
- about 40mins to distributed build from scratch with
curl https://gist.githubusercontent.com/blueboxd/c1f355fb6fe829e98ff5453880683993/raw/8bf1238a75742d3ef447feaae6e317f53c49f33d/build.sh | bash
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/9f3a02743c9f257eb2f7dc15c73c28efa92ff70d/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 third_party/skia
git checkout origin/master -- .
cd ../../
gclient sync -D
cd third_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
In addition to the above, Wowfunhappy had to perform the following in order to build Chromium Legacy in March of 2022, in a VM running macOS 11.6.4 and Xcode 13.1.2.
Open MacOSX12.1.sdk/System/Library/Frameworks/GameController.framework/Versions/A/Headers/GCDevice.h
, and replace:
@property (nonatomic, strong) dispatch_queue_t handlerQueue API_AVAILABLE(macos(10.9), ios(7.0), tvos(7.0));
with
@property (nonatomic, assign) dispatch_queue_t handlerQueue API_AVAILABLE(macos(10.9), ios(7.0), tvos(7.0));
Add the following line to build.args
:
use_thin_lto = false
This is believed to be needed due to https://github.com/chromium/chromium/commit/f64f23b09bdb88b02241c538ec9c82847e549fdf. Chromium Legacy must be built with ld
, not the new lld
. However, ThinLTO cannot be used with lld
.
Open build/config/compiler/BUILD.gn
, and add the following directly under defines += [ "_LIBCPP_HAS_NO_ALIGNED_ALLOCATION" ]
cflags_cc += [ "-stdlib=libc++" ]
ldflags += [ "-stdlib=libc++" ]
This is needed due to https://github.com/chromium/chromium/commit/672ec2f02b3a51914ed2cef995210eb482d74654
Copy chrome-mac-main-*.profdata
from
chromium-legacy/src/chrome/build/pgo_profiles
to
chromium-legacy/src/build/config/src/chrome/build/pgo_profiles
Wowfunhappy has no idea why this was necessary.