2015-07-14 14:02:22 +03:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
. "$topsrcdir/build/mozconfig.common"
|
|
|
|
|
|
|
|
if [ -d "$topsrcdir/clang" ]; then
|
|
|
|
# mozilla-central based build
|
|
|
|
export CC=$topsrcdir/clang/bin/clang
|
|
|
|
export CXX=$topsrcdir/clang/bin/clang++
|
|
|
|
export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
|
2015-10-21 19:22:18 +03:00
|
|
|
export DSYMUTIL=$topsrcdir/clang/bin/llvm-dsymutil
|
2016-08-04 00:48:12 +03:00
|
|
|
# Use an updated linker.
|
|
|
|
ldflags="-B$topsrcdir/cctools/bin"
|
2017-04-17 04:36:05 +03:00
|
|
|
export AR=$topsrcdir/cctools/bin/ar
|
|
|
|
export RANLIB=$topsrcdir/cctools/bin/ranlib
|
2015-07-14 14:02:22 +03:00
|
|
|
elif [ -d "$topsrcdir/../clang" ]; then
|
|
|
|
# comm-central based build
|
|
|
|
export CC=$topsrcdir/../clang/bin/clang
|
|
|
|
export CXX=$topsrcdir/../clang/bin/clang++
|
|
|
|
export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
|
2015-10-21 19:22:18 +03:00
|
|
|
export DSYMUTIL=$topsrcdir/../clang/bin/llvm-dsymutil
|
2016-08-04 00:48:12 +03:00
|
|
|
# Use an updated linker.
|
|
|
|
ldflags="-B$topsrcdir/../cctools/bin"
|
2017-04-17 04:36:05 +03:00
|
|
|
export AR=$topsrcdir/../cctools/bin/ar
|
|
|
|
export RANLIB=$topsrcdir/../cctools/bin/ranlib
|
2015-07-14 14:02:22 +03:00
|
|
|
fi
|
|
|
|
|
Bug 1289847 - part 1 - use a newer ld for Mac builds; r=mshal
The ld that we use for Mac builds is old (Xcode circa OS X 10.7), and
also crashes in various ways when we try to use newer Rust versions
and/or pass options to make the linker work with newer Rust versions.
To mitigate this, let's build with a newer linker, compiled from:
https://github.com/tpoechtrager/cctools-port
We use this port, rather than the packages from opensource.apple.com,
because the packages from Apple have decidely non-intuitive build
systems, and require some hacking to get to build. This port, in
contrast, is simply built with:
CFLAGS='-mcpu=generic -mtune=generic' ./configure --target=x86_64-apple-darwin11
env MACOSX_DEPLOYMENT_TARGET=10.7 make
and the resulting x86_64-apple-darwin11-ld is renamed as 'ld' and
packaged up for automation's purposes.
However, since this linker is newer, it also produces bits of Mach-O
that our older build tools don't understand. Fortunately, we can pass
appropriate options to the linker to turn off generation of those Mach-O
bits.
2016-08-03 11:24:33 +03:00
|
|
|
# Ensure the updated linker doesn't generate things our older build tools
|
|
|
|
# don't understand.
|
|
|
|
ldflags="$ldflags -Wl,-no_data_in_code_info"
|
|
|
|
export LDFLAGS="$ldflags"
|
|
|
|
|
2015-07-14 14:02:22 +03:00
|
|
|
# If not set use the system default clang
|
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
export CC=clang
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If not set use the system default clang++
|
|
|
|
if [ -z "$CXX" ]; then
|
|
|
|
export CXX=clang++
|
|
|
|
fi
|