Commit 3d0de0e8 authored by Winter's avatar Winter
Browse files

gcc12: fix building foreign toolchain on aarch64-darwin

It seems that the patchset we apply to get some fixes for aarch64-darwin
support [0] breaks in unexpected ways when compiling a foreign toolchain [1].
Luckily, according to the branch's author, the patchset isn't required
for merely using aarch64-darwin as the build system [2], so let's only apply
it when hostPlatform == aarch64-darwin to fix cross.

[0]: https://github.com/iains/gcc-12-branch
[1]: https://github.com/iains/gcc-12-branch/issues/18
[2]: https://github.com/iains/gcc-12-branch/issues/18#issuecomment-1435792834
parent 6fcd1dcb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -64,7 +64,10 @@ let majorVersion = "12";
        ../gnat-cflags-11.patch
        ../gcc-12-gfortran-driving.patch
        ../ppc-musl.patch
      ] ++ optional (stdenv.isDarwin && stdenv.isAarch64) (fetchpatch {
      ]
      # We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
      # a foreign one: https://github.com/iains/gcc-12-branch/issues/18
      ++ optional (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) (fetchpatch {
        name = "gcc-12-darwin-aarch64-support.patch";
        url = "https://github.com/Homebrew/formula-patches/raw/1d184289/gcc/gcc-12.2.0-arm.diff";
        sha256 = "sha256-omclLslGi/2yCV4pNBMaIpPDMW3tcz/RXdupbNbeOHA=";