2018-12-14 06:58:33 -06:00
|
|
|
#!/bin/bash
|
2018-09-18 11:41:41 -05:00
|
|
|
set -e
|
2020-11-04 08:35:42 -06:00
|
|
|
cd "$(dirname "$0")"
|
2018-09-18 11:41:41 -05:00
|
|
|
|
2020-11-04 08:35:42 -06:00
|
|
|
SRC_DIR="$(dirname "$(rustup which rustc)")/../lib/rustlib/src/rust/"
|
2018-12-14 06:58:33 -06:00
|
|
|
DST_DIR="sysroot_src"
|
2018-10-06 04:30:32 -05:00
|
|
|
|
2020-11-04 08:35:42 -06:00
|
|
|
if [ ! -e "$SRC_DIR" ]; then
|
2018-10-06 04:30:32 -05:00
|
|
|
echo "Please install rust-src component"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $DST_DIR
|
2020-07-30 07:58:27 -05:00
|
|
|
mkdir -p $DST_DIR/library
|
2020-11-04 08:35:42 -06:00
|
|
|
cp -a "$SRC_DIR/library" $DST_DIR/
|
2018-10-06 07:57:06 -05:00
|
|
|
|
2018-11-12 12:37:54 -06:00
|
|
|
pushd $DST_DIR
|
2018-12-14 06:58:33 -06:00
|
|
|
echo "[GIT] init"
|
2018-09-18 11:41:41 -05:00
|
|
|
git init
|
2018-12-14 06:58:33 -06:00
|
|
|
echo "[GIT] add"
|
2018-09-18 11:41:41 -05:00
|
|
|
git add .
|
2018-12-14 06:58:33 -06:00
|
|
|
echo "[GIT] commit"
|
2018-09-18 11:41:41 -05:00
|
|
|
git commit -m "Initial commit" -q
|
2018-12-14 06:58:33 -06:00
|
|
|
for file in $(ls ../../patches/ | grep -v patcha); do
|
2020-11-04 08:35:42 -06:00
|
|
|
echo "[GIT] apply" "$file"
|
|
|
|
git apply ../../patches/"$file"
|
2019-11-24 08:44:39 -06:00
|
|
|
git add -A
|
|
|
|
git commit --no-gpg-sign -m "Patch $file"
|
2018-12-14 06:58:33 -06:00
|
|
|
done
|
2018-11-12 12:37:54 -06:00
|
|
|
popd
|
|
|
|
|
2021-01-21 07:51:28 -06:00
|
|
|
git clone https://github.com/rust-lang/compiler-builtins.git || echo "rust-lang/compiler-builtins has already been cloned"
|
|
|
|
pushd compiler-builtins
|
|
|
|
git checkout -- .
|
|
|
|
git checkout 0.1.39
|
|
|
|
git apply ../../crate_patches/0001-compiler-builtins-Remove-rotate_left-from-Int.patch
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo "Successfully prepared sysroot source for building"
|