# Template file for 'flac'
pkgname=flac
version=1.3.4
revision=2
build_style=gnu-configure
configure_args="--disable-rpath --disable-doxygen-docs --disable-xmms-plugin
 --with-ogg=${XBPS_CROSS_BASE}/usr --disable-thorough-tests"
hostmakedepends="pkg-config nasm"
makedepends="libogg-devel"
short_desc="Free Lossless Audio Codec"
maintainer="Colin Booth <colin-void@heliocat.net>"
license="BSD-3-Clause, GPL-2.0-or-later"
homepage="https://xiph.org/flac/"
changelog="https://xiph.org/flac/changelog.html"
distfiles="https://downloads.xiph.org/releases/flac/flac-${version}.tar.xz"
checksum=8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737
# the tests fail when run as root and as such break in the CI containers
make_check=ci-skip

# TODO: make into options
case "$XBPS_TARGET_MACHINE" in
	ppc64le*) configure_args+=" --enable-altivec --enable-vsx" ;;
	ppc64*) configure_args+=" --enable-altivec --disable-vsx" ;;
	ppc*) configure_args+=" --disable-altivec --disable-vsx" ;;
esac

post_install() {
	vlicense COPYING.Xiph
}

libflac_package() {
	short_desc+=" - shared libraries"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

libflac-devel_package() {
	depends="libogg-devel libflac>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove usr/share/aclocal
		vmove usr/share/doc
	}
}
