Table of Contents generated with DocToc
Basically follow these steps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools
export PATH=$PATH:`pwd`/depot_tools
mkdir chromium && cd chromium
fetch chromium
gclient sync
Mainly follow these instructions with one caveat.
I haven't found this documented anywhere, but when running the pre-commit hooks, chromium actually pulls and builds a specific clang version. It is important you use that when building, otherwise the build may (and did in my case) fail due to flags that your clang version doesn't understand.
So in order to build successfully do the following (assuming you are in ./chromium
root dir).
cd src
# prefer chromium's clang over the one in our path currently
export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH
export CC=clang; export CXX=clang++;
ninja -C out/Debug
This will build multiple targets, but not the actual Chromium.app.
Now we are ready to build the actual Chromium.app
ninja -C out/Debug chrome
Once that completes you should find a Chromium.app
file in out/Debug
which you can run via open ./Chromium.app
or via `./Chromium.app/Content
Multiple processes will be created as a result and you can attach a debugger to either in order to start debugging chromium.
In order to only build chrome
we can boil the build steps down to one
export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH
export CC=clang; export CXX=clang++;
ninja -C out/Debug chrome
I created a script that does this for
you. It assumes that this patches
project is a sibling of the src
folder created during fetch
.
Just source it to add the directories to your path: source patches/scripts/add-chromium-paths.sh
.
If you want to navigate/edit the code with Xcode you can create a hybrid build.
Basically do the following:
GYP_GENERATORS=ninja,xcode-ninja GYP_GENERATOR_FLAGS="xcode_ninja_main_gyp=src/build/ninja/all.ninja.gyp" gclient runhooks
ninja -t browse chrome
ninja -t targets
ninja -t commands chrome