blob: 1d9eb5a39dac2d5708d8c81008e64026e3120180 [file] [log] [blame] [view]
Scott Grahamf94d84d2017-06-26 18:24:401# Checking out and building on Fuchsia
2
3***Note that the Fuchsia port is in the early stages, and things are likely to
4frequently be broken. Try #cr-fuchsia on Freenode if something seems awry.***
5
6There are instructions for other platforms linked from the
7[get the code](get_the_code.md) page.
8
9## System requirements
10
11* A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly
12 recommended.
13* At least 100GB of free disk space.
14* You must have Git and Python installed already.
15
16Most development is done on Ubuntu.
17
18## Install `depot_tools`
19
20Clone the `depot_tools` repository:
21
22```shell
23$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
24```
25
26Add `depot_tools` to the end of your PATH (you will probably want to put this
27in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to
28`/path/to/depot_tools`:
29
30```shell
31$ export PATH="$PATH:/path/to/depot_tools"
32```
33
34## Get the code
35
36Create a `chromium` directory for the checkout and change to it (you can call
37this whatever you like and put it wherever you like, as long as the full path
38has no spaces):
39
40```shell
41$ mkdir ~/chromium && cd ~/chromium
42```
43
44Run the `fetch` tool from depot_tools to check out the code and its
45dependencies.
46
47```shell
48$ fetch --nohooks chromium
49```
50
51If you don't want the full repo history, you can save a lot of time by
52adding the `--no-history` flag to `fetch`.
53
54Expect the command to take 30 minutes on even a fast connection, and many
55hours on slower ones.
56
57If you've already installed the build dependencies on the machine (from another
58checkout, for example), you can omit the `--nohooks` flag and `fetch`
59will automatically execute `gclient runhooks` at the end.
60
61When `fetch` completes, it will have created a hidden `.gclient` file and a
Adam MacBethc6fc88b52017-06-30 17:26:3162directory called `src` in the working directory.
Scott Grahamf94d84d2017-06-26 18:24:4063
64### Configure for building on Fuchsia
65
66Edit `.gclient` to include (this is a list, so it could also include `android`,
67etc. if necessary.)
68
69```
70target_os = ['fuchsia']
71```
72
Scott Graham9ffcea62017-06-30 21:31:3773Note that this should be added as a top-level statement in the `.gclient` file,
74not an entry inside the `solutions` dict.
75
Scott Grahamf94d84d2017-06-26 18:24:4076You will then need to re-run `gclient runhooks`. This makes sure the Fuchsia SDK
77is available in third\_party and keeps it up to date.
78
Adam MacBethc6fc88b52017-06-30 17:26:3179The remaining instructions assume you have switched to the `src` directory:
80
81```shell
82$ cd src
83```
Scott Grahamf94d84d2017-06-26 18:24:4084
85## Setting up the build
86
87Chromium uses [Ninja](https://ninja-build.org) as its main build tool along
88with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja`
89files. You can create any number of *build directories* with different
90configurations. To create a build directory, run:
91
92```shell
Adam MacBethddd50f32017-07-10 01:42:2693$ gn gen out/fuchsia --args="is_debug=false dcheck_always_on=true is_component_build=false target_os=\"fuchsia\""
Scott Grahamf94d84d2017-06-26 18:24:4094```
95
Scott Grahamb69a2f62017-06-26 19:32:2096`use_goma=true` is fine to use also if you're a Googler.
97
Scott Grahamf94d84d2017-06-26 18:24:4098## Build
99
100Currently, not all targets build on Fuchsia. You can build base\_unittests, for
101example:
102
103```shell
Adam MacBethddd50f32017-07-10 01:42:26104$ ninja -C out/fuchsia base_unittests
Scott Grahamf94d84d2017-06-26 18:24:40105```
106
107## Run
108
109Once it is built, you can run by:
110
111```shell
112$ out/fuch/bin/run_base_unittests
113```
114
115This packages the built binary and test data into a disk image, and runs a QEMU
116instance from the Fuchsia SDK, outputting to the console.
117
118Common gtest arguments such as `--gtest_filter=...` are supported by the run
119script.
120
121The run script also symbolizes backtraces.
Scott Grahamb69a2f62017-06-26 19:32:20122
123A useful alias (for "Build And Run Filtered") is:
124```shell
Adam MacBethddd50f32017-07-10 01:42:26125alias barf='ninja -C out/fuchsia base_unittests -j1000 && out/fuch/bin/run_base_unittests --test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.base_unittests.filter'
Scott Grahamb69a2f62017-06-26 19:32:20126```
127to build and run only the tests that are not excluded/known-failing on the bot.