# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Carlo Landmeter
# Maintainer:  Natanael Copa <ncopa@alpinelinux.org>
pkgname=wavpack
pkgver=5.1.0
pkgrel=0
pkgdesc="Audio compression format with lossless, lossy, and hybrid compression modes"
url="http://www.wavpack.com/"
arch="all"
license="BSD"
depends=""
makedepends=""
install=
subpackages="$pkgname-dev $pkgname-doc"
source="http://www.wavpack.com/${pkgname}-${pkgver}.tar.bz2"

# secfixes:
#   5.1.0-r0:
#   - CVE-2016-10169
#   - CVE-2016-10170
#   - CVE-2016-10171
#   - CVE-2016-10172

builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$builddir"
	default_prepare || return 1
}

build() {
	cd "$builddir"

	local _arch_opts=
	case "$CARCH" in
	x86 | x86_64) _arch_opts="--enable-mmx" ;;
	esac

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-static \
		$_arch_opts \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="7f06272651f0c2292c1d0ba353386782  wavpack-5.1.0.tar.bz2"
sha256sums="1939627d5358d1da62bc6158d63f7ed12905552f3a799c799ee90296a7612944  wavpack-5.1.0.tar.bz2"
sha512sums="4c31616ae63c3a875afa20f26ce935f7a8f9921e2892b4b8388eca3ccd83b2d686f43eed8b9ec1dead934a1148401b9dced3b05f509b7942c48d7af31cf80a54  wavpack-5.1.0.tar.bz2"
