Build from scratch
Prelude requires about 20G disk space for compilation, comparing to ~160G for the whole Chromium project. It’s recommended to have 16G or more memory and SSD disk to work with. Here’s the steps to build Prelude from scratch.
1. Checkout the code
git clone https://github.com/xzwang2005/Prelude.git
git may seem like hanging after printing the line:
Resolving deltas: 100% (21062/21062), done.
but it’s actually working. Give it a minute to finish. We will call the directory that has Prelude source code the root directory.
2. Generate build targets with gn
Chromium is built with Ninja, a cross-platform build system similar to CMake. You don’t need to know much about Ninja in order to build Chromium, because its input files are generated by a higher-level system called gn, which stands for generate ninja. There are hundreds of files named “BUILD.gn” scattered in Chromium sources; gn takes in these files and spit out Ninja build files. Then Ninja takes over (see next step) and start the actual building process. More examples on gn will be provided in later posts.
To get started with gn, open a console window and go to Prelude directory you just cloned in last step, type:
gn gen out/debug --args="enable_precompiled_headers=false use_jumbo_build=true"
This command creates a folder out/debug under the root directory, with files containing all the build information:
- gn arguments - args.gn
- ninja build files - build.ninja, toolchain.ninja etc.
- environment setup files - environment.x64 etc.
- dll files (Windows only)
Chromium uses Clang by default, which is downloaded to the folder third_party/llvm-build by a hook. However, this version of Clang has some issues under Windows. First, it does not play well with Visual Studio headers. Build fails unless
enable_precompiled_headers=false
is specified. This is a known issue with no fix planned. Another argumentuse_jumbo_build=true
helps speed up the compile process.
3. Build the targets using ninja
ninja -C out/debug