Ryan Schmidt ryandesign at macports.org
Wed May 18 10:28:47 PDT 2016

> On May 17, 2016, at 6:07 AM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> On a related note: would it be very hard to set up the gcc port(s) such that users can indicate which languages they wish to use the compiler for? IIRC gcc's configure script allows you to do just that via an option that receives a list of language codes, so it would guess that language variants could simply construct that option.
> A gcc build that only provides fortran (and/or Ada) should be considerably leaner than a build that provides everything, no?

Naturally a hypothetical gcc6 port that only provides a Fortran compiler would take less space and less time to build than one that also provides C, C++, and Java compilers. But then other ports that expect C, C++ or Java compilers to exist in the gcc6 port would fail to work. Other ports need to be able to declare a dependency on another port and be assured that the port contains the things they need.

Using variants to enable different languages is therefore not workable because MacPorts does not have the capability to declare dependencies on a variant of another port. So the only possible way it might work is by creating a subport for each language.

Besides that being a lot of work, I don't know if the gcc build system is arranged so that building different languages separately is possible. We separated libgcc into a subport some time ago, but that works by having both the libgcc port and the gccN port build everything, then delete the parts that aren't needed in the post-destroot phase, which is wasteful and makes the build take twice as long as it used to before the separation (but this separation is useful and so we tolerate this added build time, which is also mitigated by having binaries available from the buildbot). If the build system cannot accommodate building languages separately, having a subport for each language could quickly balloon the build times for the gccN ports.

The gcc build uses a 3-stage process, which, as I understand it, includes compiling the compiler, then using the compiler to compile itself again. That means the compiler for all languages used to write the compiler itself would be needed.

Building a compiler is a complicated affair, and the gcc6 portfile is already over 260 lines long. I don't really want to complicate it further. Not to mention that a build takes hours, so making and testing any extensive changes would be extremely time consuming.

More information about the macports-users mailing list