Exactly how do variants work?

Ryan Schmidt ryandesign at macports.org
Fri May 4 18:52:55 PDT 2012


On May 4, 2012, at 20:45, Ian Wadham wrote:

> My Macports installation has the following ports installed:
>    qt4-mac @4.7.4_1+mysql+quartz
>    kdegames4 @4.8.1_0
> 
> I would like to add variants +examples and +demos to qt4-mac and
> variant +docs to kdegames4.  These variants do not require all of
> qt4-mac and kdegames4 to be downloaded, re-built and reinstalled.
> They are just extra files that can be separately installed and/or built.
> 
> What port commands should I use to add a variant to an installed port?
> Do I need to uninstall and re-install the whole port?

Yes, unfortunately that's how variants in MacPorts work. There's no distinction between variants that completely change how a port builds and those that just install extra files.


> Also, to what extent are variant names local or global?
> 
> I seem to remember that, when I added +mysql to qt4-mac, every other
> port in the tree that had a +mysql variant also got built.  AFAIK +mysql
> for qt4-mac just adds some optional DB access classes to the library and
> builds a MySql "driver" for Qt to use.
> 
> If variant names are indeed global, how would I avoid having every installed
> port that has variants +examples, +demos or +docs being re-installed?


Variant selections are only global if you put them in the file /opt/local/etc/macports/variants.conf. Usually you don't do that; usually you just specify them on the command line, as in:

sudo port install qt4-mac +mysql +quartz +examples +docs +demos

Then those variants only apply to that port.




More information about the macports-users mailing list