replaced_by multiple ports?

Jeremy Lavergne jeremy at
Tue Dec 11 13:40:15 PST 2012

> Could I have healpix depend on healpix-c and healpix-cxx?
> The healpix-* ports would share distfiles and some build arguments. What I have in my working copy right now is a modified version of the healpix Portfile (see attached) that contains healpix-c and healpix-cxx subports, a little reminiscent of the Python ports. Is this setup reasonable? What is the simplest way to make the main port a virtual port?

It's a good start.

Unfortunately, these new ports will conflict with the existing healpix (you can't cleanly install one on top of the other). Ryan's comment about the "deactivate hack" applies in this way. I think you can find example code by looking for "registry_deactivate_composite" in the ports tree. Ryan might have a direct link ready to go as an example, or perhaps we've added this to the HowTo section of the wiki.

I'd surround the build.post_args and destroot.post_args with a "if {${name} != ${subport}} {...}" block. This is code that only needs to exist in the subports and not in the soon-to-be-virtual one.

A virtual port simply installs only a single stub file, typically into ${prefix}/share/doc/${name}/. This should be in ${name} == ${subport}, where the parent port is active and not the differently-named subports. You can use the parent as a common livecheck for itself and the subports, and optionally set the subports to have no livecheck if you plan to batch check them (e.g. `port livecheck maintainer:snc`).

More information about the macports-dev mailing list