Making a portfile from a cmake based project

Mojca Miklavec mojca at
Sat Feb 27 04:59:38 PST 2016

On 27 February 2016 at 13:47, Manu N <audionuma at> wrote:
> Hello,
> I would like to make a portfile from a cmake based project (
> ).
> Currently, I can build the library using MacPorts cmake and MacPorts
> libspeexdsp, which is an optional dependancy.
> I have been reading the pages, but
> couldn't find how I would port such a project.
> My main questions are :
> how do I get from a github project to a tarball

PortGroup           github 1.0
github.setup        jiixyj libebur128 1.1.0 v

The first two arguments in github.setup are project name and
repository name, the third one is the version and the last one is the
prefix before the version (in the tag).

Then use "sudo port -v extract" to get the checksums (disclaimer:
until someone starts complaining that this is not a "safe enough"
approach because something could already be compromised).

> how do I use the cmake scripts to actually build the library inside a
> portfile.

PortGroup           cmake 1.0
# optional, but we would be grateful if you tested and included this
cmake.out_of_source yes

This is basically all you need. If you want to switch some features
on/off, you could do something like

configure.args-append -DENABLE_TESTS=ON

> I hope this beginner questions are not too obvious and that someone can
> point me to the adequate documentation for these questions.

You can take a look at cmake-1.0.tcl and github-1.0.tcl or grep for
cmake/github in other ports.

The rest is the same as for other ports.


More information about the macports-dev mailing list