Setting compilation parameter for qt within portfile

Nicolas Pavillon nicos at macports.org
Fri Dec 2 21:11:33 PST 2011


Hello, 

On Dec 3, 2011, at 6:12 AM, Ryan Schmidt wrote:

> On Dec 2, 2011, at 09:33, Nicolas Pavillon wrote:
> 
>>>> Usually you would set the optimization level using:
>>>> 
>>>> configure.optflags -O0
>> 
>> I can confirm that qmake ignores this option. In fact, I tried standard to set within the portfile (and thus through environement/configure args) cflags, cmake cflags and qt cflags, but none worked for what I tried. This is a quite inconvenient behaviour. 
> 
> If this were a portgroup that would at least give you a single place to fix it. Is there value in creating a qmake portgroup? Or does this port already use the qt portgroup, and if so can it be fixed there?

The port indeed uses the qt4 portgroup. After investigating a little bit more, I realized it is finally possible to set it from portfiles. During all my previous tests, I had tried to set flags to O0, where I wave finding myself with a forced -02 option. However, forcing to delete this option as suggested in the patch of the ticket works also in portfiles. 

This means that putting

configure.pre_args  "QMAKE_CFLAGS_RELEASE-=-O2 QMAKE_CXXFLAGS_RELEASE-=-O2"

indeed cancels the optimization. The patched way is however better for the particular case of qtiplot, as it specifically cancels optimization in the module which hangs otherwise. 

This could however be used by the qt4 portgroup to provide a more intuitive behaviour. 

Cheers, 

Nicolas




More information about the macports-dev mailing list