Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ghc: add support for Apple Silicon with ghc 8.10.3
This PR adds support to ghc.rb for Apple Silicon Macs. This PR removes the external build of gmp in favor of using the in-tree one as the in-tree one is statically linked these days (confirmed no external gmp references). The version in-tree is 6.1.2 which does not build on Apple Silicon so it is replaced by the formula with 6.2.1 which does. In order to get a full install with a working arm64 binary we currently need to build ghc in three steps: 1) Install the ghc binaries for x86_64 into a temporary directory (this is also done for x86_64). 2) Build a cross-compiler for arm64 using the x86_64 binary to bootstrap. 3) Use either the x86_64 binaries (on x86_64) or the cross-compiler to build a native ghc for the system. This PR relies on an extensive patch based on a PR to ghc 8.10.x. These patches add support for arm64-apple-darwin and correct some build system confusion between the ghc target name (aarch64-apple-darwin) and the llvm target name (arm64-apple-darwin). Some caveats: - This build takes awhile (over 2 hours). This is a significant build time for an M1 system given it is roughly twice as fast as a Core i9. - We can probably shorten the build time by using integer-simple and disabling other libraries but this formula is a stop-gap measure until upstream releases official support (ghc 9.x series). - There is no native code generator for arm64 at this time. The resulting binaries will likely be slower than if there was a native code generator. Patch updated by @SeekingMeaning Signed-off-by: Nathan Hjelm <[email protected]>
- Loading branch information