[PATCH] Let the default compiler be configurable

Jeremy Huddleston jeremyhu at macports.org
Thu Jun 9 20:20:08 PDT 2011


>>>>> We do already have some variables in macports.conf that can easily cause
>>>>> breakage and we don't support changing, namely binpath and extra_env.
>>>>> Maybe if we grouped all the setting in that category (optflags is the
>>>>> other one that comes to mind) in a section at the end of the file, with
>>>>> a strongly worded comment to the effect of "Changing these is not
>>>>> supported. If you do change them it is at your own risk. Do not report
>>>>> bugs or ask for support if something breaks after you change them."?
>>>> 
>>>> Perhaps. But what is the purpose of an option to change the compiler? If a port doesn't work with its default compiler, then that is a bug to be reported and fixed in that port. And if the port does work with its compiler, then why are we changing it?
>>> 
>>> Jeremy presumably had a reason to want to. That guy who reported
>>> libgcc_s conflicts on -users presumably has a reason he wants to build
>>> with FSF GCC.
>> 
>> We also had a user who wanted to use llvm-gcc for everything. But all that pointed out was that many ports didn't work with that.
>> 
>>> Besides, exactly the same arguments apply to binpath and extra_env.
>> 
>> I don't know why we have extra_env. But I know two reasons to have binpath: 1) it lets us check that ports are using the right compiler [1]; 2) it lets users use MacTeX instead of MacPorts' TeX Live.
>> 
>> [1] https://trac.macports.org/wiki/UsingTheRightCompiler
> 
> So we're in violent agreement: there can be reasons for using options
> which are nonetheless unsupported.

I'm perfectly content adding this to my own patches that I apply to base, but I thought it would be useful for others.

My main reason for doing this is that I want to use clang as my default compiler in order to expose bugs.  I've been using clang consistently over the last year to build XQuartz.  In doing so, I was able to find (and help fix) a couple compiler bugs, and more importantly, the compiler's enhanced warnings were able to find some bugs in X11 that I would've otherwise missed.

So there's no reason we'd want to let end users do this, but it is nice for developers.

Perhaps we could add in options like this that are developer namespaced in some fashion...



More information about the macports-dev mailing list