testing the value of ${CXX} in ports Makefile

Don Lewis truckman at FreeBSD.org
Sun Feb 1 22:44:41 UTC 2015


On 31 Jan, Shane Ambler wrote:
> On 31/01/2015 10:55, Don Lewis wrote:
>> On 31 Jan, Shane Ambler wrote:
>>> On 30/01/2015 14:13, Don Lewis wrote:
> 
>> post-patch:
>> 	@echo CXX=${CXX}
>> 	@echo GCC_DEFAULT=${GCC_DEFAULT}
>> .if ${CHOSEN_COMPILER_TYPE} == gcc and ${COMPILER_VERSION} == 49
>> 	@echo g++49 was detected
>> .else
>> 	@echo g++49 was not detected
>> .endif
>>
>> # make patch
>> make: "/usr/ports/editors/junk/Makefile" line 17: Malformed conditional (${CHOSEN_COMPILER_TYPE} == gcc and ${COMPILER_VERSION} == 49)
>> make: Fatal errors encountered -- cannot continue
> 
> yeah my bad - don't know why I typed `and` instead of `&&`
> 
>>> You may also want to consider patching with -
>>>
>>> #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
>>> // 4.9 specific changes
>>> #endif
>>
>> That would work if I was patching C or C++ code, but I'm actually patching
>> a file that is used to set the the -O value for CFLAGS.  The build stuff
>> in the port is pretty strange and uses different optimization levels for
>> for different parts of the build and one of choices that it makes
>> triggers a code generation bug in gcc 4.9.
> 
> What is the build system used?
> 
> Can the build files do something like
> 
> COMPVERS=`${CXX} --version | grep -e gcc -e 4.9`
> if [ ! -z $COMPVERS ]
>    ${CXX} -O2
> else
>    ${CXX} -Os
> fi

As near as I can figure out, it's a mixture of gmake and dmake kicked
off by a perl wrapper and both flavors have to be patched.  It just
seems easier to use four lines of shell code to change two instances of
-Os than to try to figure out how to get two different flavors of make
to do what I want (and verify that it actually works).  I could maybe
use the time I save on creating a gcc bug report and getting the
compiler fixed.




More information about the freebsd-ports mailing list