Better build dir layout

It now matches the layout used by rustc itself
This commit is contained in:
bjorn3 2020-11-08 17:35:59 +01:00
parent df45a06f89
commit cf3aa64c66
6 changed files with 17 additions and 13 deletions

View File

@ -51,7 +51,7 @@ This should build and run your project with rustc_codegen_cranelift instead of t
> You should prefer using the Cargo method. > You should prefer using the Cargo method.
```bash ```bash
$ $cg_clif_dir/build/cg_clif my_crate.rs $ $cg_clif_dir/build/bin/cg_clif my_crate.rs
``` ```
### Jit mode ### Jit mode
@ -68,7 +68,7 @@ $ $cg_clif_dir/build/cargo.sh jit
or or
```bash ```bash
$ $cg_clif_dir/build/cg_clif --jit my_crate.rs $ $cg_clif_dir/build/bin/cg_clif --jit my_crate.rs
``` ```
### Shell ### Shell
@ -77,7 +77,7 @@ These are a few functions that allow you to easily run rust code from the shell
```bash ```bash
function jit_naked() { function jit_naked() {
echo "$@" | $cg_clif_dir/build/cg_clif - --jit echo "$@" | $cg_clif_dir/build/bin/cg_clif - --jit
} }
function jit() { function jit() {

View File

@ -36,7 +36,9 @@ fi
rm -rf "$target_dir" rm -rf "$target_dir"
mkdir "$target_dir" mkdir "$target_dir"
cp -a target/$CHANNEL/cg_clif{,_build_sysroot} target/$CHANNEL/*rustc_codegen_cranelift* "$target_dir/" mkdir "$target_dir"/bin "$target_dir"/lib
cp -a target/$CHANNEL/cg_clif{,_build_sysroot} "$target_dir"/bin
cp -a target/$CHANNEL/*rustc_codegen_cranelift* "$target_dir"/lib
cp -a rust-toolchain scripts/config.sh scripts/cargo.sh "$target_dir" cp -a rust-toolchain scripts/config.sh scripts/cargo.sh "$target_dir"
if [[ "$build_sysroot" == "1" ]]; then if [[ "$build_sysroot" == "1" ]]; then

View File

@ -10,7 +10,7 @@ dir=$(pwd)
# Use rustc with cg_clif as hotpluggable backend instead of the custom cg_clif driver so that # 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. # build scripts are still compiled using cg_llvm.
export RUSTC=$dir"/cg_clif_build_sysroot" export RUSTC=$dir"/bin/cg_clif_build_sysroot"
export RUSTFLAGS=$RUSTFLAGS" --clif" export RUSTFLAGS=$RUSTFLAGS" --clif"
cd "$(dirname "$0")" cd "$(dirname "$0")"
@ -35,6 +35,6 @@ else
fi fi
# Copy files to sysroot # Copy files to sysroot
mkdir -p "$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/" mkdir -p "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
cp -a "target/$TARGET_TRIPLE/$sysroot_channel/deps/"* "$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/" cp -a "target/$TARGET_TRIPLE/$sysroot_channel/deps/"* "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
rm "$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/"*.{rmeta,d} rm "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"*.{rmeta,d}

View File

@ -43,17 +43,17 @@ fi
dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd) dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
export RUSTC=$dir"/cg_clif" export RUSTC=$dir"/bin/cg_clif"
export RUSTFLAGS=$linker" "$RUSTFLAGS export RUSTFLAGS=$linker" "$RUSTFLAGS
export RUSTDOCFLAGS=$linker' -Cpanic=abort -Zpanic-abort-tests '\ export RUSTDOCFLAGS=$linker' -Cpanic=abort -Zpanic-abort-tests '\
'-Zcodegen-backend='$dir'/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir'/sysroot' '-Zcodegen-backend='$dir'/lib/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$dir
# FIXME remove once the atomic shim is gone # FIXME remove once the atomic shim is gone
if [[ $(uname) == 'Darwin' ]]; then if [[ $(uname) == 'Darwin' ]]; then
export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup" export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
fi fi
export LD_LIBRARY_PATH="$dir:$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib" export LD_LIBRARY_PATH="$dir/lib:$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib"
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
export CG_CLIF_DISPLAY_CG_TIME=1 export CG_CLIF_DISPLAY_CG_TIME=1

View File

@ -48,7 +48,7 @@ cat > config.toml <<EOF
ninja = false ninja = false
[build] [build]
rustc = "$(pwd)/../build/cg_clif" rustc = "$(pwd)/../build/bin/cg_clif"
cargo = "$(rustup which cargo)" cargo = "$(rustup which cargo)"
full-bootstrap = true full-bootstrap = true
local-rebuild = true local-rebuild = true

View File

@ -32,7 +32,9 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
.unwrap() .unwrap()
.parent() .parent()
.unwrap() .unwrap()
.join("sysroot"), .parent()
.unwrap()
.to_owned(),
), ),
); );
} }