Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#30041 closed enhancement (fixed)

Provide API for compiler blacklisting/whitelisting

Reported by: jeremyhu (Jeremy Huddleston Sequoia) Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.1.0
Component: base Version:
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), cooljeanius (Eric Gallager)
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 (1)

supported_compilers.patch (3.2 KB) - added by nerdling (Jeremy Lavergne) 13 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Type: defectenhancement

comment:2 Changed 13 years ago by nerdling (Jeremy Lavergne)

Cc: ryandesign@… added
Version: 1.9.2

Why not just implement this akin like supported_archs?

Changed 13 years ago by nerdling (Jeremy Lavergne)

Attachment: supported_compilers.patch added

comment:3 Changed 13 years ago by nerdling (Jeremy Lavergne)

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 13 years ago by jmroot (Joshua Root)

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 12 years ago by jmroot (Joshua Root)

Milestone: MacPorts Future
Resolution: fixed
Status: newclosed

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 12 years ago by raimue (Rainer Müller)

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

comment:7 Changed 12 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.1.0

comment:8 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

Note: See TracTickets for help on using tickets.