| OLD | NEW |
| (Empty) |
| 1 # iOS Build Instructions | |
| 2 | |
| 3 **Generally, this page is obsolete and you should look at | |
| 4 [the new page instead](ios_build_instructions.md).** | |
| 5 | |
| 6 **Note:** Upstreaming of iOS code is still a work in progress. In particular, | |
| 7 note that **it is not currently possible to build an actual Chromium app.** | |
| 8 Currently, the buildable binaries are ios\_web\_shell (a minimal wrapper around | |
| 9 the web layer), and various unit tests. | |
| 10 | |
| 11 ## Prerequisites | |
| 12 | |
| 13 * A Mac running 10.11+. | |
| 14 * [Xcode] 8.0+. | |
| 15 * [depot\_tools]. | |
| 16 * The current version of the JDK (required for the closure compiler). | |
| 17 | |
| 18 ## Getting the source | |
| 19 | |
| 20 To checkout the source, use `fetch ios` command from [depot\_tools] in a new | |
| 21 empty directory. | |
| 22 | |
| 23 ```shell | |
| 24 # You can use a different location for your checkout of Chromium on iOS | |
| 25 # by updating this variable. All shell snippets will refer to it. | |
| 26 CHROMIUM_IOS="$HOME/chromium_ios" | |
| 27 mkdir "$CHROMIUM_IOS" | |
| 28 cd "$CHROMIUM_IOS" | |
| 29 fetch ios | |
| 30 ``` | |
| 31 | |
| 32 ## Setting up | |
| 33 | |
| 34 Chromium on iOS is built using the [Ninja](ninja_build.md) tool and | |
| 35 the [Clang](clang.md) compiler. See both of those pages for further details on | |
| 36 how to tune the build. | |
| 37 | |
| 38 Before you build, you may want to [install API keys](api-keys) so that | |
| 39 Chrome-integrated Google services work. This step is optional if you aren't | |
| 40 testing those features. | |
| 41 | |
| 42 ### Quick setup | |
| 43 | |
| 44 To setup the repository for building Chromium on iOS code, it is recommended | |
| 45 to use the `src/ios/build/tools/setup-gn.py` script that creates a Xcode | |
| 46 workspace configured to build the different targets for device and simulator. | |
| 47 | |
| 48 ```shell | |
| 49 cd "$CHROMIUM_IOS/src" | |
| 50 ios/build/tools/setup-gn.py | |
| 51 open out/build/all.xcworkspace | |
| 52 ``` | |
| 53 | |
| 54 You can customize the build by editing the file `$HOME/.setup-gn` (create it | |
| 55 if it does not exists). Look at `src/ios/build/tools/setup-gn.config` for | |
| 56 available configuration options. | |
| 57 | |
| 58 From this point, you can either build from Xcode or from the command-line | |
| 59 using `ninja`. The script `setup-gn.py` creates sub-directories named | |
| 60 `out/${configuration}-${platform}`, so for a `Debug` build for simulator | |
| 61 use: | |
| 62 | |
| 63 ```shell | |
| 64 ninja -C out/Debug-iphonesimulator gn_all | |
| 65 ``` | |
| 66 | |
| 67 Note: you need to run `setup-gn.py` script every time one of the `BUILD.gn` | |
| 68 file is updated (either by you or after rebasing). If you forget to run it, | |
| 69 the list of targets and files in the Xcode solution may be stale. | |
| 70 | |
| 71 ### Advanced setup | |
| 72 | |
| 73 You can run `gn` manually to configure the build yourself. In that case, | |
| 74 refer to [mac build instructions] for help on how to do that. | |
| 75 | |
| 76 To build for iOS, you have to set `target_os` to `"ios"`. Please also note | |
| 77 that `is_component_build` is not supported when building for iOS and must | |
| 78 be set to `false`. | |
| 79 | |
| 80 ## Running | |
| 81 | |
| 82 Any target that is built and runs on the bots (see [below](#Troubleshooting)) | |
| 83 should run successfully in a local build. As of the time of writing, this is | |
| 84 only ios\_web\_shell and unit test targets—see the note at the top of this | |
| 85 page. Check the bots periodically for updates; more targets (new components) | |
| 86 will come on line over time. | |
| 87 | |
| 88 To run in the simulator from the command line, you can use `iossim`. For | |
| 89 example, to run a debug build of ios\_web\_shell: | |
| 90 | |
| 91 ```shell | |
| 92 out/Debug-iphonesimulator/iossim out/Debug-iphonesimulator/ios_web_shell.app | |
| 93 ``` | |
| 94 | |
| 95 ## Troubleshooting | |
| 96 | |
| 97 If your build fails, check the iOS columns of [the Mac | |
| 98 waterfall](http://build.chromium.org/p/chromium.mac/console) (the last two) to | |
| 99 see if the bots are green. In general they should be, since failures on those | |
| 100 bots will close the tree. | |
| 101 | |
| 102 [Xcode]: https://developer.apple.com/xcode | |
| 103 [depot\_tools]: https://dev.chromium.org/developers/how-tos/depottools | |
| 104 [Ninja]: ninja.md | |
| 105 [Clang]: clang.md | |
| 106 [api-keys]: https://sites.google.com/a/chromium.org/dev/developers/how-tos/api-k
eys | |
| 107 [mac build instructions]: mac_build_instructions.md | |
| OLD | NEW |