# -*- 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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           cmake 1.1

epoch               1
github.setup        PortMidi portmidi 2.0.7 v
github.tarball_from archive
revision            0

categories          audio devel
maintainers         nomaintainer
license             MIT

description         Free, cross platform, open-source, real-time MIDI I/O library.
long_description    ${description}

checksums           rmd160  fa48b47bf9800adde16aed3d8e48a01218bbd612 \
                    sha256  43fa65b4ed7ebaa68b0028a538ba8b2ca4dc9b86a7e22ec48842070e010f823f \
                    size    190701

# Building the Java interface and pmdefaults is disabled. They could be
# added as separate ports, with a dependency on an appropriate openjdk
# port, if there is interest.

patchfiles-append   patch-CMakeLists.txt.diff

configure.args      -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF \
                    -DBUILD_PORTMIDI_TESTS=ON

# pmmacosxcm.c: error: ‘for’ loop initial declaration used outside C99 mode
# Passing -std=c99 does not save though, the build then fails with numerous errors of the kind:
# readbinaryplist.c: error: ‘struct value_struct’ has no member named ‘integer’
compiler.blacklist-append *gcc-4.*

# There is no way to run the full test suite automatically.
# See pm_test/README.txt. So this just runs one of the tests
# that doesn't require manual MIDI input.
test.run            yes
test.env            DYLD_LIBRARY_PATH=.
test.cmd            ./qtest

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        README.txt \
        license.txt \
        pm_mac/README_MAC.txt \
        ${docdir}
}
