Skip to content

setting up chromium build env on mac

joelrbrandt edited this page May 28, 2012 · 3 revisions

Here we go.

1. Download the source 'bootstrapping' tarball

This is the fast way to get most of the code. then you'll update what's in the tarball using gclient/svn). It can be found here (look for the link that says "download the source tarball"): http://dev.chromium.org/developers/how-tos/get-the-code

2. Install Xcode 4.3 from app store

The above tarball is going to take a long time to download. So, install yourself a new version of xcode in the meantime.

3. Install depot tools

git clone https://git.chromium.org/chromium/tools/depot_tools.git

4. Install ninja (like 'make', but faster apparently):

git clone git://github.com/martine/ninja.git
cd ninja/
./bootstrap.py 
./ninja -h

5. Add depot tools and ninja to path

For a long-term solution, edit ~/.bash_profile with something like:

export PATH="$PATH":/Users/jbrandt/development/depot_tools:/Users/jbrandt/development/ninja

Or, just do that at the command line in the terminal you plan to use.

6. untar the chromium tarball

For some reason, the tarball contains a lot of extraneous directories. So, do something like:

mkdir /some/temp/dir
mv chromium.r125269.tgz /some/temp/dir/
cd /some/temp/dir
tar -xvzf chromium.r125269.tgz
mv home/chrome-svn/tarball/chromium ~/development/chromium

IMPORTANT: full path to the 'chromium' directory above cannot have any spaces

7. Update the .gclient file to point to a'release' revision.

There's a file called '.gclient' in the 'chromium' directory that tells gclient what to sync to. We all want to be on the same revision, and we'd like to be on a revision that builds correctly. So, change the "url" entry in .gclient' to something from this page: https://src.chromium.org/chrome/releases/

As of this writing, we're on: https://src.chromium.org/chrome/releases/21.0.1154.0/

So, the .gclient file should look something like:

solutions = [
  { "name"        : "src",
    "url"         : "https://src.chromium.org/chrome/releases/21.0.1154.0/",
    "custom_deps" : {
      # To use the trunk of a component instead of what's in DEPS:
      #"component": "https://svnserver/component/trunk/",
      # To exclude a component from your working copy:
      #"data/really_large_component": None,
      "src/third_party/WebKit/LayoutTests": None,
      "src/chrome_frame/tools/test/reference_build/chrome": None,
      "src/chrome/tools/test/reference_build/chrome_mac": None,
      "src/chrome/tools/test/reference_build/chrome_win": None,
      "src/chrome/tools/test/reference_build/chrome_linux": None,
    }
  }
]

8. Make sure you've got chromium.org's ssl certs

SVN keeps its own cache of ssl certs, and sometimes chromium.org isn't in it. That'll cause problems later with 'batch' commands. So, you can check by doing some quick, interactive svn command like:

svn list https://src.chromium.org/chrome/trunk/src

That may prompt you to add an ssl cert. If it does, add it permanently. If it doesn't, you win. Proceed to next step.

9. Update the source

Make sure you're in the "chromium" dir that has "src" inside it and run

gclient sync --force

This can take an hour or so. Or longer.

10. Use GYP to generate the build files for ninja and/or Xcode

Change to the chromium src dir:

cd [something]/chromium/src

Update clang:

tools/clang/scripts/update.sh

Generate build files

#for ninja:
GYP_GENERATORS=ninja GYP_DEFINES=mac_sdk=10.6 ./build/gyp_chromium

#for xcode:
GYP_GENERATORS=xcode GYP_DEFINES=mac_sdk=10.6 ./build/gyp_chromium

11. Build!

To build with ninja, from chromium/src dir, run:

ninja -C out/Debug content_shell
# or
ninja -C out/Release content_shell

or use Xcode by opening chromium/src/content/content.xcodeproj and throwing away your life.