88
99set -eux
1010
11+ target=" $1 "
12+
1113# Default to assuming the CARGO_HOME is one directory up (to account for a `bin`
1214# subdir) from where the `cargo` binary in `$PATH` lives.
1315default_cargo_home=" $( dirname " $( dirname " $( command -v cargo) " ) " ) "
@@ -18,17 +20,17 @@ export CARGO_HOME="${CARGO_HOME:-$default_cargo_home}"
1820echo " ${HOME} "
1921pwd
2022
21- # Avoid "no space left on device" failure.
22- if [ " ${1} " = " aarch64-linux-android" ] ; then
23+ # Avoid "no space left on device" failure if running in CI
24+ if [ " ${CI :- 0} " != " 0 " ] && [ " $target " = " aarch64-linux-android" ] ; then
2325 docker system prune -af
2426 docker system df
2527fi
2628
2729run () {
28- echo " Building docker container for target ${1} "
30+ echo " Building docker container for target $target "
2931
3032 # use -f so we can use ci/ as build context
31- docker build -t " libc-${1} " -f " ci/docker/${1} /Dockerfile" ci/
33+ docker build -t " libc-$target " -f " ci/docker/$target /Dockerfile" ci/
3234 mkdir -p target
3335 if [ -w /dev/kvm ]; then
3436 kvm=" --volume /dev/kvm:/dev/kvm"
@@ -50,8 +52,8 @@ run() {
5052 $kvm \
5153 --init \
5254 --workdir /checkout \
53- " libc-${1} " \
54- sh -c " HOME=/tmp PATH=\$ PATH:/rust/bin exec ci/run.sh ${1} "
55+ " libc-$target " \
56+ sh -c " HOME=/tmp PATH=\$ PATH:/rust/bin exec ci/run.sh $target "
5557}
5658
5759build_switch () {
@@ -88,13 +90,13 @@ build_switch() {
8890 && cargo build -Z build-std=core,alloc --target ci/switch.json"
8991}
9092
91- if [ -z " ${1} " ]; then
93+ if [ -z " $target " ]; then
9294 for d in ci/docker/* ; do
9395 run " ${d} "
9496 done
9597else
96- if [ " ${1} " != " switch" ]; then
97- run " ${1} "
98+ if [ " $target " != " switch" ]; then
99+ run " $target "
98100 else
99101 build_switch
100102 fi
0 commit comments