In cross-compilation setups (x86_64 host, i686 or aarch64 target), we're going to need two sysroots. Obviously, we need the sysroot paths to be different in that case, so the sysroot path themselves need to contain some distinctive name, and we'll use the `target.toolchain` name for that (the target triplet with the vendor/machine stripped out). Because the path name needs to be reflected in the artifact name as well as the toolchain name, we also change them. And because the current prefix in the toolchain name is now redundant with the suffix, we remove the prefix, and allow the bootstrapping mechanism to try toolchains without the prefix. Differential Revision: https://phabricator.services.mozilla.com/D119846
76 lines
2.5 KiB
Bash
Executable File
76 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
set -x -e -v
|
|
|
|
# This script is for building fix-stacks.
|
|
PROJECT=fix-stacks
|
|
|
|
export TARGET="$1"
|
|
|
|
case "$TARGET" in
|
|
x86_64-unknown-linux-gnu)
|
|
EXE=
|
|
COMPRESS_EXT=xz
|
|
# {CC,CXX} and TARGET_{CC,CXX} must be set because a build.rs file builds
|
|
# some C and C++ code.
|
|
export CC=$MOZ_FETCHES_DIR/clang/bin/clang
|
|
export CXX=$MOZ_FETCHES_DIR/clang/bin/clang++
|
|
export PATH="$MOZ_FETCHES_DIR/binutils/bin:$PATH"
|
|
export CFLAGS_x86_64_unknown_linux_gnu="--sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu"
|
|
export RUSTFLAGS="-C linker=$CXX -C link-arg=--sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu"
|
|
;;
|
|
*-apple-darwin)
|
|
# Cross-compiling for Mac on Linux.
|
|
EXE=
|
|
COMPRESS_EXT=xz
|
|
# {CC,CXX} and TARGET_{CC,CXX} must be set because a build.rs file builds
|
|
# some C and C++ code.
|
|
export CC=$MOZ_FETCHES_DIR/clang/bin/clang
|
|
export CXX=$MOZ_FETCHES_DIR/clang/bin/clang++
|
|
export PATH="$MOZ_FETCHES_DIR/cctools/bin:$PATH"
|
|
export RUSTFLAGS="-C linker=$GECKO_PATH/taskcluster/scripts/misc/osx-cross-linker"
|
|
if test "$TARGET" = "aarch64-apple-darwin"; then
|
|
export SDK_VER=11.0
|
|
fi
|
|
export TARGET_CC="$CC -isysroot $MOZ_FETCHES_DIR/MacOSX${SDK_VER:-10.12}.sdk"
|
|
export TARGET_CXX="$CXX -isysroot $MOZ_FETCHES_DIR/MacOSX${SDK_VER:-10.12}.sdk"
|
|
;;
|
|
i686-pc-windows-msvc)
|
|
# Cross-compiling for Windows on Linux.
|
|
EXE=.exe
|
|
COMPRESS_EXT=bz2
|
|
# Some magic that papers over differences in case-sensitivity/insensitivity on Linux
|
|
# and Windows file systems.
|
|
export LD_PRELOAD="/builds/worker/fetches/liblowercase/liblowercase.so"
|
|
export LOWERCASE_DIRS="/builds/worker/fetches/vs2017_15.8.4"
|
|
# {CC,CXX} and TARGET_{CC,CXX} must be set because a build.rs file builds
|
|
# some C and C++ code.
|
|
export CC=$MOZ_FETCHES_DIR/clang/bin/clang-cl
|
|
export CXX=$MOZ_FETCHES_DIR/clang/bin/clang-cl
|
|
export TARGET_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-lib
|
|
. $GECKO_PATH/taskcluster/scripts/misc/vs-setup32.sh
|
|
export CARGO_TARGET_I686_PC_WINDOWS_MSVC_LINKER=$MOZ_FETCHES_DIR/clang/bin/lld-link
|
|
;;
|
|
esac
|
|
|
|
cd $GECKO_PATH
|
|
|
|
if [ -n "$TOOLTOOL_MANIFEST" ]; then
|
|
. taskcluster/scripts/misc/tooltool-download.sh
|
|
fi
|
|
|
|
PATH="$(cd $MOZ_FETCHES_DIR && pwd)/rustc/bin:$PATH"
|
|
|
|
cd $MOZ_FETCHES_DIR/$PROJECT
|
|
|
|
cargo build --verbose --release --target "$TARGET"
|
|
|
|
mkdir $PROJECT
|
|
cp target/$TARGET/release/${PROJECT}${EXE} ${PROJECT}/
|
|
tar -acf ${PROJECT}.tar.$COMPRESS_EXT $PROJECT
|
|
mkdir -p $UPLOAD_DIR
|
|
cp ${PROJECT}.tar.$COMPRESS_EXT $UPLOAD_DIR
|
|
|
|
cd ..
|
|
|
|
. $GECKO_PATH/taskcluster/scripts/misc/vs-cleanup.sh
|