How can variant B imply variant A?

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue Aug 21 08:12:53 PDT 2012


On Tue, Aug 21, 2012 at 3:55 PM, Jeremy Lavergne wrote:
>> However, I'm still left with a tiny follow up (in case that it is
>> doable without too much hassle). Can the following be done (below is
>> just "pseudocode")?
>>
>>    variant wxt description "Enable wxWidgets" {
>>        if {![variant_isset wxwidgets] && ![variant_isset wxwidgets_devel]} {
>>            if {[port_isinstalled wxWidgets-devel]} {
>>                variant-enable wxwidgets_devel
>>            } else {
>>                variant-enable wxwidgets
>>            }
>>        }
>>    }
>
> Are the variants actually going to change the installed files when using -devel versus not?

I believe so. Not the files themselves, but the binary would change.
There is for example

#if wxCHECK_VERSION(2, 9, 0)
  /* GetWheelAxis: 0 is the Y axis, 1 is the X axis. */
  if (event.GetWheelAxis() > 0)
      mouse_button += 2;
#endif

in the source.

> I'd make separate ports, each cleaning depending on the version of wxwidgets they need.

This might be a bit of an overkill, mostly because once 3.0 is out
(scheduled for end of 2012 or beginning of 2013, but I would not be
surprized for an additional year of delay) there will be no more need
for dependency on devel version of wxWidgets, or rather: it won't
really matter if one would build against 3.0 or 3.1. At the moment the
big difference comes from inability to make x86_64 binaries with 2.8.
On top of that wxWidgets is an optional dependency.

> This is easily achieved with the new subports mechanism, to avoid having to repeat most of the Portfile code.

I definitely need to take a look into how subports work, but unless
another strong reason for subports arises, it might make sense to try
to do without them. I can hardly judge without having a deeper
understanding of subports. I'll see.

Independent of all that, my two questions still stand:
- Is it possible to enable a variant if I'm already too late for
"variant ... requires ..."?
- Is it possible to use "if port X is installed" inside Y's Portfile?

Mojca


More information about the macports-dev mailing list