rust/compiler/rustc_codegen_cranelift/build_sysroot/prepare_sysroot_src.sh

40 lines
936 B
Bash
Raw Normal View History

#!/bin/bash
2018-09-18 11:41:41 -05:00
set -e
cd "$(dirname "$0")"
2018-09-18 11:41:41 -05:00
SRC_DIR="$(dirname "$(rustup which rustc)")/../lib/rustlib/src/rust/"
DST_DIR="sysroot_src"
2018-10-06 04:30:32 -05: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
mkdir -p $DST_DIR/library
cp -a "$SRC_DIR/library" $DST_DIR/
2018-10-06 07:57:06 -05:00
pushd $DST_DIR
echo "[GIT] init"
2018-09-18 11:41:41 -05:00
git init
echo "[GIT] add"
2018-09-18 11:41:41 -05:00
git add .
echo "[GIT] commit"
2018-09-18 11:41:41 -05:00
git commit -m "Initial commit" -q
for file in $(ls ../../patches/ | grep -v patcha); do
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"
done
popd
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"