variants / sub-packages

Anders F Björklund afb at macports.org
Tue Apr 1 02:06:26 PDT 2008


Robert Hinn wrote:

> Hello,
>
> I was wondering: seeing some ports called *-devel in the list, does  
> MacPorts offer a sub-package mechanism?

Sadly, it doesn't. The "*-devel" ports are experimental/pre-release,  
like if "foo" is the stable release then "foo-devel" is the unstable  
version. This is like BSD Ports, but unlike RPM and DEB.

> I haven't found anything in the guide, so I considered using  
> variants as a proper way to handle optional features in a software  
> which I would otherwise build a sub-package for.

That's how it usually works. But there is only one package built,  
with all files.

> Also, following the discussion about binary builds, I think it  
> might get difficult if there are variants of a package that offer  
> optional features which result in some destroot files only being  
> built for certain variants. You'd have to specify which files  
> belong to which variant in that case... Is there already a  
> mechanism for that in the portfiles?

It is difficult, as each combination of variants will be a new  
package. Variants do not equal subpackages, like some other build  
systems have (for instance RPM has one separate file list for each  
subpackage, where as the variants are called "options" and given as  
rpmbuild arguments)

For archives (tgz/tbz/tlz), the variants used are encoded in the file  
name.
For packages (pkg/rpm/deb), all different variants use the same file  
name.

> I definitely like the idea of binary builds. Although I am a  
> developer, I usually like to get required packages into my system  
> as quickly and hasslefree as possible, so I can continue my work.  
> And I think most users wouldn't want a build environment on their  
> machine if they're not developers (the Mac OS X SDK is an optional  
> install, too ;-) ).

MacPorts doesn't yet have any such subpackages. So developer files  
are mandatory at the moment.

> I also like sub-packages (variants?) very much, since they reduce  
> the need for package dependencies which I don't really need on my  
> machine...

Sub-packages are nice, but variants aren't the same (they are also  
nice, but a different concept)

> Is it okay to use variants for sub-package-like behavior (which I  
> am currently doing in the pike port I updated), or should this done  
> another way?

Fink uses "Split-Off:" to designate subpackages:
http://wiki.finkproject.org/index.php/Fink:Shlibs_tutorial#SplitOffs

--anders



More information about the macports-dev mailing list