dev port or subport?

Ryan Schmidt ryandesign at macports.org
Thu Sep 25 12:46:57 PDT 2014


On Sep 25, 2014, at 1:44 PM, Lawrence Velázquez wrote:
> 
> On Sep 25, 2014, at 2:21 PM, Mark Brethen wrote:
> 
>> What is the accepted practice for dev ports? I'm porting a program that currently builds with fox but has the option of building with wxwidgets (i.e. doesn't require X11). The wx build doesn't have all of the features yet and should be considered under development. Should this be a separate port or subport? If subport, how do you set this up as conflicting with port name?
> 
> Subports are just an organizational tool. They're meant for cases where two separate Portfiles would share a significant amount of code. You could do something like this:
> 
>    PortSystem 1.0
>    name foo
>    version 1.23.45
>    license TO_KILL
> 
>    [a lot of common code]
> 
>    subport foo {

I was once chastised for writing "subport foo" when the port's name is "foo". Instead, what we usually write is:

if {${name} eq ${subport}} {


>        conflicts foo-wx
>        [foo-specific code]
>    }
> 
>    subport foo-wx {
>        conflicts foo
>        [foo-devel-specific code]
>    }
> 
> If there isn't all that much shared code, you might be better off with separate Portfiles.

In my ports so far, I've kept -devel ports as separate portfiles. Partly this stems from my -devel ports having been created before subports were invented, but I feel it also has a few advantages. Sometimes projects develop in drastic ways, resulting in major changes to build systems from one version to the next. For example, this occurs in my minivmac-devel portfile now, which differs now from the minivmac portfile. Also, it makes it easier if you actually want there to be other subports. For example, my graphviz portfile has graphviz-gui and gvedit subports, and my graphviz-devel portfile has graphviz-gui-devel and gvedit-devel subports. Getting all 6 into the same portfile would have involved an outer "loop" (over -devel and non-devel) and comes with some idiosyncrasies. I've attempted this strategy once, with the php port, but it makes for a very complicated port.


> Ideally you'd also wrangle the builds so that the ports could be installed at the same time.

I just want to point out that this applies to your suggested port names foo and foo-wx, but would not apply to foo and foo-devel ports, which are defined as installing their files to the same places.



More information about the macports-dev mailing list