Wiki
Clone wikicef / AutomatedBuildSetup
This Wiki page describes the setup of an automated build system for CEF.
Note to Editors: Changes made to this Wiki page without prior approval via the CEF Forum or Issue Tracker may be lost or reverted.
Overview
CEF provides tools for automatically downloading, building and packaging Chromium and CEF source code. These tools are the recommended way of building CEF locally and can also be integrated with an automated build system. Examples of automated build systems for CEF include https://cef-builds.spotifycdn.com/index.html hosted by Spotify. This document outlines how to build a system similar to Spotify's. For general CEF build instructions see the BranchesAndBuilding Wiki page.
Services
An automated build system tracks changes to a CEF branch, automatically builds a new version of CEF when changes are detected, and uploads the resulting artifacts (CEF binary files) to an Internet or Intranet Website.
The following high-level services are necessary for an automated build system:
- Build execution service. Used to perform the CEF automated builds using agents running on different OS platforms. For example, a build system like TeamCity or Jenkins.
- Artifact storage service. Used to store artifacts referenced and generated by the build agents. For example, a shared file system or a storage system like Artifactory.
- Artifact publishing service. Used to publish artifacts for download on the Intranet or Internet. Generally provides some form of distributed caching. For example, a cloud provider like Amazon S3 + Cloudfront or Google Cloud Storage.
Setup of these specific services is outside the scope of this document. However, we will refer to the capabilities of these services in generic terms.
Execution Steps
The reference build system works by executing the following steps in order:
1. Change Trigger
Runs automatically at some interval (for example, once daily) to check if a new change has been committed to the CEF repository. The Bitbucket REST API exposes an endpoint that can be queried to identify the most recent commit in a branch. For example, this will return the most recent commit for 2785 branch:
https://api.bitbucket.org/2.0/repositories/chromiumembedded/cef/commit/2785
The resulting "hash" value can then be compared to the last successful CEF build version to identify if a new build is required (e.g. a hash value of "1e15b7626244fa6c6455b7a24552664e4cc14fd3" from branch 2785 will match a build artifact file named "cef_binary_3.2785.*.g1e15b76_*.tar.bz2").
If artifacts are stored on a shared file system then languages like Python can access the file list directly. If artifacts are stored in Artifactory then see the Artifactory REST API documentation for instructions on how to retrieve a directory listing.
2. Platform Builder
Initiated by the change trigger when a new commit is detected. A separate platform builder is configured for each supported build platform (linux32, linux64, macosx64, windows32, windows64). It executes a build on that platform and then uploads the resulting build artifact files to the storage service (shared file system, Artifactory, etc.).
See the "Platform Build Configurations" section below for recommended platform build configurations.
3. Artifact Publisher
Initiated by the platform builder upon a successful build. It retrieves the list of build artifact files from the storage service and uses the cefbuilds tools to compare against the index.json file generated by the previous run. When changes are detected it uploads the new changes to the publishing service (Amazon S3, GCS, etc.). The new index.json file is then stored for future reference.
In addition to generating index.json files the cefbuilds tools can also generate the index.html file used by the Spotify builder (provide your own custom branding to cef_html_builder.py via the "branding" parameter). See the cef_json_builder_example.py and cef_html_builder.py files from the cefbuilds directory for sample usage.
Platform Build Configurations
The following configurations are executed by the platform builder step. These are the recommended configurations for externally published artifacts but are not recommended for local builds. See the the BranchesAndBuilding Wiki page for general build instructions.
These instructions are intended for use with the currently supported release branches. This Wiki page will be updated as build requirements change.
Lower-case values between %% (%download_dir%, %cef_branch%, etc.) must be provided by you.
Linux Configuration
What's Required
- Linux Build Requirements as listed on the BranchesAndBuilding Wiki page.
- At least 16GB of RAM and 200GB of free disk space.
We recommend building on Linux using a Docker container. All architectures can be built using the same Linux container image with a configuration as shown here that utilizes Chromium's install-build-deps.py script.
64-bit Build Commands
To build 64-bit CEF with a 64-bit Linux Docker image:
export GN_DEFINES="is_official_build=true use_sysroot=true symbol_level=1 is_cfi=false" export CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --build-target=cefsimple --x64-build --with-pgo-profiles
ARM Build Commands
To build ARM CEF with a 64-bit Linux Docker image:
export CEF_INSTALL_SYSROOT=arm export GN_DEFINES="is_official_build=true use_sysroot=true symbol_level=1 is_cfi=false use_thin_lto=false chrome_pgo_phase=0 use_vaapi=false" export CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --build-target=cefsimple --arm-build
ARM64 Build Commands
To build ARM64 CEF with a 64-bit Linux Docker image:
export CEF_INSTALL_SYSROOT=arm64 export GN_DEFINES="is_official_build=true use_sysroot=true symbol_level=1 is_cfi=false use_thin_lto=false chrome_pgo_phase=0" export CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --build-target=cefsimple --arm64-build
MacOS Configuration
What's Required
- MacOS Build Requirements as listed on the BranchesAndBuilding Wiki page.
- At least 16GB of RAM and 200GB of free disk space.
If Xcode is not installed to the default location then set the correct location using the xcodeselect
tool.
64-bit Build Commands
To build Intel 64-bit CEF on a Intel 64-bit MacOS host system:
export GN_DEFINES=is_official_build=true export CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --x64-build --with-pgo-profiles
To build Intel 64-bit CEF on a ARM64 MacOS host system:
export GN_DEFINES=is_official_build=true export CEF_ARCHIVE_FORMAT=tar.bz2 export CEF_ENABLE_AMD64=1 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --x64-build --with-pgo-profiles
ARM64 Build Commands
ARM64 builds require Xcode 12.2 and CEF branch 4280 or newer.
To build ARM64 CEF on an ARM64 MacOS host system:
export GN_DEFINES=is_official_build=true export CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --arm64-build --with-pgo-profiles
To build ARM64 CEF on a Intel 64-bit MacOS host system:
export GN_DEFINES=is_official_build=true export CEF_ARCHIVE_FORMAT=tar.bz2 export CEF_ENABLE_ARM64=1 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --arm64-build --with-pgo-profiles
Windows Configuration
What's Required
- Visual Studio and Windows SDK versions as listed on the BranchesAndBuilding Wiki page.
- At least 16GB of RAM and 200GB of free disk space.
Install the required Visual Studio sub-components by passing the following arguments to the Visual Studio installer:
$ PATH_TO_INSTALLER.EXE ^ --add Microsoft.VisualStudio.Workload.NativeDesktop ^ --add Microsoft.VisualStudio.Component.VC.ATLMFC ^ --includeRecommended
If building for ARM64 install the following additional sub-components:
$ PATH_TO_INSTALLER.EXE ^ --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^ --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^ --includeRecommended
If Visual Studio or Windows SDK is not installed to the default location then set environment variables like the following before executing automate-git.py:
set WIN_CUSTOM_TOOLCHAIN=1 set CEF_VCVARS=none set GYP_MSVS_OVERRIDE_PATH=%vs_root% set VS_CRT_ROOT=%vs_crt_root% set SDK_ROOT=%sdk_root% set PATH=%sdk_root%\bin\%sdk_version%\x64;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\bin\HostX64\x64;%vs_root%\VC\Redist\MSVC\%vc_redist_version%\x64\%vc_redist_crt%;%vs_root%\SystemCRT;%PATH% set LIB=%sdk_root%\Lib\%sdk_version\um\%arch%;%sdk_root%\Lib\%sdk_version\ucrt\%arch%;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\lib\%arch%;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\atlmfc\lib\%arch%;%LIB% set INCLUDE=%sdk_root%\Include\%sdk_version%\um;%sdk_root%\Include\%sdk_version%\ucrt;%sdk_root%\Include\%sdk_version%\shared;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\include;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\atlmfc\include;%INCLUDE%
The correct PATH
, LIB
and INCLUDE
values for your installation can be determined by running the vcvarsall.bat
script and passing in the desired architecture and SDK version.
See comments in gclient_hook.py for Windows custom toolchain requirements. VS + SDK can be packaged for distribution to build agents using a script like Chromium's package_from_installed.py.
32-bit Build Commands
To build 32-bit CEF on a 64-bit Windows host system:
set GN_DEFINES=is_official_build=true set GYP_MSVS_VERSION=2022 set CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --with-pgo-profiles
64-bit Build Commands
To build 64-bit CEF on a 64-bit Windows host system:
set GN_DEFINES=is_official_build=true set GYP_MSVS_VERSION=2022 set CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --x64-build --with-pgo-profiles
ARM64 Build Commands
To build ARM64 CEF on a 64-bit Windows host system:
set CEF_ENABLE_ARM64=1 set GN_DEFINES=is_official_build=true use_thin_lto=false chrome_pgo_phase=0 set GYP_MSVS_VERSION=2022 set CEF_ARCHIVE_FORMAT=tar.bz2 python3 automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --build-target=cefsimple --arm64-build
Updated