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

name                sox-ng
codeberg.setup      sox_ng sox_ng 14.7.1.1
revision            0
categories          audio
maintainers         nomaintainer
license             GPL-2+
conflicts           play sox
description         Swiss Army knife of audio manipulation
long_description \
	SoX (also known as Sound eXchange) translates sound samples between \
	different file formats, and optionally applies various sound \
	effects. SoX is intended as the Swiss Army knife of sound processing \
	tools. It doesn't do anything very well, but sooner or later it \
	comes in very handy.
distname            sox_ng-${version}
checksums           rmd160  4e4704f2871ef073a1aba7253383ddd9ff8c20d7 \
                    sha256  c97d0333b7bce7f03e9aa5eb8addc4256f7c95f60c1e9f803e3c6152b450faf7 \
                    size    1262895

conflicts           sox

# https://codeberg.org/sox_ng/sox_ng/issues/840
patchfiles          patch-coreaudio.diff

post-patch {
    reinplace "s|-I/usr/local/include/opus -I/usr/include/opus|-I${prefix}/include/opus|" ${worksrcpath}/configure.ac
}

use_autoreconf      yes

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib         port:flac \
                    port:lame \
                    port:libgsm \
                    port:libiconv \
                    port:libid3tag \
                    port:libmad \
                    port:libmagic \
                    port:libogg \
                    port:libopus \
                    port:libpng \
                    port:libsndfile \
                    port:libvorbis \
                    port:opusfile \
                    port:twolame \
                    port:wavpack \
                    port:zlib

configure.args      --disable-openmp \
                    --disable-silent-libtool \
                    --disable-silent-rules \
                    --enable-largefile \
                    --enable-symlinks \
                    --with-distro=macosx \
                    --without-libltdl

# additional formats
configure.args-append \
                    --with-flac \
                    --with-gsm \
                    --with-id3tag \
                    --with-lame \
                    --with-lpc10 \
                    --with-mad \
                    --with-magic \
                    --with-mp3 \
                    --with-oggvorbis \
                    --with-opus \
                    --with-png \
                    --with-sndfile \
                    --with-twolame \
                    --with-wavpack \
                    --without-amrnb \
                    --without-amrwb \
                    --without-ladspa

# output drivers
configure.args-append \
                    --without-ao \
                    --without-oss \
                    --without-sunaudio \
                    --without-waveaudio

platform darwin {
    configure.args-append \
                    --with-coreaudio \
                    --without-alsa \
                    --without-pulseaudio \
                    --without-sndio
}
