]> git.lizzy.rs Git - rust.git/blob - config.sh
Disable global_asm! on macOS for now
[rust.git] / config.sh
1 set -e
2
3 unamestr=`uname`
4 if [[ "$unamestr" == 'Linux' ]]; then
5    dylib_ext='so'
6 elif [[ "$unamestr" == 'Darwin' ]]; then
7    dylib_ext='dylib'
8 else
9    echo "Unsupported os"
10    exit 1
11 fi
12
13 HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
14 TARGET_TRIPLE=$HOST_TRIPLE
15 #TARGET_TRIPLE="x86_64-pc-windows-gnu"
16 #TARGET_TRIPLE="aarch64-unknown-linux-gnu"
17
18 linker=''
19 RUN_WRAPPER=''
20 if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
21    if [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then
22       # We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
23       linker='-Clinker=aarch64-linux-gnu-gcc'
24       RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu'
25    elif [[ "$TARGET_TRIPLE" == "x86_64-pc-windows-gnu" ]]; then
26       # We are cross-compiling for Windows. Run tests in wine.
27       RUN_WRAPPER='wine'
28    else
29       echo "Unknown non-native platform"
30    fi
31 fi
32
33 export RUSTFLAGS=$linker' -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend='$(pwd)'/target/'$CHANNEL'/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$(pwd)'/build_sysroot/sysroot'
34
35 # FIXME remove once the atomic shim is gone
36 if [[ `uname` == 'Darwin' ]]; then
37    export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
38 fi
39
40 RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
41 export RUSTC_LOG=warn # display metadata load errors
42
43 export LD_LIBRARY_PATH="$(pwd)/target/out:$(pwd)/build_sysroot/sysroot/lib/rustlib/$TARGET_TRIPLE/lib"
44 export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
45
46 export CG_CLIF_DISPLAY_CG_TIME=1
47 export CG_CLIF_INCR_CACHE_DISABLED=1