]>
Commit | Line | Data |
---|---|---|
c295e0f8 XL |
1 | set -e |
2 | ||
3 | export CARGO_INCREMENTAL=0 | |
4 | ||
923072b8 | 5 | if [ -f ./gcc_path ]; then |
c295e0f8 XL |
6 | export GCC_PATH=$(cat gcc_path) |
7 | else | |
8 | echo 'Please put the path to your custom build of libgccjit in the file `gcc_path`, see Readme.md for details' | |
9 | exit 1 | |
10 | fi | |
11 | ||
12 | unamestr=`uname` | |
13 | if [[ "$unamestr" == 'Linux' ]]; then | |
14 | dylib_ext='so' | |
15 | elif [[ "$unamestr" == 'Darwin' ]]; then | |
16 | dylib_ext='dylib' | |
17 | else | |
18 | echo "Unsupported os" | |
19 | exit 1 | |
20 | fi | |
21 | ||
22 | HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ") | |
23 | TARGET_TRIPLE=$HOST_TRIPLE | |
24 | #TARGET_TRIPLE="m68k-unknown-linux-gnu" | |
25 | ||
26 | linker='' | |
27 | RUN_WRAPPER='' | |
28 | if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then | |
29 | if [[ "$TARGET_TRIPLE" == "m68k-unknown-linux-gnu" ]]; then | |
30 | TARGET_TRIPLE="mips-unknown-linux-gnu" | |
31 | linker='-Clinker=m68k-linux-gcc' | |
32 | elif [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then | |
33 | # We are cross-compiling for aarch64. Use the correct linker and run tests in qemu. | |
34 | linker='-Clinker=aarch64-linux-gnu-gcc' | |
35 | RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu' | |
36 | else | |
37 | echo "Unknown non-native platform" | |
38 | fi | |
39 | fi | |
40 | ||
923072b8 | 41 | export RUSTFLAGS="$CG_RUSTFLAGS $linker -Cpanic=abort -Csymbol-mangling-version=v0 -Cdebuginfo=2 -Clto=off -Zpanic-abort-tests -Zcodegen-backend=$(pwd)/target/${CHANNEL:-debug}/librustc_codegen_gcc.$dylib_ext --sysroot $(pwd)/build_sysroot/sysroot" |
c295e0f8 XL |
42 | |
43 | # FIXME(antoyo): remove once the atomic shim is gone | |
44 | if [[ `uname` == 'Darwin' ]]; then | |
45 | export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup" | |
46 | fi | |
47 | ||
48 | RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out" | |
49 | export RUSTC_LOG=warn # display metadata load errors | |
50 | ||
51 | export LD_LIBRARY_PATH="$(pwd)/target/out:$(pwd)/build_sysroot/sysroot/lib/rustlib/$TARGET_TRIPLE/lib:$GCC_PATH" | |
52 | export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH |