"hidden" variants?
Ryan Schmidt
ryandesign at macports.org
Sun Mar 8 21:23:50 PDT 2015
On Mar 8, 2015, at 1:39 PM, René J.V. Bertin wrote:
> Can a port have variants that it doesn't "advertise"? In other words, what happens if a portfile uses `variant_isset` to check whether or not a variant has been selected, but doesn't contain (or contains a commented-out) declaration for that variant?
> Am I right that everything still works normally and that the variant can thus be installed if you know it exists? Or would that be purely by accident?
>
> Context: the +exclusive variant of my co-installable qt4-mac port version. I'm quite confident by now that it is no longer required, but see no point in making it impossible to use just yet.
If a user requests a variant (e.g. "sudo port install someport +somevariant") -- regardless of whether that variant is declared in the port -- any code that uses variant_isset to determine if the variant is set (e.g. "if {[variant_isset somevariant]}") will be run. This is why, in portgroups that have to check if the universal variant is set, they also check if the universal variant actually exists, since in some ports it might not.
I do use some tricks in the minivmac port to hide the bootstrap variant, because the variant should only be used by the port maintainer, not by users.
More information about the macports-dev
mailing list