]>
Commit | Line | Data |
---|---|---|
fc512014 XL |
1 | # Note to people running shellcheck: this file should only be sourced, not executed directly. |
2 | ||
29967ef6 XL |
3 | set -e |
4 | ||
fc512014 | 5 | unamestr=$(uname) |
29967ef6 XL |
6 | if [[ "$unamestr" == 'Linux' ]]; then |
7 | dylib_ext='so' | |
8 | elif [[ "$unamestr" == 'Darwin' ]]; then | |
9 | dylib_ext='dylib' | |
10 | else | |
11 | echo "Unsupported os" | |
12 | exit 1 | |
13 | fi | |
14 | ||
15 | HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ") | |
16 | TARGET_TRIPLE=$HOST_TRIPLE | |
17 | #TARGET_TRIPLE="x86_64-pc-windows-gnu" | |
18 | #TARGET_TRIPLE="aarch64-unknown-linux-gnu" | |
19 | ||
20 | linker='' | |
21 | RUN_WRAPPER='' | |
22 | export JIT_SUPPORTED=1 | |
23 | if [[ "$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 | |
35 | fi | |
36 | ||
37 | if echo "$RUSTC_WRAPPER" | grep sccache; then | |
38 | echo | |
39 | echo -e "\x1b[1;93m=== Warning: Unset RUSTC_WRAPPER to prevent interference with sccache ===\x1b[0m" | |
40 | echo | |
41 | export RUSTC_WRAPPER= | |
42 | fi | |
43 | ||
fc512014 | 44 | dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) |
29967ef6 | 45 | |
fc512014 XL |
46 | export RUSTC=$dir"/bin/cg_clif" |
47 | export RUSTFLAGS=$linker" "$RUSTFLAGS | |
48 | export 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 | 52 | if [[ $(uname) == 'Darwin' ]]; then |
29967ef6 XL |
53 | export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup" |
54 | fi | |
55 | ||
fc512014 | 56 | export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib" |
29967ef6 XL |
57 | export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH |
58 | ||
59 | export CG_CLIF_DISPLAY_CG_TIME=1 |