README 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. Some components are downloaded using mercurial which also
  14. needs 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. - JSON
  23. - File::Temp
  24. - Path::Tiny
  25. - File::Path
  26. - File::Copy::Recursive
  27. - String::ShellQuote
  28. - Sort::Versions
  29. - Digest::SHA
  30. - Data::UUID
  31. - Data::Dump
  32. If you are running Debian or Ubuntu, you can install them with:
  33. # apt-get install libyaml-libyaml-perl libtemplate-perl \
  34. libio-handle-util-perl libio-all-perl \
  35. libio-captureoutput-perl libjson-perl libpath-tiny-perl \
  36. libstring-shellquote-perl libsort-versions-perl \
  37. libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \
  38. libfile-copy-recursive-perl git runc \
  39. mercurial
  40. The build system is based on rbm, which is included as a git submodule
  41. in the rbm/ directory. You can fetch the rbm git submodule by running
  42. 'make submodule-update'.
  43. Starting a build
  44. ----------------
  45. To start a build, run one of the following commands, depending on the
  46. channel you want to build:
  47. $ make release
  48. $ make alpha
  49. $ make nightly
  50. $ make alpha_nightly
  51. You can find the build result in the directory release/unsigned/$version
  52. or alpha/unsigned/$version for release or alpha builds. The result of
  53. nightly or alpha_nightly can be found in the nightly/$date or
  54. alpha_nightly/$date directory.
  55. The alpha and alpha_nightly make target will build the same thing. The
  56. only difference is the output directory. The alpha_nightly target can be
  57. useful if you want to do a test build without polluting your alpha
  58. directory.
  59. If you want to build for a specific platform only, append the platform
  60. name to the makefile target:
  61. $ make nightly-linux-x86_64
  62. $ make nightly-linux-i686
  63. $ make nightly-windows-i686
  64. $ make nightly-osx-x86_64
  65. $ make nightly-android-armv7
  66. $ make nightly-android-aarch64
  67. $ make nightly-android-x86
  68. $ make nightly-android-x86_64
  69. When you want to quickly do a build to test a change, you can use the
  70. testbuild makefile target, and find the build in the testbuild directory.
  71. The build will be the same as regular alpha builds, except that in order
  72. to make the build faster, only the en-US locale will be built, and no
  73. mar file will be created.
  74. Updating git sources
  75. --------------------
  76. You can run "make fetch" to fetch the latest sources from git for all
  77. components included in Tor Browser. You should run this if you want to
  78. make a nightly build with the latest commits, and you disabled automatic
  79. fetching of new commits for nightly builds in rbm.local.conf.
  80. Number of make processes
  81. ------------------------
  82. By default the builds are run with 4 processes simultaneously (with
  83. make -j4). If you want to change the number of processes used, you can
  84. set the RBM_NUM_PROCS environment variable:
  85. $ export RBM_NUM_PROCS=8
  86. You can also set the buildconf/num_procs option in rbm.local.conf.
  87. Automated builds
  88. ----------------
  89. If the build fails, a shell will automatically open in the build
  90. container to help you debug the problem. You probably want to disable
  91. this if you want to do automated builds. To disable this, set
  92. the RBM_NO_DEBUG environment variable to 1:
  93. export RBM_NO_DEBUG=1
  94. Or set the debug option to 0 in the rbm.local.conf file.
  95. If you want to select the output directory, you can use rbm's --output-dir
  96. option. You can look at the Makefile to find the rbm command for what
  97. you want to build, and add the --output-dir option. For example, if you
  98. want to build Tor Browser nightly for linux-x86_64:
  99. ./rbm/rbm build release --output-dir=/var/builds/nightly/2017-01-23 \
  100. --target nightly --target torbrowser-linux-x86_64
  101. The files will be put in the directory selected by --output-dir in a
  102. subdirectory named as the version number (or current date for nightly).
  103. To remove this version subdirectory, add the noversiondir target:
  104. ./rbm/rbm build release --output-dir=/var/builds/nightly/2017-01-23 \
  105. --target nightly --target torbrowser-linux-x86_64 \
  106. --target noversiondir
  107. Automated builds using tbb-testsuite
  108. ------------------------------------
  109. The Tor Browser testsuite scripts can also be used to do nightly builds
  110. and publish the build logs. The recommended way to do that is to use
  111. the ansible roles from the tools/ansible directory. See next section
  112. for details.
  113. Using ansible to set up a nightly build machine
  114. -----------------------------------------------
  115. The directory tools/ansible contains some ansible roles to set up a
  116. nightly build machine. You can look at the playbook defined in
  117. boklm-tbb-nightly-build.yml and variables in group_vars/boklm-tbb-nightly/
  118. for an example of how it can be used.
  119. Signing builds
  120. --------------
  121. If the environment variable RBM_SIGN_BUILD is set to 1, the
  122. sha256sums-unsigned-build.txt file will be signed with gpg.
  123. You can use the RBM_GPG_OPTS environment variable to add some options
  124. to the gpg command used to sign the file. You can also set the
  125. var/sign_build and var/sign_build_gpg_opts options in the rbm.local.conf
  126. file.
  127. Cleaning obsolete files and containers images
  128. ---------------------------------------------
  129. You can run 'make clean' to clean old build files and containers that
  130. are no longer used in current builds. Before doing that, you need to
  131. configure the branches and build targets you are using in the
  132. rbm.local.conf file. The cleaning script will check out all the configured
  133. branches to create a list of used build files, and delete the files
  134. from the 'out' directory that are not used. If you want to see the list
  135. of files and containers that would be removed without doing it, you can
  136. use 'make clean-dry-run'.
  137. Building without containers (Android builds only)
  138. -------------------------------------------------
  139. By default the build is done inside containers. Adding the no_containers
  140. target will disable the use of containers. The following commands can
  141. be used to build the alpha version for android-armv7 and android-x86:
  142. ./rbm/rbm build release --target no_containers --target testbuild \
  143. --target torbrowser-android-armv7
  144. ./rbm/rbm build release --target no_containers --target testbuild \
  145. --target torbrowser-android-x86
  146. Note: the logs will still show the use and creation of a container image
  147. called "containers_disabled". This is due to the way we disable the use
  148. of containers: the container-image project is still called, but it will
  149. just create an empty file instead of a real container image.
  150. The build without containers is currently only supported for the Android
  151. builds, and will require that you run Debian Stretch and install build
  152. dependencies for all the components that are built. This can be done
  153. with the following command:
  154. # apt-get install build-essential python automake libtool zip unzip
  155. autoconf2.13 openjdk-8-jdk gettext-base autotools-dev \
  156. automake autoconf libtool autopoint libssl-dev \
  157. pkg-config zlib1g-dev libparallel-forkmanager-perl \
  158. libfile-slurp-perl bzip2 xz-utils apksigner yasm
  159. Common Build Errors
  160. -------------------
  161. You can look at the README.BUILD_ERRORS file for a list of common build
  162. errors and their solutions.
  163. Hacking on the Tor Browser build
  164. --------------------------------
  165. The file README.HACKING tries to list the main things to know when
  166. making changes to the Tor Browser build.
  167. Description of makefile rules
  168. -----------------------------
  169. You can find a description of the makefile rules in the README.MAKEFILE
  170. file.