about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--.github/workflows/gcc12.yml2
-rw-r--r--.github/workflows/m68k.yml4
-rw-r--r--.github/workflows/release.yml2
-rw-r--r--.github/workflows/stdarch.yml2
-rw-r--r--Readme.md2
-rw-r--r--build_system/src/build.rs14
-rw-r--r--doc/tips.md4
8 files changed, 19 insertions, 13 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index eca08c7d749..69a0707c1f2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -78,7 +78,7 @@ jobs:
     - name: Build
       run: |
         ./y.sh prepare --only-libcore
-        ./y.sh build
+        ./y.sh build --sysroot
         cargo test
 
     - name: Run y.sh cargo build
diff --git a/.github/workflows/gcc12.yml b/.github/workflows/gcc12.yml
index f7bb1560492..44dca6be6a1 100644
--- a/.github/workflows/gcc12.yml
+++ b/.github/workflows/gcc12.yml
@@ -67,7 +67,7 @@ jobs:
     - name: Build
       run: |
         ./y.sh prepare --only-libcore --libgccjit12-patches
-        ./y.sh build --no-default-features --sysroot-panic-abort
+        ./y.sh build --sysroot --no-default-features --sysroot-panic-abort
         cargo test --no-default-features
         ./y.sh clean all
 
diff --git a/.github/workflows/m68k.yml b/.github/workflows/m68k.yml
index 25a5d2cf3d7..34e4f2b0d41 100644
--- a/.github/workflows/m68k.yml
+++ b/.github/workflows/m68k.yml
@@ -85,14 +85,14 @@ jobs:
     - name: Build sample project with target defined as JSON spec
       run: |
         ./y.sh prepare --only-libcore --cross
-        ./y.sh build --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
+        ./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
         ./y.sh cargo build --manifest-path=./tests/hello-world/Cargo.toml --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
         ./y.sh clean all
 
     - name: Build
       run: |
         ./y.sh prepare --only-libcore --cross
-        ./y.sh build --target-triple m68k-unknown-linux-gnu
+        ./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu
         CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
         ./y.sh clean all
 
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 60a71d7d3dd..84394b2957c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -53,7 +53,7 @@ jobs:
     - name: Build
       run: |
         ./y.sh prepare --only-libcore
-        EMBED_LTO_BITCODE=1 ./y.sh build --release --release-sysroot
+        EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
         cargo test
         ./y.sh clean all
 
diff --git a/.github/workflows/stdarch.yml b/.github/workflows/stdarch.yml
index e285e9119f7..20341ae53d7 100644
--- a/.github/workflows/stdarch.yml
+++ b/.github/workflows/stdarch.yml
@@ -58,7 +58,7 @@ jobs:
     - name: Build
       run: |
         ./y.sh prepare --only-libcore
-        ./y.sh build --release --release-sysroot
+        ./y.sh build --sysroot --release --release-sysroot
 
     - name: Set env (part 2)
       run: |
diff --git a/Readme.md b/Readme.md
index 92916079959..15999770145 100644
--- a/Readme.md
+++ b/Readme.md
@@ -80,7 +80,7 @@ Then you can run commands like this:
 
 ```bash
 $ ./y.sh prepare # download and patch sysroot src and install hyperfine for benchmarking
-$ ./y.sh build --release
+$ ./y.sh build --sysroot --release
 ```
 
 To run the tests:
diff --git a/build_system/src/build.rs b/build_system/src/build.rs
index 6313e4ffccb..ae2ad1a19a9 100644
--- a/build_system/src/build.rs
+++ b/build_system/src/build.rs
@@ -11,6 +11,7 @@ use std::path::Path;
 struct BuildArg {
     flags: Vec<String>,
     config_info: ConfigInfo,
+    build_sysroot: bool,
 }
 
 impl BuildArg {
@@ -31,6 +32,9 @@ impl BuildArg {
                         );
                     }
                 }
+                "--sysroot" => {
+                    build_arg.build_sysroot = true;
+                }
                 "--help" => {
                     Self::usage();
                     return Ok(None);
@@ -50,7 +54,8 @@ impl BuildArg {
             r#"
 `build` command help:
 
-    --features [arg]       : Add a new feature [arg]"#
+    --features [arg]       : Add a new feature [arg]
+    --sysroot              : Build with sysroot"#
         );
         ConfigInfo::show_usage();
         println!("    --help                 : Show this help");
@@ -205,9 +210,10 @@ fn build_codegen(args: &mut BuildArg) -> Result<(), String> {
     let _ = fs::remove_dir_all("target/out");
     let gccjit_target = "target/out/gccjit";
     create_dir(gccjit_target)?;
-
-    println!("[BUILD] sysroot");
-    build_sysroot(&env, &args.config_info)?;
+    if args.build_sysroot {
+        println!("[BUILD] sysroot");
+        build_sysroot(&env, &args.config_info)?;
+    }
     Ok(())
 }
 
diff --git a/doc/tips.md b/doc/tips.md
index 1379f5130be..6cc81871d02 100644
--- a/doc/tips.md
+++ b/doc/tips.md
@@ -54,13 +54,13 @@ generate it in [gimple.md](./doc/gimple.md).
 
  * Run `./y.sh prepare --cross` so that the sysroot is patched for the cross-compiling case.
  * Set the path to the cross-compiling libgccjit in `gcc-path` (in `config.toml`).
- * Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu`.
+ * Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu`.
  * Build your project by specifying the target: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu`.
 
 If the target is not yet supported by the Rust compiler, create a [target specification file](https://docs.rust-embedded.org/embedonomicon/custom-target.html) (note that the `arch` specified in this file must be supported by the rust compiler).
 Then, you can use it the following way:
 
- * Add the target specification file using `--target` as an **absolute** path to build the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json`
+ * Add the target specification file using `--target` as an **absolute** path to build the sysroot: `./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json`
  * Build your project by specifying the target specification file: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`.
 
 If you get the following error: