taskcluster/scripts/misc/build-clang-macosx.sh
author Mike Hommey <mh+mozilla@glandium.org>
Thu, 27 Sep 2018 15:33:42 +0000
changeset 495475 85ac938c7c465de05292420422df9282743047f3
parent 494645 c3d7f8a2a6d4febb937ef7ee6ee79f3b96fed55c
child 495477 9dd02ae2ee0ae93d12ea26e7a1d405427f090dc6
permissions -rwxr-xr-x
Bug 1492663 - Upgrade most CI builds to clang 7 r=froydnj The cctools-port linker links against libraries from clang (for LTO), which have different SONAMEs depending on the clang version. Which means the linker needs to be used along the same version of clang it was built against. Thus we also make it depend on linux64-clang-7. But changing the dependency is not enough, cf. bug 1471905, so also touch its build script, which it turns out, we need to do anyways because llvm-dsymutil was renamed to dsymutil. Relatedly, all toolchains that are built using cctools-port need to use linux64-clang-7 too. Building compiler-rt 7 with the OSX 10.11 SDK fails because of some newer APIs being used in compiler-rt for xray, but this is not a feature we use, so disable that. Differential Revision: https://phabricator.services.mozilla.com/D6766

#!/bin/bash
set -x -e -v

# This script is for building clang for Mac OS X on Linux.
WORKSPACE=$HOME/workspace
HOME_DIR=$WORKSPACE/build
UPLOAD_DIR=$HOME/artifacts

cd $HOME_DIR/src

. taskcluster/scripts/misc/tooltool-download.sh

# ld needs libLTO.so from llvm
export LD_LIBRARY_PATH=$HOME_DIR/src/clang/lib
# these variables are used in build-clang.py
export CROSS_CCTOOLS_PATH=$HOME_DIR/src/cctools
export CROSS_SYSROOT=$HOME_DIR/src/MacOSX10.11.sdk
# cmake doesn't allow us to specify a path to lipo on the command line.
export PATH=$PATH:$CROSS_CCTOOLS_PATH/bin
ln -sf $CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin11-lipo $CROSS_CCTOOLS_PATH/bin/lipo

# gets a bit too verbose here
set +x

cd build/build-clang
# |mach python| sets up a virtualenv for us!
../../mach python ./build-clang.py -c clang-7-macosx64.json

set -x

# Put a tarball in the artifacts dir
mkdir -p $UPLOAD_DIR
cp clang.tar.* $UPLOAD_DIR