forked from mirrors/gecko-dev
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
96 lines
2.2 KiB
Bash
Executable file
96 lines
2.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
target=$1
|
|
shift
|
|
|
|
clang=$MOZ_FETCHES_DIR/clang/bin/clang
|
|
|
|
case "$target" in
|
|
aarch64-apple-darwin)
|
|
arch=arm64
|
|
sdk=11.0
|
|
compiler_wrapper() {
|
|
echo exec \$MOZ_FETCHES_DIR/clang/bin/$1 -mcpu=apple-a12 \"\$@\" > $1
|
|
chmod +x $1
|
|
}
|
|
compiler_wrapper clang
|
|
compiler_wrapper clang++
|
|
clang=$PWD/clang
|
|
;;
|
|
x86_64-apple-darwin)
|
|
arch=x86_64
|
|
sdk=10.12
|
|
;;
|
|
esac
|
|
|
|
case "$target" in
|
|
*-apple-darwin)
|
|
libdir=lib/darwin
|
|
EXTRA_CMAKE_FLAGS="
|
|
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/cctools/bin/$target-ld
|
|
-DCMAKE_LIPO=$MOZ_FETCHES_DIR/cctools/bin/lipo
|
|
-DCMAKE_SYSTEM_NAME=Darwin
|
|
-DCMAKE_SYSTEM_VERSION=$sdk
|
|
-DCMAKE_OSX_SYSROOT=$MOZ_FETCHES_DIR/MacOSX$sdk.sdk
|
|
-DDARWIN_osx_ARCHS=$arch
|
|
-DDARWIN_osx_SYSROOT=$MOZ_FETCHES_DIR/MacOSX$sdk.sdk
|
|
-DDARWIN_macosx_OVERRIDE_SDK_VERSION=$sdk
|
|
-DDARWIN_osx_BUILTIN_ARCHS=$arch
|
|
"
|
|
# compiler-rt build script expects to find `codesign` in $PATH.
|
|
# Give it a fake one.
|
|
echo "#!/bin/sh" > codesign
|
|
chmod +x codesign
|
|
PATH="$PWD:$MOZ_FETCHES_DIR/cctools/bin:$PATH"
|
|
;;
|
|
aarch64-unknown-linux-gnu)
|
|
libdir=lib/linux
|
|
EXTRA_CMAKE_FLAGS="
|
|
-DCMAKE_SYSROOT=$MOZ_FETCHES_DIR/sysroot-aarch64-linux-gnu
|
|
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/clang/bin/ld.lld
|
|
"
|
|
PATH="$MOZ_FETCHES_DIR/binutils/bin:$PATH"
|
|
;;
|
|
*)
|
|
echo $target is not supported yet
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
if [ -n "$TOOLTOOL_MANIFEST" ]; then
|
|
. $GECKO_PATH/taskcluster/scripts/misc/tooltool-download.sh
|
|
fi
|
|
|
|
mkdir compiler-rt
|
|
cd compiler-rt
|
|
|
|
for patchfile in "$@"; do
|
|
patch -d $MOZ_FETCHES_DIR/llvm-project -p1 < $GECKO_PATH/$patchfile
|
|
done
|
|
|
|
cmake \
|
|
$MOZ_FETCHES_DIR/llvm-project/compiler-rt \
|
|
-GNinja \
|
|
-DCMAKE_C_COMPILER=$clang \
|
|
-DCMAKE_CXX_COMPILER=$clang++ \
|
|
-DCMAKE_C_COMPILER_TARGET=$target \
|
|
-DCMAKE_CXX_COMPILER_TARGET=$target \
|
|
-DCMAKE_ASM_COMPILER_TARGET=$target \
|
|
-DCMAKE_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-ar \
|
|
-DCMAKE_RANLIB=$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DLLVM_ENABLE_ASSERTIONS=OFF \
|
|
-DLLVM_CONFIG_PATH=$MOZ_FETCHES_DIR/clang/bin/llvm-config \
|
|
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
|
|
$EXTRA_CMAKE_FLAGS
|
|
|
|
ninja -v
|
|
|
|
cd ..
|
|
|
|
tar caf compiler-rt.tar.zst compiler-rt/$libdir
|
|
|
|
mkdir -p "$UPLOAD_DIR"
|
|
mv "compiler-rt.tar.zst" "$UPLOAD_DIR"
|