Making a portfile from a cmake based project

Manu N audionuma at gmail.com
Sat Feb 27 08:52:47 PST 2016


Hello again,
here's my current Portfile, located in a local portfile repository
~/ports/audio/libebur128

# $Id$
PortSystem          1.0
PortGroup           github 1.0
github.setup        jiixyj libebur128 1.1.0 v
github.tarball_from releases
PortGroup           cmake 1.0
# optional, but we would be grateful if you tested and included this
cmake.out_of_source yes
name                libebur128
version             1.1.0
categories          audio
platforms           darwin
maintainers         audionuma \
                    gmail.com:audionuma
description         loudness measure according to EBU R128
long_description    loudness measure according to EBU R128
homepage            https://github.com/jiixyj/libebur128
master_sites        https://github.com/jiixyj/libebur128
checksums               rmd160  2eb66acfd34557f66961e34b21fefa126fabb889 \
                        sha256
c60e78f4bfda387a0895c64a4fc9850445e3a4425cc98f9140885966ce17c1d1
depends_lib        port:speex-devel



2016-02-27 13:59 GMT+01:00 Mojca Miklavec <mojca at macports.org>:

> On 27 February 2016 at 13:47, Manu N <audionuma at gmail.com> wrote:
> > Hello,
> > I would like to make a portfile from a cmake based project (
> > https://github.com/jiixyj/libebur128 ).
> > Currently, I can build the library using MacPorts cmake and MacPorts
> > libspeexdsp, which is an optional dependancy.
> > I have been reading the https://guide.macports.org/#development 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).
>
>

OK.
Added a github.tarball_from releases command as there is a release on
github.
Nevertheless, I had to manually add the  libebur128-1.1.0.tar.gz file into
the /opt/local/var/macports/distfiles/libebur128 directory to have the
installation work, otherwise `port` was searching for the archive in it's
usual online repositories. Is that the expected behavior ?

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).
>
>
OK


> > 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
>
>
OK


> 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
>
>
Now, if I add the following lines to the Portfile (at the end)

variant with_tests description {Build tests suite} {
  configure.args-append -DENABLE_TESTS=ON
}

and run

port variants libebur128

the result is :

libebur128 has the variants:
   debug: Enable debug binaries
   universal: Build for multiple architectures

So it seems that my with_tests variant is not found.
I have tried a portindex command in the ~/ports directory with no success.



> > 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.
>
> Mojca
>
Thanks.
audionuma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20160227/da0f2c06/attachment-0001.html>


More information about the macports-dev mailing list