susanmackay@optusnet.com.au writes:
I am trying to write a portfile for some software but I want to make sure that a particular variant of a dependency is installed. Is there some way that I can specify the variant within the portfile that I want to use? WOuld something like:
depends_lib port:otherport+variantname
work? (I'm away from the computer that is doing this at the moment so I can't experiment). If not, then I'll have to think of some other way of achieving my goal.
There is a characteristic of MacPorts base that can accomplish this, though it should be used with some care. Variants are passed to dependents, so if you install a port with a variant foo, and a dependency also has a variant foo, then the dependency will get installed with variant foo. This is fine for ports where a dependency is only used with a given port, or rarely used with anything else, or where the dependency is almost always installed using the variant anyway. Caveats are that if a dependency is already installed, it won't help a bit. Another is that if the conditions I mentioned do not hold, you may shield the user from having to learn something they'll only have to learn later anyway. But I've done this for a couple of ports where I thought it was warranted. See the comments in the server variant of the nedi port for an example. Mark