]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/build.sh
Rollup merge of #99812 - GuillaumeGomez:fix-headings-colors, r=jsha,notriddle
[rust.git] / compiler / rustc_codegen_gcc / build.sh
1 #!/usr/bin/env bash
2
3 #set -x
4 set -e
5
6 codegen_channel=debug
7 sysroot_channel=debug
8
9 flags=
10
11 while [[ $# -gt 0 ]]; do
12     case $1 in
13         --release)
14             codegen_channel=release
15             shift
16             ;;
17         --release-sysroot)
18             sysroot_channel=release
19             shift
20             ;;
21         --no-default-features)
22             flags="$flags --no-default-features"
23             shift
24             ;;
25         --features)
26             shift
27             flags="$flags --features $1"
28             shift
29             ;;
30         *)
31             echo "Unknown option $1"
32             exit 1
33             ;;
34     esac
35 done
36
37 if [ -f ./gcc_path ]; then
38     export GCC_PATH=$(cat gcc_path)
39 else
40     echo 'Please put the path to your custom build of libgccjit in the file `gcc_path`, see Readme.md for details'
41     exit 1
42 fi
43
44 export LD_LIBRARY_PATH="$GCC_PATH"
45 export LIBRARY_PATH="$GCC_PATH"
46
47 if [[ "$codegen_channel" == "release" ]]; then
48     export CHANNEL='release'
49     CARGO_INCREMENTAL=1 cargo rustc --release $flags
50 else
51     echo $LD_LIBRARY_PATH
52     export CHANNEL='debug'
53     cargo rustc $flags
54 fi
55
56 source config.sh
57
58 rm -r target/out || true
59 mkdir -p target/out/gccjit
60
61 echo "[BUILD] sysroot"
62 if [[ "$sysroot_channel" == "release" ]]; then
63     time ./build_sysroot/build_sysroot.sh --release
64 else
65     time ./build_sysroot/build_sysroot.sh
66 fi
67