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

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

boklm's avatar
boklm committed
7
8
9
10
To build Tor Browser, you need a recent Linux distribution with support
for user_namespaces(7) (such as Debian Buster, Ubuntu 16.04, Fedora 30,
etc ...). You will need to install the uidmap package, providing the
newuidmap and newgidmap commands.
boklm's avatar
boklm committed
11

12
The sources of most components are downloaded using git, which needs to
Georg Koppen's avatar
Georg Koppen committed
13
be installed.
boklm's avatar
boklm committed
14
15
16
17
18
19
20
21

You also need a few perl modules installed:
- YAML::XS
- File::Basename
- Getopt::Long
- Template
- IO::Handle
- IO::CaptureOutput
22
- JSON
boklm's avatar
boklm committed
23
- File::Temp
24
- Path::Tiny
boklm's avatar
boklm committed
25
- File::Path
26
- File::Slurp
boklm's avatar
boklm committed
27
- File::Copy::Recursive
boklm's avatar
boklm committed
28
29
30
31
32
- String::ShellQuote
- Sort::Versions
- Digest::SHA
- Data::UUID
- Data::Dump
33
- DateTime
boklm's avatar
boklm committed
34
35
36

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

37
# apt-get install libyaml-libyaml-perl libtemplate-perl libdatetime-perl \
boklm's avatar
boklm committed
38
                  libio-handle-util-perl libio-all-perl \
39
                  libio-captureoutput-perl libjson-perl libpath-tiny-perl \
boklm's avatar
boklm committed
40
41
                  libstring-shellquote-perl libsort-versions-perl \
                  libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \
boklm's avatar
boklm committed
42
43
                  libfile-copy-recursive-perl libfile-slurp-perl git \
                  uidmap
boklm's avatar
boklm committed
44

45
46
47
48
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
49
50
51
52
53
54
55
The build uses user_namespaces(7), which are disabled by default on Debian.
To enable them you can use the following command as root:

  # sysctl -w kernel.unprivileged_userns_clone=1

You can enable them permanently by adding the setting to /etc/sysctl.d/

boklm's avatar
boklm committed
56
57
58
59
60
61

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

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

boklm's avatar
boklm committed
63
64
65
66
67
68
  $ make release
  $ make alpha
  $ make 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
69
nightly can be found in the nightly/$version directory.
boklm's avatar
boklm committed
70
71
72
73
74
75
76

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
77
  $ make nightly-windows-x86_64
boklm's avatar
boklm committed
78
  $ make nightly-osx-x86_64
79
  $ make nightly-android-armv7
80
  $ make nightly-android-aarch64
81
  $ make nightly-android-x86
82
  $ make nightly-android-x86_64
boklm's avatar
boklm committed
83

boklm's avatar
boklm committed
84
85
86
87
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
88
89
90
mar file will be created. If you want to base your testbuild on the latest
nightly code insted, rename rbm.local.conf.example to rbm.local.conf
and adapt the torbrowser-testbuild option accordingly.
boklm's avatar
boklm committed
91

boklm's avatar
boklm committed
92
93
94
95

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

96
You can run `make fetch` to fetch the latest sources from git for all
boklm's avatar
boklm committed
97
components included in Tor Browser. You should run this if you want to
98
99
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
100
101


102
103
104
105
106
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
107
set the RBM_NUM_PROCS environment variable:
108

109
  $ export RBM_NUM_PROCS=8
110

111
You can also set the buildconf/num_procs option in rbm.local.conf.
112
113


boklm's avatar
boklm committed
114
115
116
117
118
119
120
121
122
123
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

124
125
Or set the debug option to 0 in the rbm.local.conf file.

boklm's avatar
boklm committed
126
127
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
128
you want to build, and add the --output-dir option. For example, if you
boklm's avatar
boklm committed
129
130
want to build Tor Browser nightly for linux-x86_64:

131
   ./rbm/rbm build release --output-dir=/var/builds/nightly/2020-05-23 \
boklm's avatar
boklm committed
132
133
134
135
136
137
                        --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:

138
   ./rbm/rbm build release --output-dir=/var/builds/nightly/2020-05-23 \
boklm's avatar
boklm committed
139
140
141
142
143
144
145
146
                        --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
147
148
149
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
150
151


152
153
Using ansible to set up a nightly build machine
-----------------------------------------------
boklm's avatar
boklm committed
154

155
156
157
158
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
159
160


161
162
163
164
Signing builds
--------------

If the environment variable RBM_SIGN_BUILD is set to 1, the
165
166
167
168
169
sha256sums-unsigned-build.txt and sha256sums-unsigned-build.incrementals.txt
files will be signed with gpg. You can use the RBM_GPG_OPTS environment
variable to add some options 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.
170
171


boklm's avatar
boklm committed
172
173
174
Cleaning obsolete files and containers images
---------------------------------------------

175
You can run `make clean` to clean old build files and containers that
176
177
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
178
rbm.local.conf file. The cleaning script will check out all the configured
179
180
181
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
182
use `make clean-dry-run`.
boklm's avatar
boklm committed
183

184

185
186
187
188
189
Building without containers (Android builds only)
-------------------------------------------------

By default the build is done inside containers. Adding the no_containers
target will disable the use of containers. The following commands can
190
be used to build the alpha version for e.g. android-armv7:
191
192
193
194
195
196
197
198
199
200

  ./rbm/rbm build release --target no_containers --target testbuild \
                          --target torbrowser-android-armv7

Note: the logs will still show the use and creation of a container image
called "containers_disabled". This is due to the way we disable the use
of containers: the container-image project is still called, but it will
just create an empty file instead of a real container image.

The build without containers is currently only supported for the Android
201
builds, and will require that you run Debian Buster and install build
202
203
204
dependencies for all the components that are built. This can be done
with the following command:

205
  # apt-get install build-essential python automake libtool zip unzip \
206
207
208
            autoconf2.13 openjdk-8-jdk gettext-base autotools-dev \
            automake autoconf libtool autopoint libssl-dev \
            pkg-config zlib1g-dev libparallel-forkmanager-perl \
209
            libfile-slurp-perl bzip2 xz-utils apksigner yasm
210
211


212
213
214
Common Build Errors
-------------------

215
You can look at the file doc/BUILD_ERRORS.txt for a list of common build
216
217
errors and their solutions.

boklm's avatar
boklm committed
218
219
220
221

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

222
The file doc/HACKING.txt tries to list the main things to know when
boklm's avatar
boklm committed
223
224
making changes to the Tor Browser build.

225

226
227
228
Description of makefile rules
-----------------------------

229
You can find a description of the Makefile rules in the file doc/MAKEFILE.txt.
230