# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=alsa-plugins
pkgver=1.1.5
pkgrel=1
pkgdesc="Alsa Plugins"
url="http://www.alsa-project.org"
arch="all !s390x"
license="GPL"
makedepends="linux-headers alsa-lib-dev speex-dev ffmpeg-dev libsamplerate-dev pulseaudio-dev jack-dev"
subpackages="$pkgname-lavcrate $pkgname-pulse $pkgname-a52 $pkgname-jack"
source="ftp://ftp.alsa-project.org/pub/plugins/$pkgname-$pkgver.tar.bz2"

prepare() {
	update_config_sub
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check(){
	cd "$builddir"
	make check
}

lavcrate() {
	pkgdesc="FFmpeg samplerate conversion plugins for alsa"
	mkdir -p "$subpkgdir"/usr/lib/alsa-lib/
	mv "$pkgdir"/usr/lib/alsa-lib/*lavcrate* "$subpkgdir"/usr/lib/alsa-lib/
}

pulse() {
	pkgdesc="Pulseaudio support plugins for alsa-only applications"
	mkdir -p "$subpkgdir"/usr/lib/alsa-lib/
	mv "$pkgdir"/usr/lib/alsa-lib/*pulse.so "$subpkgdir"/usr/lib/alsa-lib/
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
}

a52() {
	pkgdesc="Converts S16 linear sound format to A52 compressed format and sends it to an SPDIF output"
	mkdir -p "$subpkgdir"/usr/lib/alsa-lib/
	mv "$pkgdir"/usr/lib/alsa-lib/*a52.so "$subpkgdir"/usr/lib/alsa-lib/
}

jack() {
	pkgdesc="Allows native ALSA applications to work with jackd"
	mkdir -p "$subpkgdir"/usr/lib/alsa-lib/
	mv "$pkgdir"/usr/lib/alsa-lib/*jack.so "$subpkgdir"/usr/lib/alsa-lib/
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	find $pkgdir -name *.la -type f -exec rm -f {} \;
}

sha512sums="50a79d9dbcca72b2133aba7dca594302dcd5816eb71afc311a4c2a96aac7632a0a034875faf3100f2c8a44f3fbbede264e5cd9beacf2a07f2fa6786f66edae39  alsa-plugins-1.1.5.tar.bz2"
