210515
They added official gdc support to macOS on gcc11. Now official gcc package installs gdc.
original
From GCC 9, GDC (D frontend) is available on GCC. However, it is not stable on macOS and a little tweak is required.
-
gcc/config.gcc, gcc/config/darwin-d.c, gcc/config/t-darwin
- We need to tell gcc that D configuration is ready.
-
gcc/d/modules.cc
- Section name needs to be segment,section format.
- As libphobos/libdruntime/gcc/sections/osx.d mentions it, we selected
__DATA,__minfodata
.
-
libphobos/configure
- We disabled shared library.
- Otherwise core/thread.d fails to compile.
- By the way I have not heard of mach-dylib built with D.
-
libphobos/libdruntime/config/x86/switchcontext.S
- We stripped section manipulation according to https://stackoverflow.com/questions/20907946/error-unknown-directive-type-func-function .
-
libphobos/libdruntime/gcc/drtstuff.c
- start_minfo / stop_minfo needs to be compiled also on mach.
- As these two needs to be executable, we selected
__TEXT,minfo
.
-
libphobos/libdruntime/gcc/sections/osx.d
- We disabled libgphobos.dylib / libgdruntime.dylib warning.
- Please note that libgphobos.a / libgdruntime.a are not affected but the compile option would be complex because -static would not work on macOS.
- Also we add temporal
d_dso_registry
.
- We disabled libgphobos.dylib / libgdruntime.dylib warning.
-
This is combined as https://github.com/cielavenir/homebrew-ciel/blob/master/patch/gcc9.patch and testing formula is in https://github.com/cielavenir/homebrew-ciel/blob/master/patch/gcc.rb .
-
PR is at https://github.com/Homebrew/homebrew-core/pull/39712 .
-
Bottles are in https://dl.bintray.com/cielavenir/homebrew/ . For ease, I have upload the same file for high_sierra and mojave as well as sierra.