MacPorts Portability, etc.?

Joshua Root jmr at macports.org
Wed Sep 8 14:21:55 PDT 2010


On 28164-7-23 05:59 , David Abrahams wrote:
> Hi MacPorts developers,
> 
> I'm trying to assess the suitability of parts of the MacPorts codebase
> for use in the ryppl project (http://ryppl.org).  Accordingly, I have
> some questions about the internals.  In particular, I'd like to know:
> 
> 1) How tied to the Mac platform is MacPorts?  I don't mean the port
>    collection; I mean the implementation of the "port" command.  
> 
>    * Does it use Mac-specific functionality?

Yes, but none of it should be strictly required and it should all be
appropriately #ifdef'd or equivalent. I know base ran OK on Linux just
before the 1.9.0 release.

>    * Does it use *nix-specific functionality?

Probably. I don't know of anyone ever trying to build it on a non-Mac
platform that isn't Linux or *BSD.

> 2) What's the nature of MacPorts' dependency resolution algorithm?  
> 
>    * Is it very na?ve?  

The actual algorithm is: Check if the port named in the depspec is
active. If not, check if there is a file that matches the regex in the
depspec (if any). If not, add the the aforementioned named port to the
list of deps to install. Recurse.

>    * Does it always succeed in resolving dependencies when a
>      resolution is possible?  (Not unreasonable to ask; it's an
>      NP-complete problem).

Given the simple nature of our depspecs there aren't many cases where
resolution is impossible. Really the only one is conflicting ports.
These are detected and cause the operation to fail, meaning the user has
to take appropriate action to avoid the conflict.

>    * Does it have a heuristic for choosing the best resolution among a
>      collection of possible resolutions?

There are only two options as per the algorithm above. If a file that
satisfies the depspec is present, that gets used; otherwise the single
named port is used.

> 3) Is all of the code compatible with a BSD/MIT license model?  I
>    looked in a few files, and it all seemed to be, but I don't know if
>    there's a GPL'd module involved somewhere.

Everything in base should be BSD or equivalent.

- Josh


More information about the macports-dev mailing list