Ticket #30041 (closed enhancement: fixed)
Provide API for compiler blacklisting/whitelisting
| Reported by: | jeremyhu@… | Owned by: | macports-tickets@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | MacPorts 2.1.0 |
| Component: | base | Version: | |
| Keywords: | Cc: | ryandesign@…, egall@… | |
| Port: |
Description
It would be nice if there were an API for easily blacklisting or whitelisting compilers in individual ports.
If a port lists a whitelist, the first available compiler in the whitelist would be used. If none is available, the first listed one available from MacPorts should be built and used.
If a port lists a blacklist, the current compiler is used as long as it's not in the blacklist. If it is in the blacklist, the first listed one in the fallback list is used. if none is available, the first listed one available from Macports should be built and used.
PseudoCode:
if whitelist
if default compiler is in whitelist
return default compiler
if whitelist contains an available compiler
return first available compiler in whitelist
if whitelist contains a MacPorts compiler
add first MacPorts compiler to depends_build
return first MacPorts compiler
return NULL
if blacklist
if default compiler is NOT in blacklist
return default compiler
if fallback contains an available compiler
return first available compiler in fallback
if fallback contains a MacPorts compiler
add first MacPorts compiler to depends_build
return first MacPorts compiler
return NULL
return default compiler
We could do something like this:
compiler.blacklist {llvm-gcc-4.2 clang macports-clang}
compiler.blacklist_fallback {gcc-4.2 apple-gcc-4.2 macports-gcc-4.6 macports-gcc-4.5 macports-gcc-4.4 macports-gcc-4.3}
This would result in using gcc-4.2 if available and *building* gcc-4.2 if not.
Attachments
Change History
comment:2 follow-up: ↓ 4 Changed 19 months ago by snc@…
- Cc ryandesign@… added
- Version 1.9.2 deleted
Why not just implement this akin like supported_archs?
comment:3 Changed 19 months ago by snc@…
I've attached some initial changes to add "supported_archs" for portfiles to set.
I also added a function to search for any binaries of all compilers known to MacPorts' internals.
comment:4 in reply to: ↑ 2 Changed 19 months ago by jmr@…
Replying to snc@…:
Why not just implement this akin like supported_archs?
As jeremyhu said via email:
But only having a whitelist would result in new compilers not being used. I'd rather have both options (blacklist + fallback and whitelist).
comment:5 Changed 17 months ago by jmr@…
- Status changed from new to closed
- Resolution set to fixed
- Milestone set to MacPorts Future
Implemented in r88676. Automatically adding a dependency is hard to do sanely because we don't know whether it should be build or lib (quite apart from the normal pain of figuring out if it's already been added). This is why setting configure.compiler didn't already add a dep for you. So that part is omitted, for now at least.

