# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 87920 2011-12-12 19:29:52Z devans@macports.org $

PortSystem 1.0

name            slv2
version         0.6.6
revision        2
license         GPL-2+
maintainers     devans openmaintainer
categories      audio
platforms       darwin
homepage        http://wiki.drobilla.net/SLV2

description     SLV2 is a library to make the use of LV2 plugins as simple as possible for applications.

long_description \
                ${description}

master_sites    http://download.drobilla.net/

use_bzip2       yes

checksums       md5     b8e8e0e82dd04324fcd533e8acd1ce85 \
                sha1    7dc47153b1468056b0e30b1175c7fc57b184aaec \
                rmd160  8cba154a2eba0c1274a65e04e4adee309e7b4e37

depends_build   port:pkgconfig

depends_lib     port:redland \
                port:jack \
                port:lv2core

patchfiles      patch-raptor_symbol_fix.diff

post-patch {
        set redland_libs [exec ${prefix}/bin/pkg-config --libs redland]
        reinplace "s|@REDLAND_LIBS@|${redland_libs}|" ${worksrcpath}/slv2.pc.in
}

configure.cmd   ./waf configure

build.cmd       ./waf
build.target    build

destroot.cmd    ./waf
destroot.destdir --destdir=${destroot}

post-destroot {
        set bindir ${destroot}${prefix}/bin
        set libdir ${destroot}${prefix}/lib
        system "install_name_tool -change default/libslv2.dylib ${prefix}/lib/libslv2.dylib ${libdir}/libslv2.dylib"
        foreach util [glob ${bindir}/*] {
            system "install_name_tool -change default/libslv2.dylib ${prefix}/lib/libslv2.dylib ${util}"
        }
}

universal_variant no

variant docs description {Enable building of API documentation} {
        configure.args-append --build-docs
        depends_build-append port:doxygen
}

livecheck.type  regex
livecheck.url   ${master_sites}
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)"
