diff options
author | Rick van Schijndel <Mindavi@users.noreply.github.com> | 2023-12-08 07:26:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-08 07:26:37 +0100 |
commit | 87e5690bba47126a6394d7c275f108932a11774b (patch) | |
tree | a7c369e3253ecc609a33a0584a9254783386835d | |
parent | f2aef2c530b744fb343e808bd496ffc2ae951ee9 (diff) | |
parent | f6e48acfa21ba34298e976c327939567135e1acc (diff) |
Merge pull request #271919 from emilytrau/avr-gcc8-aarch64-darwin
gcc8: support avr cross compilation on aarch64-darwin, qmk aarch64-darwin support pt. 1
-rw-r--r-- | pkgs/development/compilers/gcc/default.nix | 8 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch | 16 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/patches/default.nix | 5 |
3 files changed, 27 insertions, 2 deletions
diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 628b259acbd9c..eef6faf26424e 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -29,7 +29,7 @@ , buildPackages , pkgsBuildTarget , libxcrypt -, disableGdbPlugin ? !enablePlugin +, disableGdbPlugin ? !enablePlugin || (stdenv.targetPlatform.isAvr && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) , nukeReferences , callPackage , majorMinorVersion @@ -423,7 +423,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({ maintainers ; } // lib.optionalAttrs (!atLeast11) { - badPlatforms = if !(is48 || is49) then [ "aarch64-darwin" ] else lib.platforms.darwin; + badPlatforms = + # avr-gcc8 is maintained for the `qmk` package + if (is8 && targetPlatform.isAvr) then [] + else if !(is48 || is49) then [ "aarch64-darwin" ] + else lib.platforms.darwin; } // lib.optionalAttrs is11 { badPlatforms = if targetPlatform != hostPlatform then [ "aarch64-darwin" ] else [ ]; }; diff --git a/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch b/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch new file mode 100644 index 0000000000000..3705ed99c49a2 --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch @@ -0,0 +1,16 @@ +From https://gist.githubusercontent.com/DavidEGrayson/88bceb3f4e62f45725ecbb9248366300/raw/c1f515475aff1e1e3985569d9b715edb0f317648/gcc-11-arm-darwin.patch + +diff -ur a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c +--- a/gcc/config/host-darwin.c 2021-04-27 03:00:13.000000000 -0700 ++++ b/gcc/config/host-darwin.c 2021-06-11 14:49:13.754000000 -0700 +@@ -22,6 +22,10 @@ + #include "coretypes.h" + #include "diagnostic-core.h" + #include "config/host-darwin.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; + + /* Yes, this is really supposed to work. */ + /* This allows for a pagesize of 16384, which we have on Darwin20, but should \ No newline at end of file diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 32938be376d9b..55636b8ab51cd 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -215,6 +215,11 @@ in # which is not supported by the clang integrated assembler used by default on Darwin. ++ optional (is8 && hostPlatform.isDarwin) ./8/gcc8-darwin-as-gstabs.patch +# Make avr-gcc8 build on aarch64-darwin +# avr-gcc8 is maintained for the `qmk` package +# https://github.com/osx-cross/homebrew-avr/blob/main/Formula/avr-gcc%408.rb#L69 +++ optional (is8 && targetPlatform.isAvr && hostPlatform.isDarwin && hostPlatform.isAarch64) ./8/avr-gcc-8-darwin.patch + ## gcc 7.0 and older ############################################################################## |