gcc: provide build support for gccrs

Patches from the gccrs project are being upstreamed into gcc. With
these changes we are now able to build a gcc with rust support like
this:

```nix
wrapCC (gcc14.cc.override {
  langRust = true;
});
```

More info:

https://rust-gcc.github.io/

https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608387.html
This commit is contained in:
Daniel Nagy
2024-08-06 20:26:34 +02:00
committed by Alyssa Ross
parent a655585537
commit 4f85840d25
3 changed files with 9 additions and 0 deletions
@@ -24,6 +24,7 @@
, langObjC
, langObjCpp
, langJit
, langRust ? false
, disableBootstrap ? stdenv.targetPlatform != stdenv.hostPlatform
}:
@@ -171,6 +172,7 @@ let
++ lib.optional langObjCpp "obj-c++"
++ lib.optionals crossDarwin [ "objc" "obj-c++" ]
++ lib.optional langJit "jit"
++ lib.optional langRust "rust"
)
}"
]
@@ -31,6 +31,8 @@
, javaAwtGtk ? false
, langAda ? false
, langGo ? false
, langRust ? false
, cargo
, withoutTargetLibc ? null
, threadsCross ? null
}:
@@ -53,6 +55,7 @@ in
++ optionals javaAwtGtk [ pkg-config ]
++ optionals (with stdenv.targetPlatform; isVc4 || isRedox && flex != null) [ flex ]
++ optionals langAda [ gnat-bootstrap ]
++ optionals langRust [ cargo ]
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ optionals buildPlatform.isDarwin [ gnused ]
@@ -8,6 +8,8 @@
, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, langRust ? false
, cargo
, staticCompiler ? false
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
@@ -128,6 +130,7 @@ let
inherit
binutils
buildPackages
cargo
cloog
withoutTargetLibc
darwin
@@ -153,6 +156,7 @@ let
langJit
langObjC
langObjCpp
langRust
lib
libcCross
libmpc