Portfile dependencies relying on specific variant

Ryan Schmidt ryandesign at macports.org
Tue Oct 5 22:53:08 UTC 2021

On Oct 5, 2021, at 05:36, Frank Dean wrote:
> I've submitted a pull request [1] for a new Portfile, `mod_tile`, but the
> checks are failing because this port requires the `mapnik` port to be
> installed with a non-default variant, `+postgis`.  Similarly, it requires the
> `osm2pgsql` port to have been installed with `+lua`.
> [1]: https://github.com/macports/macports-ports/pull/12391
> I've specified the dependency with:
>    require_active_variants mapnik postgis
> If the dependent ports have not already been installed with the correct
> variant, simply performing a `port install` on `mod_tile` fails due to this
> dependency check, unless the install command includes the variant specifiers.
> 1.  How should I handle this so that the automated builds complete
>    successfully?

There is no solution. MacPorts base does not have the ability to depend on a variant of a port. (https://trac.macports.org/ticket/126)

> 2.  How can I improve the user experience in the same scenario?

The user experience is already as good as it can get, given how things currently work in MacPorts.

Ideally, ports should be designed so that they can depend on other ports wholesale without regard for variants.

For example, if osm2pgsql's lua support is something that other ports want to depend on, then either osm2pgsql should be modified so that it provides lua support unconditionally, or osm2pgsql's lua support should be broken out into another port (perhaps a subport) perhaps called osm2pgsql-lua.

More information about the macports-dev mailing list