Exactly how do variants work?

Bjarne D Mathiesen macintosh at mathiesen.info
Sat May 5 00:26:29 PDT 2012


Ryan Schmidt wrote:
> 
> 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.

How about subports ??? That might be a solution if it's really optional
and really doesn't need a recompile of the primary port but 'just'
installs some extra files.

That's how eg mysql55 & mysql55-server works

-- 
Bjarne D Mathiesen
København N ; Danmark ; Europa
----------------------------------------------------------------------
denne besked er skrevet i et totalt M$-frit miljø
MacOS X 10.7.3 Lion ; 2.8GHz Intel Core i7 ; 16GB 1067MHz DDR3


More information about the macports-users mailing list