]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_gcc/config.sh
New upstream version 1.70.0+dfsg1
[rustc.git] / compiler / rustc_codegen_gcc / config.sh
CommitLineData
c295e0f8
XL
1set -e
2
3export CARGO_INCREMENTAL=0
4
923072b8 5if [ -f ./gcc_path ]; then
c295e0f8
XL
6 export GCC_PATH=$(cat gcc_path)
7else
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
10fi
11
12unamestr=`uname`
13if [[ "$unamestr" == 'Linux' ]]; then
14 dylib_ext='so'
15elif [[ "$unamestr" == 'Darwin' ]]; then
16 dylib_ext='dylib'
17else
18 echo "Unsupported os"
19 exit 1
20fi
21
22HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
23TARGET_TRIPLE=$HOST_TRIPLE
24#TARGET_TRIPLE="m68k-unknown-linux-gnu"
25
26linker=''
27RUN_WRAPPER=''
28if [[ "$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
39fi
40
353b0b11 41export RUSTFLAGS="$CG_RUSTFLAGS $linker -Csymbol-mangling-version=v0 -Cdebuginfo=2 -Clto=off -Zcodegen-backend=$(pwd)/target/${CHANNEL:-debug}/librustc_codegen_gcc.$dylib_ext --sysroot $(pwd)/build_sysroot/sysroot $TEST_FLAGS"
c295e0f8
XL
42
43# FIXME(antoyo): remove once the atomic shim is gone
44if [[ `uname` == 'Darwin' ]]; then
45 export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
46fi
47
48RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
49export RUSTC_LOG=warn # display metadata load errors
50
51export LD_LIBRARY_PATH="$(pwd)/target/out:$(pwd)/build_sysroot/sysroot/lib/rustlib/$TARGET_TRIPLE/lib:$GCC_PATH"
52export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH