Getting the entire configure.cflags variable

Ryan Schmidt ryandesign at macports.org
Fri Oct 3 14:04:34 PDT 2014


> On Oct 3, 2014, at 11:44 AM, Sean Farley <sean at macports.org> wrote:
> 
> 
> Ryan Schmidt writes:
> 
>> On Oct 2, 2014, at 4:24 PM, Sean Farley wrote:
>>> 
>>> The petsc port, in an attempt to help users, ignores CFLAGS (and
>>> friends) from the environment due to many users that accidentally had
>>> them defined. So, I'm trying to pass the exact same CFLAGS to
>>> configure.args.
>> 
>> I see their configure script is some python monstrosity and that one of the files it includes contains:
>> 
>> 
>>  def resetEnvCompilers(self):
>>    ignoreEnv = ['CC','CFLAGS','CXX','CXXFLAGS','FC','FCFLAGS','F77','FFLAGS',
>>                 'F90','F90FLAGS','CPP','CPPFLAGS','CXXCPP','CXXCPPFLAGS',
>>                 'LDFLAGS','LIBS','MPI_DIR','RM','MAKEFLAGS','AR']
>>    for envVal in ignoreEnv:
>>      if envVal in os.environ:
>>        self.logPrintBox('***** WARNING: '+envVal+' (set to '+os.environ[envVal]+') found in environment variables - ignoring \n use ./configure '+envVal+'=$'+envVal+' if you really want to use that value ******')
>>        del os.environ[envVal]
>>    return
>> 
>> 
>> Perhaps that can be simply ripped out to allow env vars to work.
> 
> I work on the PETSc project, and yes, it is a python monstrosity. I
> could easily patch this but that isn't the point. For starters, patching
> a port for this would mean extra burden for the author.

No doubt.

> It would seem better to fix the MacPorts internals but I was never that
> good at Jenga.

Jenga indeed!

Fixing MacPorts so that all the flags that will be used are actually in the configure.cflags, configure.cxxflags, configure.ldflags would seem to be a good thing but will be a little complicated. We would have to take it one flag at a time.

Any ports that clear those variables should no longer do so. Instead they should "-delete" from them those values that they don't want there, for example "configure.ldflags-delete -L${prefix}/lib". This process could already be begun now.

"-pipe" seems to be easy since nothing in a portfile should affect it. It's only based on a macports.conf setting.

configure.cxx_stdlib is harder. We would have to put the -stdlib=... flag into configure.cxxflags by default. Then, we would have to put a variable trace on configure.cxx_stdlib so that if it is changed, the value is changed in configure.cxxflags. Additionally we have to consider the compiler: only clang can deal with libc++ so if the compiler is not a version of clang, then we shouldn't do that. We would have to have a trace on configure.cxx as well.

I did something like this in the app-1.0 portgroup with regard to dependencies. If you set app.icon to an image that is not already in icns format, a dependency on the makeicns port is added and it is later used to convert the icon. If you then set app.icon to an icns image, the dependency is removed again. Base does something similar with the autotools dependencies when you set or unset use_autoconf/use_autoreconf/use_automake.

"-arch" flags may or may not be doable. Joshua previously thought this was not fixable. 



More information about the macports-dev mailing list