testing the value of ${CXX} in ports Makefile

Don Lewis truckman at FreeBSD.org
Sat Jan 31 00:41:22 UTC 2015

On 30 Jan, Tijl Coosemans wrote:
> On Thu, 29 Jan 2015 22:46:32 -0800 (PST) Don Lewis <truckman at FreeBSD.org> wrote:
>> gcc46, gcc47, gcc48, and probably gcc5 (haven't tested that one yet) all
>> work.  gcc49 requires a source patch.
> Can't you make the patch work with all versions of gcc?

Well, I could, but what's the fun in that?

The port wants to use -Os when compiling some of it's code.  It switches
to -O0 if compiling for DEBUG.  Unfortunately, with gcc 4.9, -Os seems
to trigger a code generation bug.

The alternatives that I've considered:

  Set USE_GCC=4.8, the downside being that when the default ports
  version of gcc is changed to 4.9, anyone using the port will need
  to install gcc 4.8 as well to get the correct version of the gcc

  Patch the port to always use -O0, the downside being that when using
  gcc 4.8, the code size gets larger.  I haven't quantified by how much.

  Only patch the port when building with gcc 4.9.

  Patch the port configure script to detect the gcc version and adjust
  the optimization level accordingly.

The third option is fairly easy to do, but has to be done with shell
code instead of .if / .endif in the Makefile.

If the port actually obeyed CFLAGS, I think adjusting the optimization
level by changing CFLAGS is also possible, but would require me to study
the make documentation since using .if / .endif still wouldn't work.  I
think it would require a bunch of make variable expansion magic that I
don't fully understand.

Upstream would probably prefer the fourth option, but that's more
difficult and I don't want to put that much effort into it.

More information about the freebsd-ports mailing list