about summary refs log tree commit diff
path: root/build_sysroot
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2020-11-02 18:16:57 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2020-11-02 18:17:39 +0100
commit0c34f5aba8544e2319c1587ac067c188a2d97877 (patch)
tree14fc10d3b55a96536a777af24f5e36f8c37ddd21 /build_sysroot
parent9410b5820a6a54dc0d13138173bf6a67387146b2 (diff)
downloadrust-0c34f5aba8544e2319c1587ac067c188a2d97877.tar.gz
rust-0c34f5aba8544e2319c1587ac067c188a2d97877.zip
Refactor the build system
Diffstat (limited to 'build_sysroot')
-rwxr-xr-xbuild_sysroot/build_sysroot.sh30
-rwxr-xr-xbuild_sysroot/prepare_sysroot_src.sh2
2 files changed, 14 insertions, 18 deletions
diff --git a/build_sysroot/build_sysroot.sh b/build_sysroot/build_sysroot.sh
index 7557f74b286..1d87562a6a4 100755
--- a/build_sysroot/build_sysroot.sh
+++ b/build_sysroot/build_sysroot.sh
@@ -3,28 +3,24 @@
 # Requires the CHANNEL env var to be set to `debug` or `release.`
 
 set -e
-cd $(dirname "$0")
 
-if [ -z $CHANNEL ]; then
-export CHANNEL='release'
-fi
+source ./config.sh
 
-pushd ../ >/dev/null
-source ./scripts/config.sh
-popd >/dev/null
+dir=$(pwd)
 
-# We expect the target dir in the default location. Guard against the user changing it.
-export CARGO_TARGET_DIR=target
+# Use rustc with cg_clif as hotpluggable backend instead of the custom cg_clif driver so that
+# build scripts are still compiled using cg_llvm.
+export RUSTC=$dir"/cg_clif_build_sysroot"
+export RUSTFLAGS=$RUSTFLAGS" --clif"
+
+cd $(dirname "$0")
 
 # Cleanup for previous run
 #     v Clean target dir except for build scripts and incremental cache
-rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} 2>/dev/null || true
-rm -r sysroot/ 2>/dev/null || true
+#rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} 2>/dev/null || true
 
-# Use rustc with cg_clif as hotpluggable backend instead of the custom cg_clif driver so that
-# build scripts are still compiled using cg_llvm.
-export RUSTC=$(pwd)/../"target/"$CHANNEL"/cg_clif_build_sysroot"
-export RUSTFLAGS=$RUSTFLAGS" --clif"
+# We expect the target dir in the default location. Guard against the user changing it.
+export CARGO_TARGET_DIR=target
 
 # Build libs
 export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort"
@@ -39,5 +35,5 @@ else
 fi
 
 # Copy files to sysroot
-mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
-cp -r target/$TARGET_TRIPLE/$sysroot_channel/deps/* sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
+mkdir -p $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
+cp -a target/$TARGET_TRIPLE/$sysroot_channel/deps/* $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
diff --git a/build_sysroot/prepare_sysroot_src.sh b/build_sysroot/prepare_sysroot_src.sh
index 14aa77478f5..d0fb09ce745 100755
--- a/build_sysroot/prepare_sysroot_src.sh
+++ b/build_sysroot/prepare_sysroot_src.sh
@@ -12,7 +12,7 @@ fi
 
 rm -rf $DST_DIR
 mkdir -p $DST_DIR/library
-cp -r $SRC_DIR/library $DST_DIR/
+cp -a $SRC_DIR/library $DST_DIR/
 
 pushd $DST_DIR
 echo "[GIT] init"