]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/build.sh
Rollup merge of #78702 - wesleywiser:self_profile_cgu_sizes, r=Mark-Simulacrum
[rust.git] / compiler / rustc_codegen_cranelift / build.sh
1 #!/bin/bash
2 set -e
3
4 # Settings
5 export CHANNEL="release"
6 build_sysroot=1
7 target_dir='build'
8 while [[ $# != 0 ]]; do
9     case $1 in
10         "--debug")
11             export CHANNEL="debug"
12             ;;
13         "--without-sysroot")
14             build_sysroot=0
15             ;;
16         "--target-dir")
17             target_dir=$2
18             shift
19             ;;
20         *)
21             echo "Unknown flag '$1'"
22             echo "Usage: ./build.sh [--debug] [--without-sysroot] [--target-dir DIR]"
23             ;;
24     esac
25     shift
26 done
27
28 # Build cg_clif
29 export RUSTFLAGS="-Zrun_dsymutil=no"
30 if [[ "$CHANNEL" == "release" ]]; then
31     cargo build --release
32 else
33     cargo build
34 fi
35
36 rm -rf $target_dir
37 mkdir $target_dir
38 cp -a target/$CHANNEL/cg_clif{,_build_sysroot} target/$CHANNEL/*rustc_codegen_cranelift* $target_dir/
39 cp -a rust-toolchain scripts/config.sh scripts/cargo.sh $target_dir
40
41 if [[ "$build_sysroot" == "1" ]]; then
42     echo "[BUILD] sysroot"
43     export CG_CLIF_INCR_CACHE_DISABLED=1
44     dir=$(pwd)
45     cd $target_dir
46     time $dir/build_sysroot/build_sysroot.sh
47 fi