]> git.lizzy.rs Git - rust.git/commitdiff
Better build dir layout
authorbjorn3 <bjorn3@users.noreply.github.com>
Sun, 8 Nov 2020 16:35:59 +0000 (17:35 +0100)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sun, 8 Nov 2020 16:35:59 +0000 (17:35 +0100)
It now matches the layout used by rustc itself

Readme.md
build.sh
build_sysroot/build_sysroot.sh
scripts/config.sh
scripts/test_bootstrap.sh
src/bin/cg_clif.rs

index f8a5e13ed54c177be18e3dd234369b02b79a4d85..de54bf67f4a19b7208613335ef998e05c42cb361 100644 (file)
--- a/Readme.md
+++ b/Readme.md
@@ -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.
 
 ```bash
-$ $cg_clif_dir/build/cg_clif my_crate.rs
+$ $cg_clif_dir/build/bin/cg_clif my_crate.rs
 ```
 
 ### Jit mode
@@ -68,7 +68,7 @@ $ $cg_clif_dir/build/cargo.sh jit
 or
 
 ```bash
-$ $cg_clif_dir/build/cg_clif --jit my_crate.rs
+$ $cg_clif_dir/build/bin/cg_clif --jit my_crate.rs
 ```
 
 ### Shell
@@ -77,7 +77,7 @@ These are a few functions that allow you to easily run rust code from the shell
 
 ```bash
 function jit_naked() {
-    echo "$@" | $cg_clif_dir/build/cg_clif - --jit
+    echo "$@" | $cg_clif_dir/build/bin/cg_clif - --jit
 }
 
 function jit() {
index fcaa99a0f7bf2fc9a682bf1b475787dadb0507fa..3d77d1d87291c54fe9af4b7a062a62c1b131cafe 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -36,7 +36,9 @@ fi
 
 rm -rf "$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"
 
 if [[ "$build_sysroot" == "1" ]]; then
index c356482058a70718d1854bfd65c7afe487dfdb05..0223cf74e81b439eb3daa31228bd6aa60ec4c578 100755 (executable)
@@ -10,7 +10,7 @@ dir=$(pwd)
 
 # 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 RUSTC=$dir"/bin/cg_clif_build_sysroot"
 export RUSTFLAGS=$RUSTFLAGS" --clif"
 
 cd "$(dirname "$0")"
@@ -35,6 +35,6 @@ else
 fi
 
 # Copy files to sysroot
-mkdir -p "$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/"
-cp -a "target/$TARGET_TRIPLE/$sysroot_channel/deps/"* "$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/"
-rm "$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/"*.{rmeta,d}
+mkdir -p "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
+cp -a "target/$TARGET_TRIPLE/$sysroot_channel/deps/"* "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
+rm "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"*.{rmeta,d}
index 10c0ec0e293f013b5d2b351f7700a903ea36d07c..1ac6bf265b42a185cb61588aab11ffe9357560b0 100644 (file)
@@ -43,17 +43,17 @@ fi
 
 dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
 
-export RUSTC=$dir"/cg_clif"
+export RUSTC=$dir"/bin/cg_clif"
 export RUSTFLAGS=$linker" "$RUSTFLAGS
 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
 if [[ $(uname) == 'Darwin' ]]; then
    export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
 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 CG_CLIF_DISPLAY_CG_TIME=1
index e8d5c628638c4d15416dfd5591492c172084d6e3..db69541b226cf8aba2167bfba8ea9569d73637db 100755 (executable)
@@ -48,7 +48,7 @@ cat > config.toml <<EOF
 ninja = false
 
 [build]
-rustc = "$(pwd)/../build/cg_clif"
+rustc = "$(pwd)/../build/bin/cg_clif"
 cargo = "$(rustup which cargo)"
 full-bootstrap = true
 local-rebuild = true
index 71ef4d2267368467d97492a6e1919298a3762ae8..891353e4b317c5b04c73065be4137d74c0818631 100644 (file)
@@ -32,7 +32,9 @@ fn config(&mut self, config: &mut interface::Config) {
                     .unwrap()
                     .parent()
                     .unwrap()
-                    .join("sysroot"),
+                    .parent()
+                    .unwrap()
+                    .to_owned(),
             ),
         );
     }