OLD | NEW |
(Empty) | |
| 1 # Checking out and building Cast on Linux |
| 2 |
| 3 **Note**: it is **not possible** to build a binary functionally |
| 4 equivalent to a Chromecast. This is to build a single-page content |
| 5 embedder with similar functionality to Cast products. |
| 6 |
| 7 ## Instructions for Google Employees |
| 8 |
| 9 Are you a Google employee? See |
| 10 [go/building-linux-cast](https://goto.google.com/building-linux-cast) instead. |
| 11 |
| 12 [TOC] |
| 13 |
| 14 ## System requirements |
| 15 |
| 16 * A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly |
| 17 recommended. |
| 18 * At least 100GB of free disk space. |
| 19 * You must have Git and Python installed already. |
| 20 |
| 21 Most development is done on Ubuntu (currently 14.04, Trusty Tahr). There are |
| 22 some instructions for other distros below, but they are mostly unsupported. |
| 23 |
| 24 ## Install `depot_tools` |
| 25 |
| 26 Clone the `depot_tools` repository: |
| 27 |
| 28 ```shell |
| 29 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 30 ``` |
| 31 |
| 32 Add `depot_tools` to the end of your PATH (you will probably want to put this |
| 33 in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to |
| 34 `/path/to/depot_tools`: |
| 35 |
| 36 ```shell |
| 37 $ export PATH="$PATH:/path/to/depot_tools" |
| 38 ``` |
| 39 |
| 40 ## Get the code |
| 41 |
| 42 Create a `chromium` directory for the checkout and change to it (you can call |
| 43 this whatever you like and put it wherever you like, as long as the full path |
| 44 has no spaces): |
| 45 |
| 46 ```shell |
| 47 $ mkdir ~/chromium && cd ~/chromium |
| 48 ``` |
| 49 |
| 50 Run the `fetch` tool from depot_tools to check out the code and its |
| 51 dependencies. |
| 52 |
| 53 ```shell |
| 54 $ fetch --nohooks chromium |
| 55 ``` |
| 56 |
| 57 If you don't want the full repo history, you can save a lot of time by |
| 58 adding the `--no-history` flag to `fetch`. |
| 59 |
| 60 Expect the command to take 30 minutes on even a fast connection, and many |
| 61 hours on slower ones. |
| 62 |
| 63 If you've already installed the build dependencies on the machine (from another |
| 64 checkout, for example), you can omit the `--nohooks` flag and `fetch` |
| 65 will automatically execute `gclient runhooks` at the end. |
| 66 |
| 67 When `fetch` completes, it will have created a hidden `.gclient` file and a |
| 68 directory called `src` in the working directory. The remaining instructions |
| 69 assume you have switched to the `src` directory: |
| 70 |
| 71 ```shell |
| 72 $ cd src |
| 73 ``` |
| 74 |
| 75 ### Install additional build dependencies |
| 76 |
| 77 Once you have checked out the code, and assuming you're using Ubuntu, run |
| 78 [build/install-build-deps.sh](/build/install-build-deps.sh) |
| 79 |
| 80 You may need to adjust the build dependencies for other distros. There are |
| 81 some [notes](#notes) at the end of this document, but we make no guarantees |
| 82 for their accuracy. |
| 83 |
| 84 ### Run the hooks |
| 85 |
| 86 Once you've run `install-build-deps` at least once, you can now run the |
| 87 Chromium-specific hooks, which will download additional binaries and other |
| 88 things you might need: |
| 89 |
| 90 ```shell |
| 91 $ gclient runhooks |
| 92 ``` |
| 93 |
| 94 *Optional*: You can also [install API |
| 95 keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 96 build to talk to some Google services, but this is not necessary for most |
| 97 development and testing purposes. |
| 98 |
| 99 ## Setting up the build |
| 100 |
| 101 Chromium uses [Ninja](https://ninja-build.org) as its main build tool along |
| 102 with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja` |
| 103 files. You can create any number of *build directories* with different |
| 104 configurations. To create a build directory, run: |
| 105 |
| 106 ```shell |
| 107 $ gn gen out/Default --args='is_chromecast=true' |
| 108 ``` |
| 109 |
| 110 * You only have to run this once for each new build directory, Ninja will |
| 111 update the build files as needed. |
| 112 * You can replace `Default` with another name, but |
| 113 it should be a subdirectory of `out`. |
| 114 * For other build arguments, including release settings, see [GN build |
| 115 configuration](https://www.chromium.org/developers/gn-build-configuration). |
| 116 The default will be a debug component build matching the current host |
| 117 operating system and CPU. |
| 118 * For more info on GN, run `gn help` on the command line or read the |
| 119 [quick start guide](../tools/gn/docs/quick_start.md). |
| 120 |
| 121 ### <a name="faster-builds"></a>Faster builds |
| 122 |
| 123 You might try some of the suggestions on the |
| 124 [Linux build setup](linux_build_instructions.md#faster-builds). |
| 125 |
| 126 ## Build cast\_shell |
| 127 |
| 128 Build cast\_shell with Ninja using the command: |
| 129 |
| 130 ```shell |
| 131 $ ninja -C out/Default cast_shell |
| 132 ``` |
| 133 |
| 134 ## Run cast\_shell |
| 135 |
| 136 Once it is built, you can simply run it: |
| 137 |
| 138 ```shell |
| 139 $ out/Default/cast_shell --ozone-platform=x11 http://google.com |
| 140 ``` |
| 141 |
| 142 ## Update your checkout |
| 143 |
| 144 To update an existing checkout, you can run |
| 145 |
| 146 ```shell |
| 147 $ git rebase-update |
| 148 $ gclient sync |
| 149 ``` |
| 150 |
| 151 The first command updates the primary Chromium source repository and rebases |
| 152 any of your local branches on top of tip-of-tree (aka the Git branch |
| 153 `origin/master`). If you don't want to use this script, you can also just use |
| 154 `git pull` or other common Git commands to update the repo. |
| 155 |
| 156 The second command syncs dependencies to the appropriate versions and re-runs |
| 157 hooks as needed. |
| 158 |
| 159 ## Tips, tricks, and troubleshooting |
| 160 |
| 161 ### More links |
| 162 |
| 163 * Want to use Eclipse as your IDE? See |
| 164 [LinuxEclipseDev](linux_eclipse_dev.md). |
OLD | NEW |