]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/build_sysroot/prepare_sysroot_src.sh
Merge commit 'e228f0c16ea8c34794a6285bf57aab627c26b147' into libgccjit-codegen
[rust.git] / compiler / rustc_codegen_gcc / 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 -r $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
24 # This is needed on systems where nothing is configured.
25 # git really needs something here, or it will fail.
26 # Even using --author is not enough.
27 git config user.email || git config user.email "none@example.com"
28 git config user.name || git config user.name "None"
29
30 git commit -m "Initial commit" -q
31 for file in $(ls ../../patches/ | grep -v patcha); do
32 echo "[GIT] apply" $file
33 git apply ../../patches/$file
34 git add -A
35 git commit --no-gpg-sign -m "Patch $file"
36 done
37 popd
38
39 echo "Successfully prepared libcore for building"