OLD | NEW |
1 # iOS Build Instructions | 1 # iOS Build Instructions |
2 | 2 |
3 **See also [the old version of this page](old_ios_build_instructions.md).** | 3 **See also [the old version of this page](old_ios_build_instructions.md).** |
4 | 4 |
5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom
e) instead. | 5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom
e) instead. |
6 | 6 |
7 [TOC] | 7 [TOC] |
8 | 8 |
9 ## System requirements | 9 ## System requirements |
10 | 10 |
11 * A 64-bit Mac running 10.11+. | 11 * A 64-bit Mac running 10.11+. |
12 * [Xcode](https://developer.apple.com/xcode) 8.0+. | 12 * [Xcode](https://developer.apple.com/xcode) 8.0+. |
13 * The OSX 10.10 SDK. Run | 13 * The OS X 10.10 SDK. Run |
14 | 14 |
15 ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs | 15 ```shell |
| 16 $ ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs |
| 17 ``` |
16 | 18 |
17 to check whether you have it. Building with the 10.11 SDK works too, but | 19 to check whether you have it. Building with the 10.11 SDK works too, but |
18 the releases currently use the 10.10 SDK. | 20 the releases currently use the 10.10 SDK. |
19 * The current version of the JDK (which is required for the Closure compiler). | 21 * The current version of the JDK (required for the Closure compiler). |
20 | 22 |
21 ## Install `depot_tools` | 23 ## Install `depot_tools` |
22 | 24 |
23 Clone the depot_tools repository: | 25 Clone the `depot_tools` repository: |
24 | 26 |
25 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | 27 ```shell |
| 28 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 29 ``` |
26 | 30 |
27 Add depot_tools to the end of your PATH (you will probably want to put this | 31 Add `depot_tools` to the end of your PATH (you will probably want to put this |
28 in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools | 32 in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to |
29 to /path/to/depot_tools: | 33 `/path/to/depot_tools`: |
30 | 34 |
31 $ export PATH=$PATH:/path/to/depot_tools | 35 ```shell |
| 36 $ export PATH="$PATH:/path/to/depot_tools" |
| 37 ``` |
32 | 38 |
33 ## Get the code | 39 ## Get the code |
34 | 40 |
35 Create a chromium directory for the checkout and change to it (you can call | 41 Create a `chromium` directory for the checkout and change to it (you can call |
36 this whatever you like and put it wherever you like, as | 42 this whatever you like and put it wherever you like, as |
37 long as the full path has no spaces): | 43 long as the full path has no spaces): |
38 | |
39 $ mkdir chromium | |
40 $ cd chromium | |
41 | 44 |
42 Run the `fetch` tool from depot_tools to check out the code and its | 45 ```shell |
| 46 $ mkdir chromium && cd chromium |
| 47 ``` |
| 48 |
| 49 Run the `fetch` tool from `depot_tools` to check out the code and its |
43 dependencies. | 50 dependencies. |
44 | 51 |
45 $ fetch ios | 52 ```shell |
46 | 53 $ fetch ios |
47 (This is identical to `fetch chromium`, except that it sets `target_os=["ios"]` | 54 ``` |
48 in your `.gclient` file. | |
49 | 55 |
50 If you don't want the full repo history, you can save a lot of time by | 56 If you don't want the full repo history, you can save a lot of time by |
51 adding the `--no-history` flag to fetch. Expect the command to take | 57 adding the `--no-history` flag to `fetch`. |
52 30 minutes on even a fast connection, and many hours on slower ones. | |
53 | 58 |
54 When fetch completes, it will have created a directory called `src`. | 59 Expect the command to take 30 minutes on even a fast connection, and many |
55 The remaining instructions assume you are now in that directory: | 60 hours on slower ones. |
56 | 61 |
57 $ cd src | 62 When `fetch` completes, it will have created a hidden `.gclient` file and a |
| 63 directory called `src` in the working directory. The remaining instructions |
| 64 assume you are now in that directory: |
58 | 65 |
59 *Optional*: You can also [install API keys](https://www.chromium.org/developers/
how-tos/api-keys) | 66 ```shell |
60 if you want to talk to some of the Google services, but this is not necessary | 67 $ cd src |
61 for most development and testing purposes. | 68 ``` |
| 69 |
| 70 *Optional*: You can also [install API |
| 71 keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 72 build to talk to some Google services, but this is not necessary for most |
| 73 development and testing purposes. |
62 | 74 |
63 ## Setting up the build | 75 ## Setting up the build |
64 | 76 |
65 Since the iOS build is a bit more complicated than a desktop build, we | 77 Since the iOS build is a bit more complicated than a desktop build, we provide |
66 provide the `ios/build/tools/setup-gn.py`, which will create four | 78 `ios/build/tools/setup-gn.py`, which will create four appropriately configured |
67 appropriately configured build directories under `out` for Release and | 79 build directories under `out` for Release and Debug device and simulator |
68 Debug device and simulator builds, and generates an appropriate Xcode | 80 builds, and generates an appropriate Xcode workspace as well. |
69 workspace as well. | |
70 | 81 |
71 This script is run automatically by fetch (as part of `gclient runhooks`). | 82 This script is run automatically by fetch (as part of `gclient runhooks`). |
72 | 83 |
73 You can customize the build by editing the file `$HOME/.setup-gn` (create it | 84 You can customize the build by editing the file `$HOME/.setup-gn` (create it if |
74 if it does not exists). Look at `src/ios/build/tools/setup-gn.config` for | 85 it does not exist). Look at `src/ios/build/tools/setup-gn.config` for |
75 available configuration options. | 86 available configuration options. |
76 | 87 |
77 From this point, you can either build from Xcode or from the command-line | 88 From this point, you can either build from Xcode or from the command line using |
78 using `ninja`. The script `setup-gn.py` creates sub-directories named | 89 `ninja`. `setup-gn.py` creates sub-directories named |
79 `out/${configuration}-${platform}`, so for a `Debug` build for simulator | 90 `out/${configuration}-${platform}`, so for a `Debug` build for simulator use: |
80 use: | |
81 | 91 |
82 ```shell | 92 ```shell |
83 ninja -C out/Debug-iphonesimulator gn_all | 93 $ ninja -C out/Debug-iphonesimulator gn_all |
84 ``` | 94 ``` |
85 | 95 |
86 Note: you need to run `setup-gn.py` script every time one of the `BUILD.gn` | 96 Note: you need to run `setup-gn.py` script every time one of the `BUILD.gn` |
87 file is updated (either by you or after rebasing). If you forget to run it, | 97 file is updated (either by you or after rebasing). If you forget to run it, |
88 the list of targets and files in the Xcode solution may be stale. | 98 the list of targets and files in the Xcode solution may be stale. |
89 | 99 |
90 You can also follow the manual instructions on the | 100 You can also follow the manual instructions on the |
91 [mac page](mac_build_instructions.md), but make sure you set the | 101 [Mac page](mac_build_instructions.md), but make sure you set the |
92 GN arg `target_os="ios"`. | 102 GN arg `target_os="ios"`. |
93 | 103 |
94 ## Running | 104 ## Running |
95 | 105 |
96 Any target that is built and runs on the bots (see [below](#Troubleshooting)) | 106 Any target that is built and runs on the bots (see [below](#Troubleshooting)) |
97 should run successfully in a local build. As of the time of writing, this is | 107 should run successfully in a local build. As of the time of writing, this is |
98 only ios_web_shell and unit test targets—see the note at the top of this | 108 only the `ios_web_shell` and `ios_chrome_unittests` targets—see the note at the |
99 page. Check the bots periodically for updates; more targets (new components) | 109 top of this page. Check the bots periodically for updates; more targets (new |
100 will come on line over time. | 110 components) will come on line over time. |
101 | 111 |
102 To run in the simulator from the command line, you can use `iossim`. For | 112 To run in the simulator from the command line, you can use `iossim`. For |
103 example, to run a debug build of ios_web_shell: | 113 example, to run a debug build of `ios_web_shell`: |
104 | 114 |
105 ```shell | 115 ```shell |
106 out/Debug-iphonesimulator/iossim out/Debug-iphonesimulator/ios_web_shell.app | 116 $ out/Debug-iphonesimulator/iossim out/Debug-iphonesimulator/ios_web_shell.app |
107 ``` | 117 ``` |
108 | 118 |
109 ## Update your checkout | 119 ## Update your checkout |
110 | 120 |
111 To update an existing checkout, you can run | 121 To update an existing checkout, you can run |
112 | 122 |
113 $ git rebase-update | 123 ```shell |
114 $ gclient sync | 124 $ git rebase-update |
| 125 $ gclient sync |
| 126 ``` |
115 | 127 |
116 The first command updates the primary Chromium source repository and rebases | 128 The first command updates the primary Chromium source repository and rebases |
117 any of your local branches on top of tip-of-tree (aka the Git branch `origin/mas
ter`). | 129 any of your local branches on top of tip-of-tree (aka the Git branch |
118 If you don't want to use this script, you can also just use `git pull` or | 130 `origin/master`). If you don't want to use this script, you can also just use |
119 other common Git commands to update the repo. | 131 `git pull` or other common Git commands to update the repo. |
120 | 132 |
121 The second command syncs the subrepositories to the appropriate versions and | 133 The second command syncs dependencies to the appropriate versions and re-runs |
122 re-runs the hooks as needed. | 134 hooks as needed. |
123 | 135 |
124 ## Tips, tricks, and troubleshooting | 136 ## Tips, tricks, and troubleshooting |
125 | 137 |
126 | |
127 If you have problems building, join us in `#chromium` on `irc.freenode.net` and | 138 If you have problems building, join us in `#chromium` on `irc.freenode.net` and |
128 ask there. As mentioned above, be sure that the | 139 ask there. As mentioned above, be sure that the |
129 [waterfall](http://build.chromium.org/buildbot/waterfall/) is green and the tree | 140 [waterfall](http://build.chromium.org/buildbot/waterfall/) is green and the tree |
130 is open before checking out. This will increase your chances of success. | 141 is open before checking out. This will increase your chances of success. |
131 | 142 |
132 ### Improving performance of `git status` | 143 ### Improving performance of `git status` |
133 | 144 |
134 `git status` is used frequently to determine the status of your checkout. Due | 145 `git status` is used frequently to determine the status of your checkout. Due |
135 to the number of files in Chromium's checkout, `git status` performance can be | 146 to the large number of files in Chromium's checkout, `git status` performance |
136 quite variable. Increasing the system's vnode cache appears to help. By | 147 can be quite variable. Increasing the system's vnode cache appears to help. |
137 default, this command: | 148 By default, this command: |
138 | 149 |
139 sysctl -a | egrep kern\..*vnodes | 150 ```shell |
| 151 $ sysctl -a | egrep kern\..*vnodes |
| 152 ``` |
140 | 153 |
141 Outputs `kern.maxvnodes: 263168` (263168 is 257 * 1024). To increase this | 154 Outputs `kern.maxvnodes: 263168` (263168 is 257 * 1024). To increase this |
142 setting: | 155 setting: |
143 | 156 |
144 sudo sysctl kern.maxvnodes=$((512*1024)) | 157 ```shell |
| 158 $ sudo sysctl kern.maxvnodes=$((512*1024)) |
| 159 ``` |
145 | 160 |
146 Higher values may be appropriate if you routinely move between different | 161 Higher values may be appropriate if you routinely move between different |
147 Chromium checkouts. This setting will reset on reboot, the startup setting can | 162 Chromium checkouts. This setting will reset on reboot, the startup setting can |
148 be set in `/etc/sysctl.conf`: | 163 be set in `/etc/sysctl.conf`: |
149 | 164 |
150 echo kern.maxvnodes=$((512*1024)) | sudo tee -a /etc/sysctl.conf | 165 ```shell |
| 166 $ echo kern.maxvnodes=$((512*1024)) | sudo tee -a /etc/sysctl.conf |
| 167 ``` |
151 | 168 |
152 Or edit the file directly. | 169 Or edit the file directly. |
153 | 170 |
154 If your `git --version` reports 2.6 or higher, the following may also improve | 171 If `git --version` reports 2.6 or higher, the following may also improve |
155 performance of `git status`: | 172 performance of `git status`: |
156 | 173 |
157 git update-index --untracked-cache | 174 ```shell |
| 175 $ git update-index --untracked-cache |
| 176 ``` |
158 | 177 |
159 ### Xcode license agreement | 178 ### Xcode license agreement |
160 | 179 |
161 If you're getting the error | 180 If you're getting the error |
162 | 181 |
163 ``` | 182 > Agreeing to the Xcode/iOS license requires admin privileges, please re-run as |
164 Agreeing to the Xcode/iOS license requires admin privileges, please re-run as ro
ot via sudo. | 183 > root via sudo. |
165 ``` | |
166 | 184 |
167 the Xcode license hasn't been accepted yet which (contrary to the message) any | 185 the Xcode license hasn't been accepted yet which (contrary to the message) any |
168 user can do by running: | 186 user can do by running: |
169 | 187 |
170 xcodebuild -license | 188 ```shell |
| 189 $ xcodebuild -license |
| 190 ``` |
171 | 191 |
172 Only accepting for all users of the machine requires root: | 192 Only accepting for all users of the machine requires root: |
173 | 193 |
174 sudo xcodebuild -license | 194 ```shell |
| 195 $ sudo xcodebuild -license |
| 196 ``` |
OLD | NEW |