Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: docs/ios_build_instructions.md

Issue 2526563003: Update the build instructions to be consistent. (Closed)
Patch Set: more updates Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # iOS Build Instructions 1 # iOS Build Instructions
2 2
3 **Note:** Upstreaming of iOS code is still a work in progress. In particular, 3 **See also [the old version of this page](old_ios_build_instructions.md).**
4 note that **it is not currently possible to build an actual Chromium app.**
5 Currently, the buildable binaries are ios\_web\_shell (a minimal wrapper around
6 the web layer), and various unit tests.
7 4
8 ## Prerequisites 5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom e) instead.
9 6
10 * A Mac running 10.11+. 7 [TOC]
11 * [Xcode] 8.0+.
12 * [depot\_tools].
13 * The current version of the JDK (required for the closure compiler).
14 8
15 ## Getting the source 9 ## System requirements
16 10
17 To checkout the source, use `fetch ios` command from [depot\_tools] in a new 11 * A 64-bit Mac running 10.11+.
18 empty directory. 12 * [Xcode](https://developer.apple.com/xcode) 8.0+.
13 * The OSX 10.10 SDK. Run
14
15 ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
16
17 to check whether you have it. Building with the 10.11 SDK works too, but
18 the releases currently use the 10.10 SDK.
19 * The current version of the JDK (which is required for the Closure compiler).
19 20
20 ```shell 21 ## Install `depot_tools`
21 # You can use a different location for your checkout of Chromium on iOS
22 # by updating this variable. All shell snippets will refer to it.
23 CHROMIUM_IOS="$HOME/chromium_ios"
24 mkdir "$CHROMIUM_IOS"
25 cd "$CHROMIUM_IOS"
26 fetch ios
27 ```
28 22
29 ## Setting up 23 Clone the depot_tools repository:
30 24
31 Chromium on iOS is built using the [Ninja](ninja_build.md) tool and 25 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
32 the [Clang](clang.md) compiler. See both of those pages for further details on
33 how to tune the build.
34 26
35 Before you build, you may want to [install API keys](api-keys) so that 27 Add depot_tools to the end of your PATH (you will probably want to put this
36 Chrome-integrated Google services work. This step is optional if you aren't 28 in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools
37 testing those features. 29 to /path/to/depot_tools:
38 30
39 ### Quick setup 31 $ export PATH=$PATH:/path/to/depot_tools
40 32
41 To setup the repository for building Chromium on iOS code, it is recommended 33 ## Get the code
42 to use the `src/ios/build/tools/setup-gn.py` script that creates a Xcode
43 workspace configured to build the different targets for device and simulator.
44 34
45 ```shell 35 Create a chromium directory for the checkout and change to it (you can call
46 cd "$CHROMIUM_IOS/src" 36 this whatever you like and put it wherever you like, as
47 ios/build/tools/setup-gn.py 37 long as the full path has no spaces):
48 open out/build/all.xcworkspace 38
49 ``` 39 $ mkdir chromium
40 $ cd chromium
41
42 Run the `fetch` tool from depot_tools to check out the code and its
43 dependencies.
44
45 $ fetch ios
46
47 (This is identical to `fetch chromium`, except that it sets `target_os=["ios"]`
48 in your `.gclient` file.
49
50 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
52 30 minutes on even a fast connection, and many hours on slower ones.
53
54 When fetch completes, it will have created a directory called `src`.
55 The remaining instructions assume you are now in that directory:
56
57 $ cd src
58
59 *Optional*: You can also [install API keys](https://www.chromium.org/developers/ how-tos/api-keys)
60 if you want to talk to some of the Google services, but this is not necessary
61 for most development and testing purposes.
62
63 ## Setting up the build
64
65 Since the iOS build is a bit more complicated than a desktop build, we
66 provide the `ios/build/tools/setup-gn.py`, which will create four
67 appropriately configured build directories under `out` for Release and
68 Debug device and simulator builds, and generates an appropriate Xcode
69 workspace as well.
70
71 This script is run automatically by fetch (as part of `gclient runhooks`).
50 72
51 You can customize the build by editing the file `$HOME/.setup-gn` (create it 73 You can customize the build by editing the file `$HOME/.setup-gn` (create it
52 if it does not exists). Look at `src/ios/build/tools/setup-gn.config` for 74 if it does not exists). Look at `src/ios/build/tools/setup-gn.config` for
53 available configuration options. 75 available configuration options.
54 76
55 From this point, you can either build from Xcode or from the command-line 77 From this point, you can either build from Xcode or from the command-line
56 using `ninja`. The script `setup-gn.py` creates sub-directories named 78 using `ninja`. The script `setup-gn.py` creates sub-directories named
57 `out/${configuration}-${platform}`, so for a `Debug` build for simulator 79 `out/${configuration}-${platform}`, so for a `Debug` build for simulator
58 use: 80 use:
59 81
60 ```shell 82 ```shell
61 ninja -C out/Debug-iphonesimulator gn_all 83 ninja -C out/Debug-iphonesimulator gn_all
62 ``` 84 ```
63 85
64 Note: you need to run `setup-gn.py` script every time one of the `BUILD.gn` 86 Note: you need to run `setup-gn.py` script every time one of the `BUILD.gn`
65 file is updated (either by you or after rebasing). If you forget to run it, 87 file is updated (either by you or after rebasing). If you forget to run it,
66 the list of targets and files in the Xcode solution may be stale. 88 the list of targets and files in the Xcode solution may be stale.
67 89
68 ### Advanced setup 90 You can also follow the manual instructions on the
69 91 [mac page](mac_build_instructions.md), but make sure you set the
70 You can run `gn` manually to configure the build yourself. In that case, 92 GN arg `target_os="ios"`.
71 refer to [mac build instructions] for help on how to do that.
72
73 To build for iOS, you have to set `target_os` to `"ios"`. Please also note
74 that `is_component_build` is not supported when building for iOS and must
75 be set to `false`.
76 93
77 ## Running 94 ## Running
78 95
79 Any target that is built and runs on the bots (see [below](#Troubleshooting)) 96 Any target that is built and runs on the bots (see [below](#Troubleshooting))
80 should run successfully in a local build. As of the time of writing, this is 97 should run successfully in a local build. As of the time of writing, this is
81 only ios\_web\_shell and unit test targets—see the note at the top of this 98 only ios_web_shell and unit test targets—see the note at the top of this
82 page. Check the bots periodically for updates; more targets (new components) 99 page. Check the bots periodically for updates; more targets (new components)
83 will come on line over time. 100 will come on line over time.
84 101
85 To run in the simulator from the command line, you can use `iossim`. For 102 To run in the simulator from the command line, you can use `iossim`. For
86 example, to run a debug build of ios\_web\_shell: 103 example, to run a debug build of ios_web_shell:
87 104
88 ```shell 105 ```shell
89 out/Debug-iphonesimulator/iossim out/Debug-iphonesimulator/ios_web_shell.app 106 out/Debug-iphonesimulator/iossim out/Debug-iphonesimulator/ios_web_shell.app
90 ``` 107 ```
91 108
92 ## Troubleshooting 109 ## Update your checkout
93 110
94 If your build fails, check the iOS columns of [the Mac 111 To update an existing checkout, you can run
95 waterfall](http://build.chromium.org/p/chromium.mac/console) (the last two) to
96 see if the bots are green. In general they should be, since failures on those
97 bots will close the tree.
98 112
99 [Xcode]: https://developer.apple.com/xcode 113 $ git rebase-update
100 [depot\_tools]: https://dev.chromium.org/developers/how-tos/depottools 114 $ gclient sync
101 [Ninja]: ninja.md 115
102 [Clang]: clang.md 116 The first command updates the primary Chromium source repository and rebases
103 [api-keys]: https://sites.google.com/a/chromium.org/dev/developers/how-tos/api-k eys 117 any of your local branches on top of tip-of-tree (aka the Git branch `origin/mas ter`).
104 [mac build instructions]: mac_build_instructions.md 118 If you don't want to use this script, you can also just use `git pull` or
119 other common Git commands to update the repo.
120
121 The second command syncs the subrepositories to the appropriate versions and
122 re-runs the hooks as needed.
123
124 ## Tips, tricks, and troubleshooting
125
126
127 If you have problems building, join us in `#chromium` on `irc.freenode.net` and
128 ask there. As mentioned above, be sure that the
129 [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.
131
132 ### Improving performance of `git status`
133
134 `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
136 quite variable. Increasing the system's vnode cache appears to help. By
137 default, this command:
138
139 sysctl -a | egrep kern\..*vnodes
140
141 Outputs `kern.maxvnodes: 263168` (263168 is 257 * 1024). To increase this
142 setting:
143
144 sudo sysctl kern.maxvnodes=$((512*1024))
145
146 Higher values may be appropriate if you routinely move between different
147 Chromium checkouts. This setting will reset on reboot, the startup setting can
148 be set in `/etc/sysctl.conf`:
149
150 echo kern.maxvnodes=$((512*1024)) | sudo tee -a /etc/sysctl.conf
151
152 Or edit the file directly.
153
154 If your `git --version` reports 2.6 or higher, the following may also improve
155 performance of `git status`:
156
157 git update-index --untracked-cache
158
159 ### Xcode license agreement
160
161 If you're getting the error
162
163 ```
164 Agreeing to the Xcode/iOS license requires admin privileges, please re-run as ro ot via sudo.
165 ```
166
167 the Xcode license hasn't been accepted yet which (contrary to the message) any
168 user can do by running:
169
170 xcodebuild -license
171
172 Only accepting for all users of the machine requires root:
173
174 sudo xcodebuild -license
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698