Repository: Gankra/abi-cafe (language: rust)

Issue:
why the fuck did i fork cc-rs? (make us cargo-install-able)
https://github.com/Gankra/abi-cafe/blob/42d906a0f6c422a9ae345abc3bb257483a369b69/Cargo.toml#L58

I'm guessing this was because cc-rs at the time expected to only be run from build.rs, where it should spew a million special directives to stdout, and it was a mess. Especially because I wanted stdout clean.

We use cc-rs because it abstracts away the details of running cc or a specific compiler toolchain on any platform, which is not code I personally want to write. 

It would be ideal for this to not be forked so abi-cafe could actually be published on crates.io...


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 7884a44..b7ab82a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,7 +8,7 @@ version = "0.3.0"
 dependencies = [
  "built",
  "camino",
- "cc 1.0.73",
+ "cc",
  "clap",
  "console",
  "include_dir",
@@ -114,7 +114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
 dependencies = [
  "addr2line",
- "cc 1.0.101",
+ "cc",
  "cfg-if",
  "libc",
  "miniz_oxide",
@@ -175,14 +175,9 @@ dependencies = [
 
 [[package]]
 name = "cc"
-version = "1.0.73"
-source = "git+https://github.com/Gankra/cc-rs#0f6c1fdae918171fe1174272ad637d8929527863"
-
-[[package]]
-name = "cc"
-version = "1.0.101"
+version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac367972e516d45567c7eafc73d24e1c193dcf200a8d94e9db7b3d38b349572d"
+checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8"
 
 [[package]]
 name = "cfg-if"
diff --git a/Cargo.toml b/Cargo.toml
index 29f33f2..7f8351e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -57,7 +57,7 @@ version = "0.3.0"
 
 [workspace.dependencies]
 camino = { version = "1.1.7", features = ["serde1"] }
-cc = { version = "1.0.73", git = "https://github.com/Gankra/cc-rs" }
+cc = { version = "1.1.0" }
 clap = { version = "4.5.4", features = ["cargo", "wrap_help", "derive"] }
 console = "0.15.8"
 kdl = "4.6.0"
diff --git a/src/toolchains/c.rs b/src/toolchains/c.rs
index e1759ba..53cb377 100644
--- a/src/toolchains/c.rs
+++ b/src/toolchains/c.rs
@@ -274,7 +274,12 @@ impl CcToolchain {
             TOOLCHAIN_CLANG => CCFlavor::Clang,
             TOOLCHAIN_MSVC => CCFlavor::Msvc,
             TOOLCHAIN_CC => {
-                let compiler = cc::Build::new().get_compiler();
+                let compiler = cc::Build::new()
+                    .cargo_metadata(false)
+                    .cargo_debug(false)
+                    .cargo_warnings(false)
+                    .cargo_output(false)
+                    .get_compiler();
                 if compiler.is_like_msvc() {
                     CCFlavor::Msvc
                 } else if compiler.is_like_gnu() {
@@ -332,6 +337,9 @@ impl CcToolchain {
             .file(src_path)
             .opt_level(0)
             .cargo_metadata(false)
+            .cargo_debug(false)
+            .cargo_warnings(false)
+            .cargo_output(false)
             .target(built_info::TARGET)
             .out_dir(out_dir)
             // .warnings_into_errors(true)


Test patch: