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

name                libsmf
version             1.3
revision            3
checksums           rmd160  c6c15191b3c1dff313a3a9f16e8050910c65ede9 \
                    sha256  d3549f15de94ac8905ad365639ac6a2689cb1b51fdfa02d77fa6640001b18099 \
                    size    545850

categories          audio
platforms           darwin
maintainers         {ryandesign @ryandesign} openmaintainer
license             BSD

description         C library for handling SMF ("*.mid") files

long_description    LibSMF is a C library for handling SMF ("*.mid") files. It \
                    transparently handles conversions between time and pulses, \
                    tempo map handling, etc.

homepage            http://libsmf.sourceforge.net/
master_sites        sourceforge:project/libsmf/libsmf/${version}/

depends_build       port:pkgconfig

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:ncurses \
                    port:readline

configure.args      --with-readline

platform darwin arm {
    depends_build-append    port:automake

    post-patch {
        # Use newer config.guess and config.sub to support Apple Silicon.
        set automake_dirs [glob -directory ${prefix}/share automake-*]
        set automake_dir [lindex [lsort -command vercmp $automake_dirs] end]
        copy -force ${automake_dir}/config.guess ${automake_dir}/config.sub \
            ${worksrcpath}
    }
}
