]> git.lizzy.rs Git - rust.git/blob - build_sysroot/prepare_sysroot_src.sh
[WIP] Implement PassMode::Cast
[rust.git] / build_sysroot / prepare_sysroot_src.sh
1 #!/bin/bash
2 set -e
3 cd "$(dirname "$0")"
4
5 SRC_DIR="$(dirname "$(rustup which rustc)")/../lib/rustlib/src/rust/"
6 DST_DIR="sysroot_src"
7
8 if [ ! -e "$SRC_DIR" ]; then
9     echo "Please install rust-src component"
10     exit 1
11 fi
12
13 rm -rf $DST_DIR
14 mkdir -p $DST_DIR/library
15 cp -a "$SRC_DIR/library" $DST_DIR/
16
17 pushd $DST_DIR
18 echo "[GIT] init"
19 git init
20 echo "[GIT] add"
21 git add .
22 echo "[GIT] commit"
23 git commit -m "Initial commit" -q
24 for file in $(ls ../../patches/ | grep -v patcha); do
25 echo "[GIT] apply" "$file"
26 git apply ../../patches/"$file"
27 git add -A
28 git commit --no-gpg-sign -m "Patch $file"
29 done
30 popd
31
32 git clone https://github.com/rust-lang/compiler-builtins.git || echo "rust-lang/compiler-builtins has already been cloned"
33 pushd compiler-builtins
34 git checkout -- .
35 git checkout 0.1.39
36 git apply ../../crate_patches/0001-compiler-builtins-Remove-rotate_left-from-Int.patch
37 popd
38
39 echo "Successfully prepared sysroot source for building"