README 6.71 KB
Newer Older
boklm's avatar
boklm committed
1
2
3
4
5
6
7
Tor Browser Build
=================

Installing build dependencies
-----------------------------

To build Tor Browser, you need a Linux distribution that has support
8
for runc (such as Debian jessie, Ubuntu 16.04, Fedora 20, etc ...).
9
10
On Debian jessie, the runc package is available in backports. On Debian
stretch, the runc package is available in the main repository.
boklm's avatar
boklm committed
11

Georg Koppen's avatar
Georg Koppen committed
12
13
14
Your user account should have sudo access, which is required to be able
to extract container file systems, start containers and copy files to and
from containers.
boklm's avatar
boklm committed
15

16
The sources of most components are downloaded using git, which needs to
17
18
19
20
be installed. Some components are downloaded using mercurial which also
needs to be installed. The sources of webrtc are downloaded using
gclient, which requires GTK+ 2.0 development files and curl to be
installed.
boklm's avatar
boklm committed
21
22
23
24
25
26
27
28
29

You also need a few perl modules installed:
- YAML::XS
- File::Basename
- Getopt::Long
- Template
- IO::Handle
- IO::CaptureOutput
- File::Temp
30
- Path::Tiny
boklm's avatar
boklm committed
31
- File::Path
boklm's avatar
boklm committed
32
- File::Copy::Recursive
boklm's avatar
boklm committed
33
34
35
36
37
38
39
40
41
42
- String::ShellQuote
- Sort::Versions
- Digest::SHA
- Data::UUID
- Data::Dump

If you are running Debian or Ubuntu, you can install them with:

# apt-get install libyaml-libyaml-perl libtemplate-perl \
                  libio-handle-util-perl libio-all-perl \
43
                  libio-captureoutput-perl libpath-tiny-perl \
boklm's avatar
boklm committed
44
45
                  libstring-shellquote-perl libsort-versions-perl \
                  libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \
46
47
                  libfile-copy-recursive-perl git libgtk2.0-dev curl runc \
                  mercurial
boklm's avatar
boklm committed
48

49
50
51
52
The build system is based on rbm, which is included as a git submodule
in the rbm/ directory. You can fetch the rbm git submodule by running
'make submodule-update'.

boklm's avatar
boklm committed
53
54
55
56
57
58

Starting a build
----------------

To start a build, run one of the following commands, depending on the
channel you want to build:
59

boklm's avatar
boklm committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  $ make release
  $ make alpha
  $ make nightly
  $ make alpha_nightly

You can find the build result in the directory release/unsigned/$version
or alpha/unsigned/$version for release or alpha builds. The result of
nightly or alpha_nightly can be found in the nightly/$date or
alpha_nightly/$date directory.

The alpha and alpha_nightly make target will build the same thing. The
only difference is the output directory. The alpha_nightly target can be
useful if you want to do a test build without polluting your alpha
directory.

If you want to build for a specific platform only, append the platform
name to the makefile target:

  $ make nightly-linux-x86_64
  $ make nightly-linux-i686
  $ make nightly-windows-i686
  $ make nightly-osx-x86_64

boklm's avatar
boklm committed
83
84
85
86
87
88
When you want to quickly do a build to test a change, you can use the
testbuild makefile target, and find the build in the testbuild directory.
The build will be the same as regular alpha builds, except that in order
to make the build faster, only the en-US locale will be built, and no
mar file will be created.

boklm's avatar
boklm committed
89
90
91
92
93
94

Updating git sources
--------------------

You can run "make fetch" to fetch the latest sources from git for all
components included in Tor Browser. You should run this if you want to
95
96
make a nightly build with the latest commits, and you disabled automatic
fetching of new commits for nightly builds in rbm.local.conf.
boklm's avatar
boklm committed
97
98


99
100
101
102
103
Number of make processes
------------------------

By default the builds are run with 4 processes simultaneously (with
make -j4). If you want to change the number of processes used, you can
104
set the RBM_NUM_PROCS environment variable:
105

106
  $ export RBM_NUM_PROCS=8
107

108
You can also set the buildconf/num_procs option in rbm.local.conf.
109
110


boklm's avatar
boklm committed
111
112
113
114
115
116
117
118
119
120
Automated builds
----------------

If the build fails, a shell will automatically open in the build
container to help you debug the problem. You probably want to disable
this if you want to do automated builds. To disable this, set
the RBM_NO_DEBUG environment variable to 1:

   export RBM_NO_DEBUG=1

121
122
Or set the debug option to 0 in the rbm.local.conf file.

boklm's avatar
boklm committed
123
124
If you want to select the output directory, you can use rbm's --output-dir
option. You can look at the Makefile to find the rbm command for what
Georg Koppen's avatar
Georg Koppen committed
125
you want to build, and add the --output-dir option. For example, if you
boklm's avatar
boklm committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
want to build Tor Browser nightly for linux-x86_64:

   ./rbm/rbm build release --output-dir=/var/builds/nightly/2017-01-23 \
                        --target nightly --target torbrowser-linux-x86_64

The files will be put in the directory selected by --output-dir in a
subdirectory named as the version number (or current date for nightly).
To remove this version subdirectory, add the noversiondir target:

   ./rbm/rbm build release --output-dir=/var/builds/nightly/2017-01-23 \
                        --target nightly --target torbrowser-linux-x86_64 \
                        --target noversiondir


Automated builds using tbb-testsuite
------------------------------------

The Tor Browser testsuite scripts can also be used to do nightly builds
144
145
146
and publish the build logs. The recommended way to do that is to use
the ansible roles from the tools/ansible directory. See next section
for details.
boklm's avatar
boklm committed
147
148


149
150
Using ansible to set up a nightly build machine
-----------------------------------------------
boklm's avatar
boklm committed
151

152
153
154
155
The directory tools/ansible contains some ansible roles to set up a
nightly build machine. You can look at the playbook defined in
boklm-tbb-nightly-build.yml and variables in group_vars/boklm-tbb-nightly/
for an example of how it can be used.
boklm's avatar
boklm committed
156
157


158
159
160
161
162
163
Signing builds
--------------

If the environment variable RBM_SIGN_BUILD is set to 1, the
sha256sums-unsigned-build.txt file will be signed with gpg.
You can use the RBM_GPG_OPTS environment variable to add some options
164
165
166
to the gpg command used to sign the file. You can also set the
var/sign_build and var/sign_build_gpg_opts options in the rbm.local.conf
file.
167
168


boklm's avatar
boklm committed
169
170
171
Cleaning obsolete files and containers images
---------------------------------------------

172
173
174
You can run 'make clean' to clean old build files and containers that
are no longer used in current builds. Before doing that, you need to
configure the branches and build targets you are using in the
Georg Koppen's avatar
Georg Koppen committed
175
rbm.local.conf file. The cleaning script will check out all the configured
176
177
178
179
branches to create a list of used build files, and delete the files
from the 'out' directory that are not used. If you want to see the list
of files and containers that would be removed without doing it, you can
use 'make clean-dry-run'.
boklm's avatar
boklm committed
180

181
182
183
184
185
186
187

Common Build Errors
-------------------

You can look at the README.BUILD_ERRORS file for a list of common build
errors and their solutions.

boklm's avatar
boklm committed
188
189
190
191
192
193
194

Hacking on the Tor Browser build
--------------------------------

The file README.HACKING tries to list the main things to know when
making changes to the Tor Browser build.

195
196
197
198
199
200
Description of makefile rules
-----------------------------

You can find a description of the makefile rules in the README.MAKEFILE
file.