[tbb-commits] [tor-browser-build/master] Bug 21998: add option for debug builds

gk at torproject.org gk at torproject.org
Wed Dec 6 13:06:24 UTC 2017


commit 055e751493bedd4914605f418aee590ba79f96d7
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Thu Nov 23 14:47:13 2017 +0100

    Bug 21998: add option for debug builds
---
 Makefile                                            | 12 ++++++++++++
 README.MAKEFILE                                     |  4 ++++
 projects/firefox/build                              |  6 ++++++
 projects/release/config                             |  6 +++++-
 projects/tor-browser/RelativeLink/start-tor-browser |  7 +++++++
 projects/tor-browser/build                          |  4 ++++
 projects/tor-browser/config                         |  4 +++-
 projects/tor/build                                  |  1 +
 rbm.conf                                            |  7 +++++++
 9 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 54965ef..2707d41 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,9 @@ release: submodule-update
 release-linux-x86_64: submodule-update
 	$(rbm) build release --target release --target torbrowser-linux-x86_64
 
+release-linux-x86_64-debug: submodule-update
+	$(rbm) build release --target release --target torbrowser-linux-x86_64-debug
+
 release-linux-i686: submodule-update
 	$(rbm) build release --target release --target torbrowser-linux-i686
 
@@ -26,6 +29,9 @@ alpha: submodule-update
 alpha-linux-x86_64: submodule-update
 	$(rbm) build release --target alpha --target torbrowser-linux-x86_64
 
+alpha-linux-x86_64-debug: submodule-update
+	$(rbm) build release --target alpha --target torbrowser-linux-x86_64-debug
+
 alpha-linux-i686: submodule-update
 	$(rbm) build release --target alpha --target torbrowser-linux-i686
 
@@ -44,6 +50,9 @@ nightly: submodule-update
 nightly-linux-x86_64: submodule-update
 	$(rbm) build release --target nightly --target torbrowser-linux-x86_64
 
+nightly-linux-x86_64-debug: submodule-update
+	$(rbm) build release --target nightly --target torbrowser-linux-x86_64-debug
+
 nightly-linux-i686: submodule-update
 	$(rbm) build release --target nightly --target torbrowser-linux-i686
 
@@ -80,6 +89,9 @@ testbuild: submodule-update
 testbuild-linux-x86_64: submodule-update
 	$(rbm) build release --target testbuild --target torbrowser-linux-x86_64
 
+testbuild-linux-x86_64-debug: submodule-update
+	$(rbm) build release --target testbuild --target torbrowser-linux-x86_64-debug
+
 testbuild-linux-i686: submodule-update
 	$(rbm) build release --target testbuild --target torbrowser-linux-i686
 
diff --git a/README.MAKEFILE b/README.MAKEFILE
index 98137b2..8094651 100644
--- a/README.MAKEFILE
+++ b/README.MAKEFILE
@@ -50,6 +50,10 @@ locale is created, without mar files. By default it is based on the
 alpha channel, but you can change that by editing rbm.conf.local.
 The resulting build can be found in directory testbuild.
 
+{release,alpha,nightly,testbuild}-linux-x86_64-debug
+----------------------------------------------------
+Create a debug build for Linux x86_64 with debug features such as ASan.
+
 fetch
 -----
 Fetch new commits from all components. This is useful when you want to
diff --git a/projects/firefox/build b/projects/firefox/build
index 13142e0..ed559b0 100644
--- a/projects/firefox/build
+++ b/projects/firefox/build
@@ -49,6 +49,12 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
 
 cd /var/tmp/build/[% project %]-[% c("version") %]
 mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
+[% IF c("var/asan") -%]
+  mv -f .mozconfig-asan .mozconfig
+  # Without disabling LSan our build is blowing up:
+  # https://bugs.torproject.org/10599#comment:52
+  export ASAN_OPTIONS="detect_leaks=0"
+[% END -%]
 
 eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] $(cat browser/config/version.txt))
 if [ -z $MOZ_BUILD_DATE ]
diff --git a/projects/release/config b/projects/release/config
index 674ec80..e53ea43 100644
--- a/projects/release/config
+++ b/projects/release/config
@@ -17,6 +17,10 @@ targets:
   torbrowser-linux-x86_64:
     var:
       torbrowser-linux-x86_64: 1
+  torbrowser-linux-x86_64-debug:
+    var:
+      torbrowser-linux-x86_64: 1
+      debug-build: '-debug'
   torbrowser-linux-i686:
     var:
       torbrowser-linux-i686: 1
@@ -77,7 +81,7 @@ input_files:
    enable: '[% c("var/torbrowser-linux-x86_64") %]'
    target:
      - '[% c("var/build_target") %]'
-     - torbrowser-linux-x86_64
+     - 'torbrowser-linux-x86_64[% c("var/debug-build") %]'
 
  - name: sandbox-linux-x86_64
    project: sandbox
diff --git a/projects/tor-browser/RelativeLink/start-tor-browser b/projects/tor-browser/RelativeLink/start-tor-browser
index 2dd40fc..94a8c99 100755
--- a/projects/tor-browser/RelativeLink/start-tor-browser
+++ b/projects/tor-browser/RelativeLink/start-tor-browser
@@ -272,6 +272,13 @@ LD_LIBRARY_PATH="${HOME}/TorBrowser/Tor/"
 export LD_LIBRARY_PATH
 export SELFRANDO_write_layout_file=
 
+[% IF c("var/asan") -%]
+# We need to disable LSan which is enabled by default now. Otherwise we'll get
+# a crash during shutdown: https://bugs.torproject.org/10599#comment:59
+ASAN_OPTIONS="detect_leaks=0"
+export ASAN_OPTIONS
+[% END -%]
+
 function setControlPortPasswd() {
     local ctrlPasswd=$1
 
diff --git a/projects/tor-browser/build b/projects/tor-browser/build
index 56d6294..f8f1356 100644
--- a/projects/tor-browser/build
+++ b/projects/tor-browser/build
@@ -70,6 +70,10 @@ tar -C $TBDIR[% IF c("var/osx") %]/Contents/Resources[% END %] -xf [% c('input_f
 [% IF c("var/linux") %]
   cp RelativeLink/* ${TB_STAGE_DIR}/Browser/
   cp RelativeLink/start-tor-browser.desktop ${TB_STAGE_DIR}/
+  cat > ${TB_STAGE_DIR}/Browser/start-tor-browser << 'RBM_TB_EOF'
+[% INCLUDE 'RelativeLink/start-tor-browser' -%]
+RBM_TB_EOF
+  chmod +x ${TB_STAGE_DIR}/Browser/start-tor-browser
 [% END %]
 
 tar -C ${TB_STAGE_DIR} -xf [% c('input_files_by_name/firefox') %]/tor-browser.tar.gz
diff --git a/projects/tor-browser/config b/projects/tor-browser/config
index eb0a5d0..42f77e4 100644
--- a/projects/tor-browser/config
+++ b/projects/tor-browser/config
@@ -69,7 +69,9 @@ input_files:
   - URL: https://addons.cdn.mozilla.net/user-media/addons/722/noscript_security_suite-5.1.7-fx+sm.xpi
     name: noscript
     sha256sum: 617f73683acdca7df2a7d08843443d38929afbf40075e113ab3ccab0eef7cd6b
-  - filename: RelativeLink
+  - filename: 'RelativeLink/start-tor-browser.desktop'
+    enable: '[% c("var/linux") %]'
+  - filename: 'RelativeLink/execdesktop'
     enable: '[% c("var/linux") %]'
   - project: libdmg-hfsplus
     name: libdmg
diff --git a/projects/tor/build b/projects/tor/build
index 24617ce..ac51782 100644
--- a/projects/tor/build
+++ b/projects/tor/build
@@ -57,6 +57,7 @@ cd /var/tmp/build/[% project %]-[% c('version') %]
 ./autogen.sh
 find -type f -print0 | xargs -0 [% c("var/touch") %]
 ./configure --disable-asciidoc --with-libevent-dir="$libeventdir" --with-openssl-dir="$openssldir" \
+    [% IF c("var/asan") %]--enable-fragile-hardening[% END %] \
     [% IF c("var/windows") %]--with-zlib-dir="$zlibdir"[% END %] \
     [% IF c("var/osx") %]--enable-static-openssl[% END %] \
     --prefix="$distdir" [% c("var/configure_opt") %]
diff --git a/rbm.conf b/rbm.conf
index 4f74450..5abc5ff 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -130,6 +130,10 @@ targets:
   torbrowser-linux-x86_64:
     - linux-x86_64
     - linux
+  torbrowser-linux-x86_64-debug:
+    - linux-debug
+    - linux-x86_64
+    - linux
   torbrowser-linux-i686:
     - linux-i686
     - linux
@@ -171,6 +175,9 @@ targets:
         - libtool
         - zip
         - unzip
+  linux-debug:
+    var:
+      asan: 1
 
   torbrowser-windows-i686:
     - windows-i686





More information about the tbb-commits mailing list