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