testing the value of ${CXX} in ports Makefile

Shane Ambler FreeBSD at ShaneWare.Biz
Sat Jan 31 07:50:16 UTC 2015


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


-- 
FreeBSD - the place to B...Software Developing

Shane Ambler



More information about the freebsd-ports mailing list