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"
|
|
|
|
|
2019-08-09 08:04:04 +03:00
|
|
|
if [ -d "$MOZ_FETCHES_DIR/clang" ]; then
|
2015-07-14 14:02:22 +03:00
|
|
|
# mozilla-central based build
|
2019-08-09 08:04:04 +03:00
|
|
|
export CC=$MOZ_FETCHES_DIR/clang/bin/clang
|
|
|
|
export CXX=$MOZ_FETCHES_DIR/clang/bin/clang++
|
|
|
|
export LLVMCONFIG=$MOZ_FETCHES_DIR/clang/bin/llvm-config
|
|
|
|
export DSYMUTIL=$MOZ_FETCHES_DIR/clang/bin/llvm-dsymutil
|
2016-08-04 00:48:12 +03:00
|
|
|
# Use an updated linker.
|
2019-08-09 08:04:04 +03:00
|
|
|
ldflags="-B$MOZ_FETCHES_DIR/cctools/bin"
|
|
|
|
export AR=$MOZ_FETCHES_DIR/cctools/bin/ar
|
|
|
|
export RANLIB=$MOZ_FETCHES_DIR/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
|