# -*- 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                vorbis-tools
version             1.4.2
revision            2
categories          audio
maintainers         nomaintainer

description         The Ogg Vorbis CODEC tools
long_description \
    Ogg Vorbis is a fully Open, non-proprietary, patent-and-royalty-free, \
    general-purpose compressed audio format for mid to high quality \
    (8kHz-48.0kHz, 16+ bit, polyphonic) audio and music at fixed and \
    variable bitrates from 16 to 128 kbps/channel. This places Vorbis in \
    the same competetive class as audio representations such as MPEG-4 \
    (AAC), and similar to, but higher performance than MPEG-1/2 audio \
    layer 3, MPEG-4 audio (TwinVQ), WMA and PAC.
license             GPL-2+ BSD LGPL-2+
homepage            http://www.vorbis.com/
master_sites        https://ftp.osuosl.org/pub/xiph/releases/vorbis/

patchfiles          c99-compatibility-fix.diff \
                    recursive-a-fix.diff

checksums           rmd160  f0f4f859b3a280dfe7ea9a13dc4c39ed3ed37c80 \
                    sha256  db7774ec2bf2c939b139452183669be84fda5774d6400fc57fde37f77624f0b0 \
                    size    1389947

depends_build       path:bin/pkg-config:pkgconfig

depends_lib-append \
                    port:libogg \
                    port:libvorbis \
                    port:curl \
                    port:libao \
                    port:gettext \
                    port:opusfile


configure.args \
    --mandir=${prefix}/share/man \
    --with-ao \
    --enable-ogg123 \
    --without-flac \
    --without-speex \
    --enable-vcut

use_autoreconf      yes
autoreconf.args        --force --install --verbose

variant flac description "Enable FLAC support" {
  depends_lib-append    port:flac
  configure.args-delete --without-flac
}

variant speex description "Enable Speex support" {
  depends_lib-append    path:lib/libspeex.dylib:speex
  configure.args-delete --without-speex
}

post-patch {
    reinplace "s|-O4|-O3|g" ${worksrcpath}/configure
}

post-destroot {
    file delete -force ${destroot}${prefix}/share/locale/locale.alias
    file delete -force ${destroot}${prefix}/lib/charset.alias
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     {vorbis-tools-(\d+(?:\.\d+)*).tar.gz}