Changes between Initial Version and Version 1 of Variants


Ignore:
Timestamp:
Mar 21, 2007, 1:45:55 AM (18 years ago)
Author:
rhwood@…
Comment:

Initial draft

Legend:

Unmodified
Added
Removed
Modified
  • Variants

    v1 v1  
     1Variants are a powerful feature of the MacPorts port system that allow users to install ports in other than the default manner, optionally enabling or disabling a feature or building a port with or without a dependency.
     2
     3== default_variants ==
     4In a portfile, you may use the line:
     5{{{default_variants variant1 variant2...}}}
     6to indicate that the port should, by default, build with those variants.
     7
     8Breaking variants out of the main port into conflicting variants where one variant is the default variant has the benifit of installing the port with the default variant embedded in the version. Consider the following ports:
     9
     10=== port Foo ===
     11{{{
     12version 1
     13configure.args --enable-this --enable-that
     14variant disable_this {
     15    configure.args_delete --enable-this
     16    configure.args_append --disable-this
     17}
     18}}}
     19=== port Bar ===
     20{{{
     21version 1
     22configure.args --enable-that
     23default_variants enable_this
     24variant enable_this conflicts disable_this {
     25    configure.args_append --enable-this
     26}
     27variant disable_this conflicts enable_this {
     28    configure.args_append --disable-this
     29}
     30}}}
     31When a user installs port Foo, port Foo installs as version @1_0 while port Bar installs as version @1_0+enable_this. Due to the way port Bar was written, the user knows what variants were applied when the port was installed.