# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libavc1394
pkgver=0.5.4
pkgrel=1
pkgdesc="Audio/Video Control library for IEEE-1394 devices"
url="https://sourceforge.net/projects/libavc1394/"
arch="all"
license="GPL-2.0-or-later LGPL-2.0-or-later"
depends=
depends_dev="libraw1394-dev"
makedepends="$depends_dev libtool automake autoconf"
[ "$ALPINE_LIBC" != "eglibc" ] && makedepends="$makedepends argp-standalone"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="http://downloads.sourceforge.net/libavc1394/libavc1394-$pkgver.tar.gz
	automake.patch
	argp.patch"

_builddir="$srcdir"/libavc1394-$pkgver
prepare() {
	local i
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	libtoolize && aclocal && autoconf && automake --add-missing
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		|| return 1
	make || return 1
}

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

sha512sums="ef07631cd2de9b79dec9d81247d705be318101e8f8a1fe007b946ffab3dfe7b97f392144614d867ef6b2315b6c0e82d53e915f07855d4e21401645293e18842a  libavc1394-0.5.4.tar.gz
8854bed6b9efa4b2bb56762614bcbceadb5cb1cdd393fd676476d40672cc3965962da764543f8628f51567a32ecf5035edb35b883b8963f94bce034ff4793c11  automake.patch
77bf60530b6b81f6bd3c69a11de7ac015f1182fcd8c2586d0fd9605818c3ccde310c386f30c00166853a405f60c13bf6b2d304327ec181de28609c58b215ab31  argp.patch"
