blob: 539d0d0a224d103f7e7f1899c70e02c25ea955b5 [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
Scott Graham6b17c6522018-09-25 20:39:366There are instructions for other platforms linked from the
Scott Grahamf94d84d2017-06-26 18:24:407[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
Fabrice de Gans-Riberibbc67a1b2018-08-30 13:19:2116Most development is done on Ubuntu. Mac build is supported on a best-effort
17basis.
Scott Grahamf94d84d2017-06-26 18:24:4018
19## Install `depot_tools`
20
21Clone the `depot_tools` repository:
22
23```shell
24$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
25```
26
27Add `depot_tools` to the end of your PATH (you will probably want to put this
28in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to
29`/path/to/depot_tools`:
30
31```shell
32$ export PATH="$PATH:/path/to/depot_tools"
33```
34
35## Get the code
36
37Create a `chromium` directory for the checkout and change to it (you can call
38this whatever you like and put it wherever you like, as long as the full path
39has no spaces):
40
41```shell
42$ mkdir ~/chromium && cd ~/chromium
43```
44
45Run the `fetch` tool from depot_tools to check out the code and its
46dependencies.
47
48```shell
49$ fetch --nohooks chromium
50```
51
Scott Grahamf94d84d2017-06-26 18:24:4052Expect the command to take 30 minutes on even a fast connection, and many
53hours on slower ones.
54
55If you've already installed the build dependencies on the machine (from another
56checkout, for example), you can omit the `--nohooks` flag and `fetch`
57will automatically execute `gclient runhooks` at the end.
58
59When `fetch` completes, it will have created a hidden `.gclient` file and a
Adam MacBethc6fc88b52017-06-30 17:26:3160directory called `src` in the working directory.
Scott Grahamf94d84d2017-06-26 18:24:4061
62### Configure for building on Fuchsia
63
64Edit `.gclient` to include (this is a list, so it could also include `android`,
65etc. if necessary.)
66
67```
68target_os = ['fuchsia']
69```
70
Scott Graham9ffcea62017-06-30 21:31:3771Note that this should be added as a top-level statement in the `.gclient` file,
72not an entry inside the `solutions` dict.
73
Scott Graham6b17c6522018-09-25 20:39:3674You will then need to run:
75
76```shell
77$ gclient runhooks
78```
79
80This makes sure the Fuchsia SDK is available in third\_party and keeps it up to
81date.
Scott Grahamf94d84d2017-06-26 18:24:4082
Adam MacBethc6fc88b52017-06-30 17:26:3183The remaining instructions assume you have switched to the `src` directory:
84
85```shell
86$ cd src
87```
Scott Grahamf94d84d2017-06-26 18:24:4088
Scott Graham6b17c6522018-09-25 20:39:3689### Update your checkout
90
91To update an existing checkout, you can run
92
93```shell
94$ git rebase-update
95$ gclient sync
96```
97
98The first command updates the primary Chromium source repository and rebases
99any of your local branches on top of tip-of-tree (aka the Git branch
100`origin/master`). If you don't want to use this script, you can also just use
101`git pull` or other common Git commands to update the repo.
102
103The second command syncs dependencies to the appropriate versions and re-runs
104hooks as needed. `gclient sync` updates dependencies to the versions specified
105in `DEPS`, so any time that file is modified (pulling, changing branches, etc.)
106`gclient sync` should be run.
107
Fabrice de Gans-Riberibbc67a1b2018-08-30 13:19:21108## (Mac-only) Download additional required Clang binaries
109
110Go to [this page](https://chrome-infra-packages.appspot.com/p/fuchsia/clang/mac-amd64/+/)
111and download the most recent build. Extract `bin/llvm-ar` to the clang folder
112in Chromium:
113
114```shell
115$ unzip /path/to/clang.zip bin/llvm-ar -d ${CHROMIUM_SRC}/third_party/llvm-build/Release+Asserts
116```
117
Scott Grahamf94d84d2017-06-26 18:24:40118## Setting up the build
119
Tom Bridgwatereef401542018-08-17 00:54:43120Chromium uses [Ninja](https://ninja-build.org) as its main build tool along with
121a tool called [GN](https://gn.googlesource.com/gn/+/master/docs/quick_start.md)
122to generate `.ninja` files. You can create any number of *build directories*
123with different configurations. To create a build directory, run:
Scott Grahamf94d84d2017-06-26 18:24:40124
125```shell
Adam MacBethddd50f32017-07-10 01:42:26126$ 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:40127```
128
Wez2102c3be2017-07-12 01:09:26129You can also build for Debug, with `is_debug=true`, but since we don't currently
130have any Debug build-bots, it may be more broken than Release.
131
Scott Grahamb69a2f62017-06-26 19:32:20132`use_goma=true` is fine to use also if you're a Googler.
133
Scott Grahamf94d84d2017-06-26 18:24:40134## Build
135
136Currently, not all targets build on Fuchsia. You can build base\_unittests, for
137example:
138
139```shell
Max Morozf5b31fcd2018-08-10 21:55:48140$ autoninja -C out/fuchsia base_unittests
Scott Grahamf94d84d2017-06-26 18:24:40141```
142
Max Morozf5b31fcd2018-08-10 21:55:48143`autoninja` is a wrapper that automatically provides optimal values for the
144arguments passed to `ninja`.
145
Scott Grahamf94d84d2017-06-26 18:24:40146## Run
147
148Once it is built, you can run by:
149
150```shell
Wez2102c3be2017-07-12 01:09:26151$ out/fuchsia/bin/run_base_unittests
Scott Grahamf94d84d2017-06-26 18:24:40152```
153
154This packages the built binary and test data into a disk image, and runs a QEMU
155instance from the Fuchsia SDK, outputting to the console.
156
157Common gtest arguments such as `--gtest_filter=...` are supported by the run
158script.
159
160The run script also symbolizes backtraces.