[tor-commits] [tor-browser-bundle/master] Bug 10369: Don't use old GCC toolchain anymore for utils

gk at torproject.org gk at torproject.org
Wed Apr 5 09:05:42 UTC 2017


commit e32cc7890a13d1707e9f3109fd8e888ac8623537
Author: Georg Koppen <gk at torproject.org>
Date:   Thu Mar 16 14:39:40 2017 +0000

    Bug 10369: Don't use old GCC toolchain anymore for utils
    
    We start using clang as the cross-compiler as we already do in the tor
    and Firefox descriptor. This should give us better code and should make
    the build more robust.
---
 gitian/descriptors/mac/gitian-utils.yml | 145 ++++++++++++++++----------------
 1 file changed, 73 insertions(+), 72 deletions(-)

diff --git a/gitian/descriptors/mac/gitian-utils.yml b/gitian/descriptors/mac/gitian-utils.yml
index 55d6c7f..0025e43 100644
--- a/gitian/descriptors/mac/gitian-utils.yml
+++ b/gitian/descriptors/mac/gitian-utils.yml
@@ -4,7 +4,6 @@ distro: "debian"
 suites:
 - "wheezy"
 architectures:
-- "i386"
 - "amd64"
 packages:
 - "faketime"
@@ -25,8 +24,8 @@ remotes:
   "dir": "cmake"
 files:
 - "apple-uni-sdk-10.6_20110407-0.flosoft1_i386.deb"
-- "multiarch-darwin11-cctools127.2-gcc42-5666.3-llvmgcc42-2336.1-Linux-120724.tar.xz"
 - "openssl.tar.gz"
+- "cctools.tar.gz"
 - "versions"
 - "dzip.sh"
 - "libfaketime.patch"
@@ -37,78 +36,80 @@ script: |
   export LC_ALL=C
   umask 0022
 
-  if [ $GBUILD_BITS == "64" ];
-  then
-    # Cmake first
-    cd cmake
-    ./bootstrap --prefix=$INSTDIR/cmake
-    make $MAKEOPTS
-    make install
-    export PATH=$PATH:$INSTDIR/cmake/bin
-    # Clang
-    cd ../llvm
-    mv ../clang tools/
-    export LLVM_HOME=`pwd`
-    mkdir build
-    cd build
-    cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$INSTDIR/clang -DCMAKE_BUILD_TYPE:STRING=Release $LLVM_HOME
-    make $MAKEOPTS
-    make install
-    cd $INSTDIR
-    ~/build/dzip.sh clang-$CLANG_VER-linux64-wheezy-utils.zip clang
-    cp *utils.zip $OUTDIR/
-  else
-    # Building libfaketime.
-    cd faketime
-    export GIT_COMMITTER_NAME="nobody"
-    export GIT_COMMITTER_EMAIL="nobody at localhost"
-    export GIT_COMMITTER_DATE="$REFERENCE_DATETIME"
-    git am ~/build/libfaketime.patch
-    make
-    DESTDIR="$INSTDIR/faketime" make install
-    export FAKETIME_SKIP_CMDS="make"
-    export FAKETIME=$REFERENCE_DATETIME
-    cd ..
+  # Cmake first
+  cd cmake
+  ./bootstrap --prefix=$INSTDIR/cmake
+  make $MAKEOPTS
+  make install
+  export PATH=$PATH:$INSTDIR/cmake/bin
 
-    # dpkg requires sbin directories in the PATH
-    export PATH="/usr/sbin:/sbin:$PATH"
-    sudo dpkg -i *.deb
-    tar xaf multiarch-darwin*tar.xz
-    export PATH="$PATH:$HOME/build/apple-osx/bin/"
-    # For OpenSSL
-    ln -s ~/build/apple-osx/bin/apple-osx-gcc ~/build/apple-osx/bin/i686-apple-darwin11-cc
+  # Clang
+  cd ../llvm
+  mv ../clang tools/
+  export LLVM_HOME=`pwd`
+  mkdir build
+  cd build
+  cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$INSTDIR/clang -DCMAKE_BUILD_TYPE:STRING=Release $LLVM_HOME
+  make $MAKEOPTS
+  make install
 
-    # XXX Clean up these flags?
-    export CFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I.  -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -mmacosx-version-min=10.5"
-    export CXXFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I.  -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1 -mmacosx-version-min=10.5"
-    export LDFLAGS="-L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -mmacosx-version-min=10.5"
+  # Building libfaketime.
+  cd ../../faketime
+  export GIT_COMMITTER_NAME="nobody"
+  export GIT_COMMITTER_EMAIL="nobody at localhost"
+  export GIT_COMMITTER_DATE="$REFERENCE_DATETIME"
+  git am ~/build/libfaketime.patch
+  make
+  DESTDIR="$INSTDIR/faketime" make install
+  export FAKETIME_SKIP_CMDS="make"
+  export FAKETIME=$REFERENCE_DATETIME
 
-    # Building Libevent
-    cd libevent
-    ./autogen.sh
-    find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
-    ./configure --disable-static --host=i686-apple-darwin11 --prefix=$INSTDIR/libevent
-    export LD_PRELOAD="$INSTDIR/faketime/usr/local/lib/faketime/libfaketime.so.1"
-    make $MAKEOPTS
-    make install
-    cd ..
+  cd ..
+  ar x apple-uni-sdk-10.6_20110407-0.flosoft1_i386.deb
+  tar xaf data.tar.gz
+  tar xaf cctools.tar.gz
 
-    # Building OpenSSL
-    # We still need libfaketime here it seems, see #19856 for details.
-    tar xzf openssl.tar.gz
-    cd openssl-*
-    find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
-    # TODO: Add enable-ec_nistp_64_gcc_128 for 64bit OS X.
-    ./Configure --cross-compile-prefix=i686-apple-darwin11- $CFLAGS darwin64-x86_64-cc --prefix=$INSTDIR/openssl enable-ec_nistp_64_gcc_128
-    # Using $MAKEOPTS breaks the build. Might be the issue mentioned on
-    # http://cblfs.cross-lfs.org/index.php/OpenSSL.
-    make
-    make install
-    cd ..
+  # Preparing clang for cross-compilation, setting the proper flags and
+  # variables
+  # ld needs libLTO.so from llvm
+  export LD_LIBRARY_PATH="$INSTDIR/clang/lib"
+  export PATH="$HOME/build/cctools/bin:$PATH"
+  CROSS_CCTOOLS_PATH="$HOME/build/cctools"
+  CROSS_SYSROOT="$HOME/build/usr/lib/apple/SDKs/MacOSX10.6.sdk"
+  FLAGS="-target x86_64-apple-darwin10 -mlinker-version=136 -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT"
+  export CC="$INSTDIR/clang/bin/clang $FLAGS"
+  export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-dead_strip"
 
-    # Grabbing the results
-    cd $INSTDIR
-    ~/build/dzip.sh openssl-$OPENSSL_VER-mac64-utils.zip openssl
-    ~/build/dzip.sh libevent-${LIBEVENT_TAG#release-}-mac64-utils.zip libevent
-    cp *utils.zip $OUTDIR/
-  fi
+  # Building Libevent
+  cd libevent
+  ./autogen.sh
+  find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
+  ./configure --disable-static --host=x86_64-apple-darwin10 --prefix=$INSTDIR/libevent
+  export LD_PRELOAD="$INSTDIR/faketime/usr/local/lib/faketime/libfaketime.so.1"
+  make $MAKEOPTS
+  make install
+  cd ..
+
+  # Building OpenSSL
+  # XXX: We still need libfaketime here it seems, see #19856 for details.
+  # XXX: Check whether that's true after switching to clang as cross-compiler.
+  # Tricking OpenSSL into using our clang as cross-compiler
+  export CC="cc $FLAGS"
+  ln -s $INSTDIR/clang/bin/clang x86_64-apple-darwin10-cc
+  export PATH=$PATH:$HOME/build
+  tar xzf openssl.tar.gz
+  cd openssl-*
+  find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
+  ./Configure --cross-compile-prefix=x86_64-apple-darwin10- darwin64-x86_64-cc --prefix=$INSTDIR/openssl enable-ec_nistp_64_gcc_128
+  # Using $MAKEOPTS breaks the build. Might be the issue mentioned on
+  # http://cblfs.cross-lfs.org/index.php/OpenSSL.
+  make
+  make install
+  cd ..
+
+  # Grabbing the results
+  cd $INSTDIR
+  ~/build/dzip.sh clang-$CLANG_VER-linux64-wheezy-utils.zip clang
+  ~/build/dzip.sh openssl-$OPENSSL_VER-mac64-utils.zip openssl
+  ~/build/dzip.sh libevent-${LIBEVENT_TAG#release-}-mac64-utils.zip libevent
+  cp *utils.zip $OUTDIR/





More information about the tor-commits mailing list