New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #30041 (closed enhancement: fixed)

Opened 23 months ago

Last modified 2 weeks ago

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

supported_compilers.patch (3.2 KB) - added by snc@… 19 months ago.

Change History

comment:1 Changed 23 months ago by ryandesign@…

  • Type changed from defect to enhancement

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?

Changed 19 months ago by snc@…

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.

comment:6 Changed 17 months ago by raimue@…

For reference, ticket #32542 tracks automatic handling of dependencies for configure.compiler.

comment:7 Changed 14 months ago by jmr@…

  • Milestone changed from MacPorts Future to MacPorts 2.1.0

comment:8 Changed 2 weeks ago by egall@…

  • Cc egall@… added

Cc Me!

Note: See TracTickets for help on using tickets.