[tbb-commits] [tor-browser-build/master] Bug 26323: Build 32bit Linux bundles on 64bit Debian Wheezy

gk at torproject.org gk at torproject.org
Tue Mar 12 20:16:03 UTC 2019


commit a76388bf16a6ff28f4427b47198c20c4aa8c113a
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Fri Feb 1 14:09:53 2019 +0100

    Bug 26323: Build 32bit Linux bundles on 64bit Debian Wheezy
---
 projects/binutils/build               |  2 --
 projects/firefox/config               | 23 +++++++++++++++++++----
 projects/firefox/mozconfig-linux-i686 |  2 ++
 projects/gcc/config                   | 15 ++-------------
 projects/go-webrtc/config             |  7 ++++++-
 projects/go/config                    |  3 +++
 projects/libfte/build                 |  7 ++++++-
 projects/libfte/config                | 21 ++++++++++++++++++++-
 projects/pycrypto/build               |  4 ++--
 projects/pycrypto/config              | 20 +++++++++++++++++++-
 projects/rust/config                  | 14 ++++++++++----
 projects/snowflake/config             |  7 ++++++-
 projects/tor/build                    |  7 ++++---
 projects/tor/config                   | 13 ++++++++-----
 projects/twisted/build                | 12 ++++++++----
 projects/twisted/config               | 22 ++++++++++++++++++++--
 projects/webrtc/config                | 30 ++++++++++++++++++++++--------
 rbm.conf                              | 16 ++++++----------
 18 files changed, 163 insertions(+), 62 deletions(-)

diff --git a/projects/binutils/build b/projects/binutils/build
index ee22a1c..6c01d27 100644
--- a/projects/binutils/build
+++ b/projects/binutils/build
@@ -8,8 +8,6 @@ distdir=/var/tmp/dist/binutils
   export DEB_BUILD_HARDENING_FORTIFY=1
   export DEB_BUILD_HARDENING_FORMAT=1
   export DEB_BUILD_HARDENING_PIE=1
-[% END -%]
-[% IF c("var/linux-x86_64") %]
   # The libstdc++ shipped by default is non-PIC which breaks the binutils build
   # if we build with DEB_BUILD_HARDENING_PIE=1. We need to install a PIC one AND
   # make sure it gets used before the non-PIC one would.
diff --git a/projects/firefox/config b/projects/firefox/config
index 2f40fe2..a56f3f9 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -58,8 +58,9 @@ targets:
       arch_deps:
         - openjdk-8-jdk
 
-  linux:
+  linux-x86_64:
     var:
+      martools_filename: mar-tools-linux64.zip
       arch_deps:
         - libgtk2.0-dev
         - libgtk-3-dev
@@ -76,13 +77,27 @@ targets:
         - libmpc2
         # needed to remove RUNPATH added by selfrando (see #22242)
         - chrpath
-  linux-x86_64:
-    var:
-      martools_filename: mar-tools-linux64.zip
 
   linux-i686:
     var:
       martools_filename: mar-tools-linux32.zip
+      sort_deps: 0
+      arch_deps:
+        - libgtk2.0-dev:i386
+        - libgtk-3-dev:i386
+        - libdbus-glib-1-dev:i386
+        - libxt-dev:i386
+        # To pass configure since ESR 31.
+        - libpulse-dev:i386
+        # To pass configure since ESR 45.
+        - libgconf2-dev:i386
+        # To pass configure since ESR 52
+        - libx11-xcb-dev:i386
+        # We built GCC but not the libmpc2, thus we need to install it
+        - libmpc2
+        # needed to remove RUNPATH added by selfrando (see #22242)
+        - chrpath
+        - hardening-wrapper
 
   osx-x86_64:
     var:
diff --git a/projects/firefox/mozconfig-linux-i686 b/projects/firefox/mozconfig-linux-i686
index ee5082a..abc7b0e 100755
--- a/projects/firefox/mozconfig-linux-i686
+++ b/projects/firefox/mozconfig-linux-i686
@@ -11,7 +11,9 @@ export CXXFLAGS=-m32
 export LDFLAGS=-m32
 export XLDOPTS=-m32
 export ASFLAGS=-m32
+export BINDGEN_CFLAGS='-m32 --gcc-toolchain=/var/tmp/dist/gcc'
 
+ac_add_options --target=i686-linux-gnu
 ac_add_options --host=i686-linux-gnu
 
 ac_add_options --enable-optimize
diff --git a/projects/gcc/config b/projects/gcc/config
index b13a738..88dabdd 100644
--- a/projects/gcc/config
+++ b/projects/gcc/config
@@ -12,11 +12,7 @@ var:
     mkdir -p /var/tmp/dist
     tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
     export PATH="/var/tmp/dist/gcc/bin:$PATH"
-    [% IF c("var/osname") == "linux-i686" -%]
-    export LD_LIBRARY_PATH=/var/tmp/dist/gcc/lib
-    [% ELSE -%]
-    export LD_LIBRARY_PATH=/var/tmp/dist/gcc/lib64
-    [% END -%]
+    export LD_LIBRARY_PATH=/var/tmp/dist/gcc/lib64:/var/tmp/dist/gcc/lib32
 
     [% IF c("hardened_gcc") -%]
       # Config options for hardening-wrapper
@@ -47,19 +43,12 @@ targets:
         - zlib1g-dev
   linux:
     hardened_gcc: 1
-  linux-i686:
-    var:
-      configure_opt: --enable-multilib --enable-languages=c,c++ --with-system-zlib
-      arch_deps:
-        - hardening-wrapper
-        - libc6-dev
-        - zlib1g-dev
-  linux-x86_64:
     var:
       configure_opt: --enable-multilib --enable-languages=c,c++ --with-arch_32=i686
       arch_deps:
         - hardening-wrapper
         - libc6-dev-i386
+
 input_files:
   - project: container-image
   - URL: 'https://ftp.gnu.org/gnu/gcc/gcc-[% c("version") %]/gcc-[% c("version") %].tar.xz'
diff --git a/projects/go-webrtc/config b/projects/go-webrtc/config
index 8136122..5dbee5f 100644
--- a/projects/go-webrtc/config
+++ b/projects/go-webrtc/config
@@ -35,7 +35,12 @@ var:
     [% END -%]
 
 targets:
-  linux:
+  linux-i686:
+    var:
+      arch_deps:
+        - pkg-config
+        - libx11-dev:i386
+  linux-x86_64:
     var:
       arch_deps:
         - pkg-config
diff --git a/projects/go/config b/projects/go/config
index be9f84d..ab0a6d3 100644
--- a/projects/go/config
+++ b/projects/go/config
@@ -15,6 +15,9 @@ var:
     export GOARCH=[% c("var/GOARCH") %]
     export GOPATH=/var/tmp/dist/gopath
     export PATH=/var/tmp/dist/go/bin:/var/tmp/dist/gopath/bin:"$PATH"
+    [% IF c("var/linux-i686") -%]
+      export CGO_ENABLED=1
+    [% END -%]
 
   # Template build script for building a go library.
   # This can be called as projects/go/var/build_go_lib.
diff --git a/projects/libfte/build b/projects/libfte/build
index 5d62453..3eaeadb 100644
--- a/projects/libfte/build
+++ b/projects/libfte/build
@@ -12,6 +12,11 @@ tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/gmp') %]
 ln -s /var/tmp/dist/gmp thirdparty/gmp
 mkdir -p $distdir
 tar -C $distdir -xf $rootdir/[% c('input_files_by_name/obfsproxy') %]
+[% IF c("var/linux-i686") -%]
+  export CFLAGS=-m32
+  export CXXFLAGS=-m32
+  export LDFLAGS=-m32
+[% END -%]
 [% IF c("var/windows") -%]
   patch -p1 < $rootdir/bug20302.patch
   pydir=$distdir/python
@@ -25,7 +30,7 @@ tar -C $distdir -xf $rootdir/[% c('input_files_by_name/obfsproxy') %]
   $PYTHON setup.py install --prefix=$(wine winepath -w "$pydir")
   $PYTHON setup.py install
 [% ELSE -%]
-  export PYTHON=python2
+  export PYTHON=python2[% IF c("var/linux-i686") %].7[% END %]
   make
   cp -ra fte $PTDIR/
   mkdir -p $PTDIR/fteproxy-lib
diff --git a/projects/libfte/config b/projects/libfte/config
index 2079040..415544f 100644
--- a/projects/libfte/config
+++ b/projects/libfte/config
@@ -9,11 +9,30 @@ var:
     use_container: 1
 
 targets:
-  linux:
+  linux-x86_64:
     var:
       arch_deps:
         - python-setuptools
         - python-dev
+
+  linux-i686:
+    var:
+      pre_pkginst: |
+        dpkg --add-architecture i386
+        # python2.7:i386 cannot be installed because the mime-support package
+        # in wheezy is not marked "Multi-Arch: foreign":
+        # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695357
+        # We fix this by installing the jessie mime-support package.
+        wget http://ftp.debian.org/debian/pool/main/m/mime-support/mime-support_3.58_all.deb
+        echo 'c05ebe8f38da4ff19d028c9f4680414149e5c7a746de13bc9db0a562796ed213  mime-support_3.58_all.deb' | sha256sum -c
+        dpkg -i mime-support_3.58_all.deb
+      post_pkginst: |
+        export DEBIAN_FRONTEND=noninteractive
+        apt-get install -q -y libpython2.7:i386 python2.7:i386 python2.7-minimal:i386 python2.7-dev:i386
+        apt-get install -q -y hardening-wrapper
+        apt-get download -q -y python-setuptools python-pkg-resources
+        dpkg -i --force-depends python-setuptools*.deb python-pkg-resources*.deb
+
   windows-i686:
     var:
       compiler: winpython
diff --git a/projects/pycrypto/build b/projects/pycrypto/build
index 084939f..ecb9bb8 100644
--- a/projects/pycrypto/build
+++ b/projects/pycrypto/build
@@ -29,9 +29,9 @@ cd /var/tmp/build/[% project %]-[% c('version') %]
   $PYTHON setup.py build_ext -c mingw32
   $PYTHON setup.py install --prefix=$(wine winepath -w $pydir)
 [% ELSE -%]
-  export PYTHON=python2
+  export PYTHON=python2[% IF c("var/linux-i686") %].7[% END %]
   ./configure --build=i686-linux-gnu [% c("var/configure_opt") %]
-  python2 setup.py build --build-lib build
+  $PYTHON setup.py build --build-lib build
   cp -a build/Crypto $PTDIR/
 [% END -%]
 cd $distdir
diff --git a/projects/pycrypto/config b/projects/pycrypto/config
index c55844b..879484f 100644
--- a/projects/pycrypto/config
+++ b/projects/pycrypto/config
@@ -6,12 +6,30 @@ var:
     use_container: 1
 
 targets:
-  linux:
+  linux-x86_64:
     var:
       arch_deps:
         - python-dev
         - python-setuptools
 
+  linux-i686:
+    var:
+      pre_pkginst: |
+        dpkg --add-architecture i386
+        # python2.7:i386 cannot be installed because the mime-support package
+        # in wheezy is not marked "Multi-Arch: foreign":
+        # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695357
+        # We fix this by installing the jessie mime-support package.
+        wget http://ftp.debian.org/debian/pool/main/m/mime-support/mime-support_3.58_all.deb
+        echo 'c05ebe8f38da4ff19d028c9f4680414149e5c7a746de13bc9db0a562796ed213  mime-support_3.58_all.deb' | sha256sum -c
+        dpkg -i mime-support_3.58_all.deb
+      post_pkginst: |
+        export DEBIAN_FRONTEND=noninteractive
+        apt-get install -q -y libpython2.7:i386 python2.7:i386 python2.7-minimal:i386 python2.7-dev:i386
+        apt-get install -q -y hardening-wrapper
+        apt-get download -q -y python-setuptools python-pkg-resources
+        dpkg -i --force-depends python-setuptools*.deb python-pkg-resources*.deb
+
   windows-i686:
     var:
       compiler: winpython
diff --git a/projects/rust/config b/projects/rust/config
index 3d78ad3..0c3b280 100644
--- a/projects/rust/config
+++ b/projects/rust/config
@@ -1,5 +1,5 @@
 # vim: filetype=yaml sw=2
-filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz'
+filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
 version: '[% c("input_file_var/rust_version") %]'
 
 # those values can be changed from the input_files section of other
@@ -32,10 +32,16 @@ targets:
 
   linux:
     var:
-      arch_deps:
-        - hardening-wrapper
+      rust_arch: x86_64
+      deps:
+        - libc6-dev-i386
+        - lib32stdc++6
+        - build-essential
+        - python
+        - automake
         - libssl-dev
         - pkg-config
+        - hardening-wrapper
       # We use
       # `--enable-local-rust` to avoid downloading the required compiler during
       # build time
@@ -62,7 +68,7 @@ targets:
       # version mismatch. We avoid that with this configure option. We need to
       # build our own GCC in the first place as 4.7.2 is too old to get all the
       # Rust pieces compiled.
-      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=[% c("arch") %]-unknown-linux-gnu --set=target.[% c("arch") %]-unknown-linux-gnu.cc=gcc
+      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set=target.x86_64-unknown-linux-gnu.cc=gcc --set=target.i686-unknown-linux-gnu.cc=gcc
 
   osx-x86_64:
     var:
diff --git a/projects/snowflake/config b/projects/snowflake/config
index c9a84b3..7043c12 100644
--- a/projects/snowflake/config
+++ b/projects/snowflake/config
@@ -9,7 +9,12 @@ var:
     use_container: 1
 
 targets:
-  linux:
+  linux-i686:
+    var:
+      arch_deps:
+        - pkg-config
+        - libx11-dev:i386
+  linux-x86_64:
     var:
       arch_deps:
         - pkg-config
diff --git a/projects/tor/build b/projects/tor/build
index d6018d9..0860b6f 100644
--- a/projects/tor/build
+++ b/projects/tor/build
@@ -44,6 +44,9 @@ openssldir=/var/tmp/dist/openssl
       $gcclibs/*.dll $mingwlibs/libwinpthread-1.dll $distdir/Tor/
 [% END %]
 
+[% IF c("var/linux-i686") && c("var/nightly") -%]
+  export TOR_RUST_TARGET=i686-unknown-linux-gnu
+[% END -%]
 [% IF c("var/linux") %]
   mkdir -p "$distdir/Debug/Tor"
   cp $openssldir/lib/libssl.so.1.0.0 "$distdir/Tor/"
@@ -64,9 +67,7 @@ openssldir=/var/tmp/dist/openssl
   chmod 700 "$distdir"/Tor/*.so*
   chmod 700 "$distdir"/Tor/libstdc++/*.so*
   # This is needed to make RPATH unavailable. See bug 9150.
-  export LD_LIBRARY_PATH="$distdir/Tor/"
-  # Add libstdc++ to LD_LIBRARY_PATH to avoid rust link issue (bug 27101)
-  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$distdir/Tor/libstdc++/"
+  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$distdir/Tor/"
 [% END %]
 
 [% IF c("var/osx") %]
diff --git a/projects/tor/config b/projects/tor/config
index ffdb200..9eb4c16 100644
--- a/projects/tor/config
+++ b/projects/tor/config
@@ -22,18 +22,21 @@ targets:
     git_hash: master
     tag_gpg_id: 0
 
-  linux:
+  linux-i686:
     var:
+      libdir: lib32
+      sort_deps: 0
       arch_deps:
         - libtool
-        - zlib1g-dev
+        - zlib1g-dev:i386
         - hardening-wrapper
-  linux-i686:
-    var:
-      libdir: lib
   linux-x86_64:
     var:
       libdir: lib64
+      arch_deps:
+        - libtool
+        - zlib1g-dev
+        - hardening-wrapper
   osx-x86_64:
     var:
       arch_deps:
diff --git a/projects/twisted/build b/projects/twisted/build
index 077143c..9aebe24 100644
--- a/projects/twisted/build
+++ b/projects/twisted/build
@@ -1,15 +1,19 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
 distdir="/var/tmp/dist/[% project %]"
-[% IF c("var/windows") -%]
-  [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
-[% ELSE -%]
+[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+[% IF ! c("var/windows") -%]
   [% c("var/set_PTDIR_DOCSDIR") -%]
   mkdir -p $PTDIR
 [% END -%]
 mkdir -p /var/tmp/build
 tar -C /var/tmp/build -xf $rootdir/Twisted-[% c('version') %].tar.bz2
 cd /var/tmp/build/Twisted-[% c('version') %]
+[% IF c("var/linux-i686") -%]
+  export CFLAGS=-m32
+  export CXXFLAGS=-m32
+  export LDFLAGS=-m32
+[% END -%]
 [% IF c("var/windows") -%]
   pydir="$distdir/python"
   export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]"
@@ -27,7 +31,7 @@ cd /var/tmp/build/Twisted-[% c('version') %]
   export PYTHONPATH="$(wine winepath -w $pydir)\\Lib\\site-packages"
   LD_PRELOAD= $PYTHON setup.py install --single-version-externally-managed --record /dev/null --prefix=$(wine winepath -w $pydir)
 [% ELSE -%]
-  export PYTHON=python2
+  export PYTHON=python2[% IF c("var/linux-i686") %].7[% END %]
   $PYTHON setup.py build --build-lib build
   cp -a build/twisted $PTDIR/
 [% END -%]
diff --git a/projects/twisted/config b/projects/twisted/config
index 4dbbb26..d9a7eeb 100644
--- a/projects/twisted/config
+++ b/projects/twisted/config
@@ -7,11 +7,30 @@ var:
     use_container: 1
 
 targets:
-  linux:
+  linux-x86_64:
     var:
       arch_deps:
         - python-setuptools
         - python-dev
+
+  linux-i686:
+    var:
+      pre_pkginst: |
+        dpkg --add-architecture i386
+        # python2.7:i386 cannot be installed because the mime-support package
+        # in wheezy is not marked "Multi-Arch: foreign":
+        # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695357
+        # We fix this by installing the jessie mime-support package.
+        wget http://ftp.debian.org/debian/pool/main/m/mime-support/mime-support_3.58_all.deb
+        echo 'c05ebe8f38da4ff19d028c9f4680414149e5c7a746de13bc9db0a562796ed213  mime-support_3.58_all.deb' | sha256sum -c
+        dpkg -i mime-support_3.58_all.deb
+      post_pkginst: |
+        export DEBIAN_FRONTEND=noninteractive
+        apt-get install -q -y libpython2.7:i386 python2.7:i386 python2.7-minimal:i386 python2.7-dev:i386
+        apt-get install -q -y hardening-wrapper
+        apt-get download -q -y python-setuptools python-pkg-resources
+        dpkg -i --force-depends python-setuptools*.deb python-pkg-resources*.deb
+
   windows-i686:
     var:
       compiler: winpython
@@ -26,4 +45,3 @@ input_files:
     sha256sum: 095175638c019ac7c0604f4c291724a16ff1acd062e181b01293bf4dcbc62cf3
   - name: '[% c("var/compiler") %]'
     project: '[% c("var/compiler") %]'
-    enable: '[% c("var/windows") %]'
diff --git a/projects/webrtc/config b/projects/webrtc/config
index 37b4615..2846765 100644
--- a/projects/webrtc/config
+++ b/projects/webrtc/config
@@ -28,6 +28,28 @@ targets:
     var:
       webrtc:
         os: linux
+  linux-i686:
+    var:
+      webrtc:
+        lib_path: lib/libwebrtc-linux-386-magic.a
+      sort_deps: 0
+      arch_deps:
+        - lib32asound2-dev
+        - lib64expat1
+        - libexpat1-dev:i386
+        - libglib2.0-dev:i386
+        - libgtk2.0-dev:i386
+        - libgtk-3-dev:i386
+        - libudev-dev:i386
+        - libx11-dev:i386
+        - libxext-dev:i386
+        - libxrandr-dev:i386
+        - pkg-config
+        - hardening-wrapper
+  linux-x86_64:
+    var:
+      webrtc:
+        lib_path: lib/libwebrtc-linux-amd64-magic.a
       arch_deps:
         - libasound2-dev
         - libexpat1-dev
@@ -39,14 +61,6 @@ targets:
         - libxext-dev
         - libxrandr-dev
         - pkg-config
-  linux-i686:
-    var:
-      webrtc:
-        lib_path: lib/libwebrtc-linux-386-magic.a
-  linux-x86_64:
-    var:
-      webrtc:
-        lib_path: lib/libwebrtc-linux-amd64-magic.a
   osx-x86_64:
     var:
       webrtc:
diff --git a/rbm.conf b/rbm.conf
index df31741..d39316c 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -215,21 +215,13 @@ targets:
     var:
       linux-x86_64: 1
       osname: linux-x86_64
-      container:
-        arch: amd64
   linux-i686:
     arch: i686
     var:
       linux-i686: 1
       osname: linux-i686
-      container:
-        arch: i386
-      setarch: |
-        if test -z "$RBM_SETARCH"
-        then
-           export RBM_SETARCH=1
-           exec setarch i686 ./build
-        fi
+      configure_opt_i686: '--host=i686-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32'
+      configure_opt: '[% c("var/configure_opt_i686") %]'
   linux:
     var:
       linux: 1
@@ -241,7 +233,11 @@ targets:
       selfrando: '[% c("var/linux-x86_64") && ! c("var/release") %]'
       container:
         suite: wheezy
+        arch: amd64
+      pre_pkginst: dpkg --add-architecture i386
       deps:
+        - libc6-dev-i386
+        - lib32stdc++6
         - build-essential
         - python
         - bison



More information about the tbb-commits mailing list