1. Tor Browser Build
  2. =================
  3. Installing build dependencies
  4. -----------------------------
  5. To build Tor Browser, you need a Linux distribution that has support
  6. for runc (such as Debian jessie, Ubuntu 16.04, Fedora 20, etc ...).
  7. On Debian jessie, the runc package is available in backports. On Debian
  8. stretch, the runc package is available in the main repository.
  9. Your user account should have sudo access, which is required to be able
  10. to extract container file systems, start containers and copy files to and
  11. from containers.
  12. The sources of most components are downloaded using git, which needs to
  13. be installed. The sources of webrtc are downloaded using gclient, which
  14. requires GTK+ 2.0 development files and curl to be installed.
  15. You also need a few perl modules installed:
  16. - YAML::XS
  17. - File::Basename
  18. - Getopt::Long
  19. - Template
  20. - IO::Handle
  21. - IO::CaptureOutput
  22. - File::Temp
  23. - Path::Tiny
  24. - File::Path
  25. - File::Copy::Recursive
  26. - String::ShellQuote
  27. - Sort::Versions
  28. - Digest::SHA
  29. - Data::UUID
  30. - Data::Dump
  31. If you are running Debian or Ubuntu, you can install them with:
  32. # apt-get install libyaml-libyaml-perl libtemplate-perl \
  33. libio-handle-util-perl libio-all-perl \
  34. libio-captureoutput-perl libpath-tiny-perl \
  35. libstring-shellquote-perl libsort-versions-perl \
  36. libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \
  37. libfile-copy-recursive-perl git libgtk2.0-dev curl runc
  38. The build system is based on rbm, which is included as a git submodule
  39. in the rbm/ directory. You can fetch the rbm git submodule by running
  40. 'make submodule-update'.
  41. Starting a build
  42. ----------------
  43. To start a build, run one of the following commands, depending on the
  44. channel you want to build:
  45. $ make release
  46. $ make alpha
  47. $ make nightly
  48. $ make alpha_nightly
  49. You can find the build result in the directory release/unsigned/$version
  50. or alpha/unsigned/$version for release or alpha builds. The result of
  51. nightly or alpha_nightly can be found in the nightly/$date or
  52. alpha_nightly/$date directory.
  53. The alpha and alpha_nightly make target will build the same thing. The
  54. only difference is the output directory. The alpha_nightly target can be
  55. useful if you want to do a test build without polluting your alpha
  56. directory.
  57. If you want to build for a specific platform only, append the platform
  58. name to the makefile target:
  59. $ make nightly-linux-x86_64
  60. $ make nightly-linux-i686
  61. $ make nightly-windows-i686
  62. $ make nightly-osx-x86_64
  63. When you want to quickly do a build to test a change, you can use the
  64. testbuild makefile target, and find the build in the testbuild directory.
  65. The build will be the same as regular alpha builds, except that in order
  66. to make the build faster, only the en-US locale will be built, and no
  67. mar file will be created.
  68. Updating git sources
  69. --------------------
  70. You can run "make fetch" to fetch the latest sources from git for all
  71. components included in Tor Browser. You should run this if you want to
  72. make a nightly build with the latest commits, and you disabled automatic
  73. fetching of new commits for nightly builds in rbm.local.conf.
  74. Number of make processes
  75. ------------------------
  76. By default the builds are run with 4 processes simultaneously (with
  77. make -j4). If you want to change the number of processes used, you can
  78. set the RBM_NUM_PROCS environment variable:
  79. $ export RBM_NUM_PROCS=8
  80. You can also set the buildconf/num_procs option in rbm.local.conf.
  81. Automated builds
  82. ----------------
  83. If the build fails, a shell will automatically open in the build
  84. container to help you debug the problem. You probably want to disable
  85. this if you want to do automated builds. To disable this, set
  86. the RBM_NO_DEBUG environment variable to 1:
  87. export RBM_NO_DEBUG=1
  88. Or set the debug option to 0 in the rbm.local.conf file.
  89. If you want to select the output directory, you can use rbm's --output-dir
  90. option. You can look at the Makefile to find the rbm command for what
  91. you want to build, and add the --output-dir option. For example, if you
  92. want to build Tor Browser nightly for linux-x86_64:
  93. ./rbm/rbm build release --output-dir=/var/builds/nightly/2017-01-23 \
  94. --target nightly --target torbrowser-linux-x86_64
  95. The files will be put in the directory selected by --output-dir in a
  96. subdirectory named as the version number (or current date for nightly).
  97. To remove this version subdirectory, add the noversiondir target:
  98. ./rbm/rbm build release --output-dir=/var/builds/nightly/2017-01-23 \
  99. --target nightly --target torbrowser-linux-x86_64 \
  100. --target noversiondir
  101. Automated builds using tbb-testsuite
  102. ------------------------------------
  103. The Tor Browser testsuite scripts can also be used to do nightly builds
  104. and publish the build logs. The recommended way to do that is to use
  105. the ansible roles from the tools/ansible directory. See next section
  106. for details.
  107. Using ansible to set up a nightly build machine
  108. -----------------------------------------------
  109. The directory tools/ansible contains some ansible roles to set up a
  110. nightly build machine. You can look at the playbook defined in
  111. boklm-tbb-nightly-build.yml and variables in group_vars/boklm-tbb-nightly/
  112. for an example of how it can be used.
  113. Signing builds
  114. --------------
  115. If the environment variable RBM_SIGN_BUILD is set to 1, the
  116. sha256sums-unsigned-build.txt file will be signed with gpg.
  117. You can use the RBM_GPG_OPTS environment variable to add some options
  118. to the gpg command used to sign the file. You can also set the
  119. var/sign_build and var/sign_build_gpg_opts options in the rbm.local.conf
  120. file.
  121. Cleaning obsolete files and containers images
  122. ---------------------------------------------
  123. You can run 'make clean' to clean old build files and containers that
  124. are no longer used in current builds. Before doing that, you need to
  125. configure the branches and build targets you are using in the
  126. rbm.local.conf file. The cleaning script will check out all the configured
  127. branches to create a list of used build files, and delete the files
  128. from the 'out' directory that are not used. If you want to see the list
  129. of files and containers that would be removed without doing it, you can
  130. use 'make clean-dry-run'.
  131. Common Build Errors
  132. -------------------
  133. You can look at the README.BUILD_ERRORS file for a list of common build
  134. errors and their solutions.
  135. Hacking on the Tor Browser build
  136. --------------------------------
  137. The file README.HACKING tries to list the main things to know when
  138. making changes to the Tor Browser build.
  139. Description of makefile rules
  140. -----------------------------
  141. You can find a description of the makefile rules in the README.MAKEFILE
  142. file.