use a simple script instead of cargo clone.

This commit is contained in:
Hideki Sekine 2018-08-14 22:35:11 +09:00
parent c2b612ac0c
commit 5c654f27b7
2 changed files with 27 additions and 2 deletions

View File

@ -0,0 +1,23 @@
#!/bin/bash -x
# Usage: $0 project_name url sha1
# Get the crate with the specified sha1.
#
# all arguments are required.
#
# See below link for git usage:
# https://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset/14091182#14091182
# Mandatory arguments:
PROJECT_NAME=$1
URL=$2
SHA1=$3
function err_exit() {
echo "ERROR:" $*
exit 1
}
git clone $URL $PROJECT_NAME || err_exit
cd $PROJECT_NAME || err_exit
git reset --hard $SHA1 || err_exit

View File

@ -15,9 +15,11 @@ ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7em-none-eabi thumbv7em-none
# We need to be outside of 'src' dir in order to run cargo
WORK_DIR := $(RUST_TEST_TMPDIR)/run-make/$(TARGET)
HERE := $(shell pwd)
CRATE := cortex-m
CRATE_VER := 0.5.0
CRATE_URL := https://github.com/rust-embedded/cortex-m
CRATE_SHA1 := a448e9156e2cb1e556e5441fd65426952ef4b927 # 0.5.0
RUSTC := $(RUSTC_ORIGINAL)
LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
@ -26,7 +28,7 @@ all:
env
mkdir -p $(WORK_DIR)
-cd $(WORK_DIR) && rm -rf $(CRATE)
cd $(WORK_DIR) && $(CARGO) clone $(CRATE) --vers $(CRATE_VER)
cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1)
cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v
else