HEADS UP: Ports are not ready for CFLAGS=-O2 in 6.0

Artem Ignatiev zazubrik at mail.ru
Sun Jul 10 19:07:54 GMT 2005


On 10.07.2005, at 20:56, Jeremie Le Hen wrote:

> Hi Artem,
>>> If we add something like this in ports/Mk/bsd.port.mk :
>>> %%%
>>>    .if defined(PORT_CFLAGS)
>>>    CFLAGS=${PORT_CFLAGS}
>>>    .end
>>> %%%
>>>
>>> This will obviously break POLA because setting CFLAGS won't work as
>>> expected.
>>>
>>
>> Why not :
>> .if defined(PORT_CFLAGS) && !defined(CFLAGS)
>> CFLAGS=${PORT_CFLAGS}
>> .endif
> For me, the goal of PORT_CFLAGS is to bring the possibility to specify
> _alternate_ CFLAGs when building port.  This means that PORT_CFLAGS
> needs to be usable even if CFLAGS is specified.  Typically,  
> make.conf(5)
> would contain both variables.
>> or even:
>> .if defined(PORT_CFLAGS)
>> CFLAGS=${PORT_CFLAGS} ${CFLAGS}
>> .endif
>
> The problem is mostly the same here.  If make.conf(5) contains :
> %%%
>     CFLAGS="-O2 -pipe -fomit-frame-pointer"
>     PORT_CFLAGS="-O -pipe"
> %%%
>
> what you have written above would lead to have CFLAGS containing :
>     -O -pipe -O2 -pipe -fomit-frame-pointer
>
> However, I'm maybe misunderstanding what you said.  In this case,
> correct me please.


Yeah, I missed this. I was trying to reach this:

If nothing regarding CFLAGS is given in the command line, port is  
built with PORTS_CFLAGS. If CFLAGS are set in command line, they are  
appended to PORTS_CFLAGS, thus effectively overriding PORTS_CFLAGS. I  
had missed that CFLAGS may be set in make.conf
Then, one of the solutions may be to change sys.mk so it saves CFLAGS  
given from environment/command line before parsing make.conf, and if  
we are building some port, restore or reevaluate CFLAGS using  
PORT_CFLAGS and user-set CFLAGS.



More information about the freebsd-current mailing list