]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_gcc/build_sysroot/build_sysroot.sh
New upstream version 1.61.0+dfsg1
[rustc.git] / compiler / rustc_codegen_gcc / build_sysroot / build_sysroot.sh
CommitLineData
c295e0f8
XL
1#!/bin/bash
2
3# Requires the CHANNEL env var to be set to `debug` or `release.`
4
5set -e
6cd $(dirname "$0")
7
8pushd ../ >/dev/null
9source ./config.sh
10popd >/dev/null
11
12# Cleanup for previous run
13# v Clean target dir except for build scripts and incremental cache
14rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} 2>/dev/null || true
15rm Cargo.lock test_target/Cargo.lock 2>/dev/null || true
16rm -r sysroot/ 2>/dev/null || true
17
18# Build libs
19export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked -Cpanic=abort"
20if [[ "$1" == "--release" ]]; then
21 sysroot_channel='release'
22 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
23else
24 sysroot_channel='debug'
5e7ed085 25 cargo build --target $TARGET_TRIPLE --features compiler_builtins/c
c295e0f8
XL
26fi
27
28# Copy files to sysroot
29mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
30cp -r target/$TARGET_TRIPLE/$sysroot_channel/deps/* sysroot/lib/rustlib/$TARGET_TRIPLE/lib/