diff --git a/prepare_libcore.sh b/prepare_libcore.sh index 75b6c8a9084..561ddf97763 100755 --- a/prepare_libcore.sh +++ b/prepare_libcore.sh @@ -1,11 +1,20 @@ #!/bin/bash --verbose set -e -SRC_DIR="target/libcore" -rm -rf $SRC_DIR -mkdir -p $SRC_DIR/src -cp -r $(dirname $(rustup which rustc))/../lib/rustlib/src/rust/src/libcore $SRC_DIR/src/libcore || (echo "Please install rust-src component"; exit 1) -cd $SRC_DIR +SRC_DIR=$(dirname $(rustup which rustc))"/../lib/rustlib/src/rust/" +DST_DIR="target/libcore" + +if [ ! -e $SRC_DIR ]; then + echo "Please install rust-src component" + exit 1 +fi + +rm -rf $DST_DIR +mkdir -p $DST_DIR/src +for crate in libcore libstd; do + cp -r $SRC_DIR/src/$crate $DST_DIR/src/ +done +cd $DST_DIR git init git add . git commit -m "Initial commit" -q