]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_cranelift/scripts/config.sh
New upstream version 1.50.0+dfsg1
[rustc.git] / compiler / rustc_codegen_cranelift / scripts / config.sh
CommitLineData
fc512014
XL
1# Note to people running shellcheck: this file should only be sourced, not executed directly.
2
29967ef6
XL
3set -e
4
fc512014 5unamestr=$(uname)
29967ef6
XL
6if [[ "$unamestr" == 'Linux' ]]; then
7 dylib_ext='so'
8elif [[ "$unamestr" == 'Darwin' ]]; then
9 dylib_ext='dylib'
10else
11 echo "Unsupported os"
12 exit 1
13fi
14
15HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
16TARGET_TRIPLE=$HOST_TRIPLE
17#TARGET_TRIPLE="x86_64-pc-windows-gnu"
18#TARGET_TRIPLE="aarch64-unknown-linux-gnu"
19
20linker=''
21RUN_WRAPPER=''
22export JIT_SUPPORTED=1
23if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
24 export JIT_SUPPORTED=0
25 if [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then
26 # We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
27 linker='-Clinker=aarch64-linux-gnu-gcc'
28 RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu'
29 elif [[ "$TARGET_TRIPLE" == "x86_64-pc-windows-gnu" ]]; then
30 # We are cross-compiling for Windows. Run tests in wine.
31 RUN_WRAPPER='wine'
32 else
33 echo "Unknown non-native platform"
34 fi
35fi
36
37if echo "$RUSTC_WRAPPER" | grep sccache; then
38echo
39echo -e "\x1b[1;93m=== Warning: Unset RUSTC_WRAPPER to prevent interference with sccache ===\x1b[0m"
40echo
41export RUSTC_WRAPPER=
42fi
43
fc512014 44dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
29967ef6 45
fc512014
XL
46export RUSTC=$dir"/bin/cg_clif"
47export RUSTFLAGS=$linker" "$RUSTFLAGS
48export RUSTDOCFLAGS=$linker' -Cpanic=abort -Zpanic-abort-tests '\
49'-Zcodegen-backend='$dir'/lib/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir
29967ef6
XL
50
51# FIXME remove once the atomic shim is gone
fc512014 52if [[ $(uname) == 'Darwin' ]]; then
29967ef6
XL
53 export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
54fi
55
fc512014 56export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
29967ef6
XL
57export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
58
59export CG_CLIF_DISPLAY_CG_TIME=1