How to depend on a variant (or do I want subports)?

Ryan Schmidt ryandesign at macports.org
Wed Oct 31 13:00:27 PDT 2012


On Oct 31, 2012, at 14:30, Gregor Jasny <gjasny at googlemail.com> wrote:

> recently I forked Xsnmp because the author completely stepped back from
> maintaining it. It can be found here: https://github.com/gjasny/Xsnmp
> 
> There is an Xcode project to build a complete installer including a
> (IMHO) limited preferences pane to enable the SNMP deamon and the Xsnmp
> agent.
> 
> For my own servers I'd prefer having Xsnmp in MacPorts. This would ease
> starting and upgrading.
> 
> Now to my question: xsnmp depends on the libnetsnmp and libnetsnmpagent
> libraries and headers. They are provided by MacOS itself. But as an
> alternative port I'd have to specify net-snmp. Unfortunately these libs
> are only provided in the +server variant.
> 
> So how do I achieve the necessary dependency? I read some vague things
> about subports but did not find any concrete documentation.

MacPorts doesn't let you declare a dependency on a variant of a port. It's issue #126. If the +server variant of net-snmp installs libraries, and other ports might want to use those libraries, then the +server variant of net-snmp should probably be turned into a net-snmp-server subport. net-snmp appears to be maintained by me :) but I don't really know much about it, so I wasn't aware that the +server variant installed any libraries. Can you think of any reason why we shouldn't delete the +server variant and just make the port install those parts always?


> For reference I attached the preliminary Xsnmp Portfile. Once I make a
> real 1.2.0 release I'll convert it to using tarballs.

You have three "depends_lib" lines; they overwrite each other. You probably want to have only one depends_lib line, or else the subsequent ones should be depends_lib-append.


> PS: How to specify beta version numbers? I assume 1.2.0-beta1 is newer
> that 1.2.0. In Debian I'd use 1.2.0~beta1.

MacPorts doesn't have a rule about that. We generally just use the version number as published by the upstream project. "~" seems like a strange character to see in a version number so if upstream has not specified how the version number is to be written, then I would suggest a dash (1.2.0-beta1) or no separator (1.2.0beta1 or 1.2.0b1).



More information about the macports-dev mailing list