CommonBuildTasks
Collection of information about building Chromium and the build system.
build The Chromium build system is a complicated beast of a system, and it is not very well documented beyond the basics of getting the source and building the Chromium product. This page has more advanced information about the build system. If you're new to Chromium development, read the getting started guides.
Faster BuildsComponents BuildA non-standard build configuration is to use dynamic linking instead of static linking for the various modules in the Chromium codebase. This results in significantly faster link times, but is a divergence from what is shipped and primarily tested. To enable the component build: $ GYP_DEFINES="component=shared_library" gclient runhooks or C:\...\src>set GYP_DEFINES=component=shared_library C:\...\src>gclient runhooks Windows: Debug Builds Link FasterOn Windows if using the components build, building in debug mode will generally link faster. This is because in debug mode, the linker works incrementally. In release mode, a full link is performed each time. Mac: Disable Release Mode StrippingOn Mac, if building in release mode, one of the final build steps will be to strip the build products and create dSYM files. This process can slow down your incremental builds, but it can be disabled with the following define: $ GYP_DEFINES="mac_strip_release=0" gclient runhooks Mac: DCHECKs in Release ModeDCHECKs are only designed to be run in debug builds. But building in release mode on Mac is significantly faster. You can have your cake and eat it too by building release mode with DCHECKs enabled using the following define: $ GYP_DEFINES="dcheck_always_on=1" gclient runhooks LinuxLinux has its own page on making the build faster. Configuring the BuildEnvironment VariablesThere are various environment variables that can be passed to the metabuild system GYP when generating project files. This is a summary of them:
Variable FilesIf you want to keep a set of variables established, there are a couple of magic files that GYP reads: chromium.gyp_envNext to your top-level /src/ directory, create a file called chromium.gyp_env. This holds a JSON dictionary, with the keys being any of the above environment variables. For the full list of supported keys, see /src/build/gyp_helper.py. include.gypIn your home directory, create a file ~/.gyp/include.gypi. This holds a JSON dictionary that is merged into the root .gyp file and can contain a key variables with a dictionary value to set GYP_DEFINES, like so: { 'variables': { 'mac_strip_release': 0, }, } supplement.gypiThe build system will also include any files named /src/*/supplement.gypi, which should be in the same format as include.gyp above. Change the Build SystemMost platforms support multiple build systems (Windows: different Visual Studios versions and ninja, Mac: Xcode and ninja, etc.). A sensible default is selected, but it can be overridden: $ GYP_GENERATORS=ninja gclient runhooks Ninja is generally the fastest way to build anything on any platform. Change Build Output DirectoryIf you need to change a compile-time flag and do not want to touch your current build output, you can re-run GYP and place output into a new directory, like so: $ GYP_GENERATOR_OUTPUT="out_other" gclient runhooks $ ninja -C out_other/out/Release chrome If using Ninja, you can avoid the nested out_other/out/ situation by using a GYP_GENERATOR_FLAGS instead: $ GYP_GENERATOR_FLAGS="output_dir=out_other_ninja" gclient runhooks $ ninja -C out_other_ninja/Release chrome Note: If you wish to run the WebKit layout tests, make sure you specify the new directory using --build-directory=out_other_ninja (don't include the Release part). Building Google ChromeTo build Chrome, you need to be a Google employee and have access to the src-internal repository. Once your checkout is set up, you can run gclient like so: $ GYP_DEFINES="branding=Chrome buildtype=Official" gclient runhooks Then building the chrome target will produce the official build. This tip can be used in conjunction with changing the output directory, since changing these defines will rebuild the world. | ||||||||