# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: 
pkgname=sox
pkgver=14.4.2
pkgrel=1
pkgdesc="Convert between various audio formats"
url="http://sox.sourceforge.net/"
arch="all"
options="!check"  # No test suite.
license="GPL-2.0+ AND LGPL-2.1+ AND MIT AND BSD-1-Clause"
makedepends="alsa-lib-dev ffmpeg-dev file-dev flac-dev gsm-dev lame-dev
	libao-dev libid3tag-dev libmad-dev libogg-dev libsamplerate-dev
	libsndfile-dev libvorbis-dev opusfile-dev pulseaudio-dev
	autoconf automake libtool"
depends=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz
	disable-pipe-file-detection.patch
	sox-dynamic.patch
	"

prepare() {
	default_prepare
	autoreconf -vif
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-dyn-default \
		--with-distro="${DISTRO_NAME:-Adélie Linux}"
	make
}

package() {
	make DESTDIR="$pkgdir" install
	ln -sf play "$pkgdir"/usr/bin/rec
	ln -sf ../man1/sox.1.gz "$pkgdir"/usr/share/man/man7/soxeffect.7
	rm "$pkgdir"/usr/lib/sox/*.a
}

sha512sums="b5c6203f4f5577503a034fe5b3d6a033ee97fe4d171c533933e2b036118a43a14f97c9668433229708609ccf9ee16abdeca3fc7501aa0aafe06baacbba537eca  sox-14.4.2.tar.gz
eb90574a7c174a32ac77aa09a2bb4ebbea407463517e55943e16efd8b7c52393c6b7a6b2778d696f708627271f4d2212221a85fc50d2500b32143139a37a957a  disable-pipe-file-detection.patch
3950834db26faa0523006c6fd8e0769d080518f127d345c8ec9bf53e9db8a6bd67cd724f0f86492aaf9ce6ede2dfbde167049768f35c14ef3c2b96e7e00302b6  sox-dynamic.patch"