[tbb-commits] [tor-browser-build/master] Bug 23075: add an option to select the number of cores used

boklm at torproject.org boklm at torproject.org
Wed Aug 2 16:33:24 UTC 2017


commit 60ba86636df928e97e265417b2c19bea4e85ea3a
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Wed Aug 2 18:23:10 2017 +0200

    Bug 23075: add an option to select the number of cores used
---
 README                        | 12 ++++++++++++
 projects/binutils/build       |  2 +-
 projects/cmake/build          |  2 +-
 projects/elfutils/build       |  2 +-
 projects/firefox/build        |  2 +-
 projects/gcc/build            |  2 +-
 projects/gmp/build            |  2 +-
 projects/libdmg-hfsplus/build |  2 +-
 projects/libevent/build       |  2 +-
 projects/llvm/build           |  2 +-
 projects/mingw-w64/build      |  8 ++++----
 projects/tor/build            |  2 +-
 projects/yasm/build           |  2 +-
 rbm.conf                      |  8 +++++++-
 rbm.local.conf.example        |  8 ++++++++
 15 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/README b/README
index 22fb90b..e5fc45d 100644
--- a/README
+++ b/README
@@ -91,6 +91,18 @@ components included in Tor Browser. You should run this if you want to
 make a nightly build with the latest commits.
 
 
+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
+set the RBM_NB_PROCS environment variable:
+
+  $ export RBM_NB_PROCS=8
+
+You can also set the buildconf/nb_procs option in rbm.local.conf.
+
+
 Automated builds
 ----------------
 
diff --git a/projects/binutils/build b/projects/binutils/build
index b72c41c..cdfd045 100644
--- a/projects/binutils/build
+++ b/projects/binutils/build
@@ -32,7 +32,7 @@ cd [% project %]-[% c("version") %]
   patch -p1 < $rootdir/binutils-224-gold.patch
 [% END -%]
 ./configure --prefix=$distdir [% c('var/configure_opt') %]
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 
 [% IF c("var/linux") %]
diff --git a/projects/cmake/build b/projects/cmake/build
index dd5017a..4a58896 100644
--- a/projects/cmake/build
+++ b/projects/cmake/build
@@ -5,7 +5,7 @@ mkdir -p /var/tmp/build
 tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
 cd /var/tmp/build/[% project %]-[% c('version') %]
 ./bootstrap --prefix=$distdir
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/projects/elfutils/build b/projects/elfutils/build
index 8fdd013..57adf83 100644
--- a/projects/elfutils/build
+++ b/projects/elfutils/build
@@ -13,7 +13,7 @@ tar -C /var/tmp/build -xf $rootdir/[% c('input_files_by_name/elfutils') %]
 
 cd /var/tmp/build/[% project %]-[% c("version") %]
 ./configure --prefix="$distdir"
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 
 cd /var/tmp/dist
diff --git a/projects/firefox/build b/projects/firefox/build
index c35d629..439369e 100644
--- a/projects/firefox/build
+++ b/projects/firefox/build
@@ -90,7 +90,7 @@ rm -f configure
 rm -f js/src/configure
 make -f client.mk configure CONFIGURE_ARGS="--with-tor-browser-version=[% c("var/torbrowser_version") %] --with-distribution-id=org.torproject --enable-update-channel=[% c("var/torbrowser_update_channel") %] --enable-bundled-fonts"
 
-make -j8 -f client.mk build
+make -j[% c("buildconf/nb_procs") %] -f client.mk build
 make -C obj-* package INNER_MAKE_PACKAGE=true
 
 [% IF c("var/osx") %]
diff --git a/projects/gcc/build b/projects/gcc/build
index e2902ad..c7e3ea8 100644
--- a/projects/gcc/build
+++ b/projects/gcc/build
@@ -17,7 +17,7 @@ mkdir /var/tmp/build
 tar -C /var/tmp/build -xf [% project %]-[% c("version") %].tar.bz2
 cd /var/tmp/build/[% project %]-[% c("version") %]
 ./configure --prefix=$distdir [% c("var/configure_opt") %]
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/projects/gmp/build b/projects/gmp/build
index 34173d6..b9ea3bc 100644
--- a/projects/gmp/build
+++ b/projects/gmp/build
@@ -9,7 +9,7 @@ cd /var/tmp/build/[% project %]-[% c('version') %]
 # during compile time.
 ./configure --disable-static --enable-shared --enable-cxx \
     [% c("var/configure_opt") %] [% c("var/configure_opt_gmp") %] --prefix=$distdir
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/projects/libdmg-hfsplus/build b/projects/libdmg-hfsplus/build
index 47a5e43..66e4232 100644
--- a/projects/libdmg-hfsplus/build
+++ b/projects/libdmg-hfsplus/build
@@ -7,7 +7,7 @@ cd [% project %]-[% c('version') %]
 patch -p1 < ../libdmg.patch
 cmake -DCMAKE_INSTALL_PREFIX:PATH=$distdir/[% project %] CMakeLists.txt
 cd dmg
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd $distdir
 [% c('tar', {
diff --git a/projects/libevent/build b/projects/libevent/build
index 0e4e074..d44371d 100644
--- a/projects/libevent/build
+++ b/projects/libevent/build
@@ -11,7 +11,7 @@ cd /var/tmp/build/[% project %]-[% c('version') %]
   export LD_PRELOAD=[% c("var/faketime_path") %]
   export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]"
 [% END -%]
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/projects/llvm/build b/projects/llvm/build
index 5241944..fc72e38 100644
--- a/projects/llvm/build
+++ b/projects/llvm/build
@@ -21,7 +21,7 @@ export LLVM_HOME=$(pwd)
 mkdir build
 cd build
 cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir -DCMAKE_BUILD_TYPE:STRING=Release $LLVM_HOME
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/projects/mingw-w64/build b/projects/mingw-w64/build
index 42ee716..246ade1 100644
--- a/projects/mingw-w64/build
+++ b/projects/mingw-w64/build
@@ -31,25 +31,25 @@ sed 's/msvcrt/msvcr100/' -i gcc-[% c("var/gcc_version") %]/gcc/config/i386/t-min
 # CFLAGS_FOR_TARGET.
 export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase"
 gcc-[% c("var/gcc_version") %]/configure --prefix=$distdir --target=i686-w64-mingw32 --disable-multilib --enable-languages=c,c++
-make -j4 all-gcc
+make -j[% c("buildconf/nb_procs") %] all-gcc
 make install-gcc
 
 mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
 cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
 /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
                  --host=i686-w64-mingw32 --prefix=$distdir/i686-w64-mingw32
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 
 mkdir -p /var/tmp/build/builddir/mingw-w64/widl32
 cd /var/tmp/build/builddir/mingw-w64/widl32
 /var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
                  --prefix=$distdir --target=i686-w64-mingw32
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 
 cd /var/tmp/build/gcc
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 mkdir -p $distdir/gcclibs
 cp i686-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
diff --git a/projects/tor/build b/projects/tor/build
index 85e158f..577c194 100644
--- a/projects/tor/build
+++ b/projects/tor/build
@@ -64,7 +64,7 @@ find -type f -print0 | xargs -0 [% c("var/touch") %]
   export LD_PRELOAD=[% c("var/faketime_path") %]
   export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]"
 [% END -%]
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 [% IF c("var/osx") -%]
   unset LD_PRELOAD
diff --git a/projects/yasm/build b/projects/yasm/build
index 82d037a..b736761 100644
--- a/projects/yasm/build
+++ b/projects/yasm/build
@@ -5,7 +5,7 @@ mkdir -p /var/tmp/build
 tar -C /var/tmp/build -xf $rootdir/[% c('input_files_by_name/yasm') %]
 cd /var/tmp/build/yasm-[% c("version") %]
 ./configure --prefix="$distdir"
-make -j4
+make -j[% c("buildconf/nb_procs") %]
 make install
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/rbm.conf b/rbm.conf
index 31e6a51..ae8c5b2 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -6,6 +6,12 @@ build_log: '[% GET ENV.RBM_LOGS_DIR ? ENV.RBM_LOGS_DIR : "logs" %]/[% project %]
 
 pkg_type: build
 
+# buildconf contains build options that the user can change in rbm.local.conf
+# When adding a new option to buildconf, a default value should be defined
+# in var/build_id, so that changing this option does not affect the build_id.
+buildconf:
+  nb_procs: '[% GET ENV.RBM_NB_PROCS ? ENV.RBM_NB_PROCS : "4" %]'
+
 var:
   torbrowser_version: '7.5a3'
   project_name: tor-browser
@@ -16,7 +22,7 @@ var:
   # in the same order. In the cases where the installation order is
   # important, sort_deps should be set to 0.
   sort_deps: 1
-  build_id: '[% sha256(c("var/build_id_txt")).substr(0, 6) %]'
+  build_id: '[% sha256(c("var/build_id_txt", { buildconf => { nb_procs => 4 } })).substr(0, 6) %]'
   build_id_txt: |
     [% c("version") %]
     [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
diff --git a/rbm.local.conf.example b/rbm.local.conf.example
index 203ce5f..5e322cf 100644
--- a/rbm.local.conf.example
+++ b/rbm.local.conf.example
@@ -21,6 +21,14 @@
 ### stdout and stderr.
 #build_log: '-'
 
+buildconf:
+  buildconf: 1
+
+  ### The buildconf/nb_procs option can be used to select the number of
+  ### build processes to run simultaneously. You can also use the
+  ### RBM_NB_PROCS environment variable. The default is 4.
+  #nb_procs: 8
+
 var:
   local_conf: 1
 





More information about the tbb-commits mailing list