summaryrefslogtreecommitdiffstats
path: root/docs/chromoting_build_instructions.md
blob: ab5547e15582aa639b8c36099c019274e93a996a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Chromoting Build Instructions

Chromoting, also known as
[Chrome Remote Desktop](https://support.google.com/chrome/answer/1649523),
allows one to remotely control a distant machine, all from within the Chromium
browser. Its source code is located in the `remoting/` folder in the Chromium
codebase. For the sake of brevity, we'll assume that you already have a
pre-built copy of Chromium (or Chrome) installed on your development computer.

[TOC]

## Obtain API keys

Before you can compile the code, you must obtain an API key to allow it to
access the federated Chromoting API.

1.  Join the chromium-dev list, which can be found at
    https://groups.google.com/a/chromium.org/forum/#!forum/chromium-dev. (This
    step is required in order to gain access to the Chromoting API.)
1.  Visit the Google APIs console at https://code.google.com/apis/console.
    1.  Use the `API Project` dropdown to create a new project with a name of
        your choice.
    1.  On the `Services` page, click the button to activate the
        `Chrome Remote Desktop API`, and accept the license agreements that
        appear.
    1.  On the `API Access` page, select the option to create an
        `OAuth2 client ID`, and supply a product name of your choice.
    1.  Choose the `Web application` type, then click more options.
    1.  Replace the contents of `Authorized Redirect URLs` with:
        `https://chromoting-oauth.talkgadget.google.com/talkgadget/oauth/chrome-remote-desktop/dev`
    1.  Clear the `Authorized JavaScript Origins` field and click the button to
        finish creating the client ID.
1.  Create a file `~/.gyp/include.gypi` according to the following format:

```
{
  'variables': {
    'google_api_key': '<API key, listed under Simple API Access in the console>',
    'google_default_client_id': '<Client ID, listed under Client ID for web applications>',
    'google_default_client_secret': '<Client secret, listed under Client ID for web applications>',
  },
}
```

(NB: Replace the text in angled braces according the the instructions between
them.)

## Obtain Chromium code

If you've already checked out a copy of the browser's codebase, you can skip
this section, although you'll still need to run `gclient runhooks` to ensure you
build using the API keys you just generated.

1.  Install the build dependencies, which are listed at
    http://code.google.com/p/chromium/wiki/LinuxBuildInstructionsPrerequisites.
1.  Install the depot\_tools utilities, a process that is documented at
    http://dev.chromium.org/developers/how-tos/install-depot-tools.
1.  Download the Chromium source code by running:
    `$ fetch chromium --nosvn=True`

## Build and install the Linux host service

If you want to remote into a (Debian-based) GNU/Linux host, follow these steps
to compile and install the host service on that system. As of the time of
writing, you must compile from source because no official binary package is
being distributed.

1.  Start in the `src/` directory that contains your checkout of the Chromium
    code.
1.  Build the Chromoting host binaries:

    ```shell
    $ ninja -C out/Release remoting_me2me_host remoting_start_host \
    remoting_native_messaging_host remoting_native_messaging_manifests
    ```

1.  When the build finishes, move into the installer directory:
    `$ cd remoting/host/installer/`
1.  Generate a DEB package for your system's package manager:
    `$ linux/build-deb.sh`
1.  Install the package on your system: `$ sudo dpkg -i *.deb`
1.  The next time you use the Chromoting extension from your browser, it should
    detect the presence of the host service and offer you the option to
    `Enable remote connections`.
    1.  If the Web app doesn't properly detect the host process, you may need to
        create a symlink to help the plugin find the native messaging host:
        `$ sudo ln -s /etc/opt/chrome /etc/chromium`

(NB: If you compile the host service from source and expect to configure it
using the browser extension, you must also compile the latter from source.
Otherwise, the package signing keys will not match and the Web app's OAuth2
token will not be valid within the host process.)

## Build and install the browser extension

The Web app is the Chromoting system's main user interface, and allows you to
connect to existing hosts as well as set up the host process on the machine
you're currently sitting at.  Once built, it must be installed into your browser
as an extension.

1.  Start in the `src/` directory that contains your checkout of the Chromium
    code.
1.  Build the browser extension (Be sure to replace the substitutions denoted by
    angled braces.):

    ```shell
    $ GOOGLE_API_KEY=<API key> GOOGLE_CLIENT_ID_REMOTING=<client ID> \
    GOOGLE_CLIENT_SECRET_REMOTING=<client secret> \
    ninja -C out/Release remoting_webapp
    ````

1.  Install the extension into your Chromium (or Chrome) browser:
    1.  Visit the settings page [chrome://extensions].
    1.  If it is unchecked, tick the `Developer mode` box.
    1.  Click `Load unpacked extension...`, then navigate to
        `out/Release/remoting/remoting.webapp/` within your code checkout.
    1.  Confirm the installation, open a new tab, and click the new app's
        Chromoting icon.
    1.  Complete the account authorization step, signing into your Google
        account if you weren't already.

## Build and install the Android client

If you want to use your Android device to connect to your Chromoting hosts,
follow these steps to install the client app on it. Note that this is in the
very early stages of development. At the time of writing, you must compile from
source because no official version is being distributed.

1.  Follow all the instructions under the `Getting the code` and
    `Install prerequisites` sections of: TODO: 404
    http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
1.  Move into the `src/` directory that contains your checkout of the Chromium
    code.
1.  Build the Android app: `$ ninja -C out/Release remoting_apk`
1.  Connect your device and set up USB debugging:
    1.  Plug your device in via USB.
    1.  Open the Settings app and look for the `Developer options` choice.
        1.  If there is no such entry, open `About phone`, tap `Build number`
            7 times, and look again.
    1.  Under `Developer options`, toggle the main switch to `ON` and enable
        `USB debugging`.
1.  On your machine and still in the `src/` directory, run:
    `$ build/android/adb_install_apk.py --apk=out/Release/apks/Chromoting.apk`
1.  If your Android device prompts you to accept the host's key, do so.
1.  The app should now be listed as Chromoting in your app drawer.

See the [chromoting_android_hacking.md] guide for instructions on viewing the
Android app's log and attaching a debugger.