Skip to content

Commit

Permalink
build sysroot flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lordshashank committed Apr 9, 2024
1 parent 2a88451 commit 29ab411
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gcc12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/m68k.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- 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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
15 changes: 11 additions & 4 deletions build_system/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::path::Path;
struct BuildArg {
flags: Vec<String>,
config_info: ConfigInfo,
build_sysroot: bool,
}

impl BuildArg {
Expand All @@ -31,6 +32,9 @@ impl BuildArg {
);
}
}
"--sysroot" => {
build_arg.build_sysroot = true; // Set the flag when --sysroot is encountered
}
"--help" => {
Self::usage();
return Ok(None);
Expand All @@ -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");
Expand Down Expand Up @@ -205,9 +210,11 @@ 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 {
// Only call build_sysroot if the flag is set
println!("[BUILD] sysroot");
build_sysroot(&env, &args.config_info)?;
}
Ok(())
}

Expand Down

0 comments on commit 29ab411

Please sign in to comment.