# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libdv
pkgver=1.0.0
pkgrel=3
pkgdesc="Software decoder for DV format video"
url="http://libdv.sourceforge.net/"
arch="all"
license="LGPL-2.0-or-later"
depends=
makedepends="gtk+-dev libxv-dev sdl-dev autoconf automake libtool
	linux-headers"
install=""
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
source="http://downloads.sourceforge.net/libdv/libdv-$pkgver.tar.gz
	libdv-0.104-no-exec-stack.patch
	libdv-1.0.0-dso-linking.patch
	libdv-1.0.0-pic.patch
	libdv-1.0.0-gtk2.patch
	automake.patch
	"

_builddir="$srcdir"/libdv-$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
	rm -f missing
	libtoolize --force && 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 \
		--with-pic \
		|| return 1
	make || return 1
}

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

tools() {
	pkgdesc="Basic tools to manipulate Digital Video streams"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="19887a6f452fa7da8924901ad841f5c4a434a3bde56c932ddb43717592aa744281e3a8ad220231e11d7e6bc3b0e704952a8324e5f85d4e088675edceeeca7dc8  libdv-1.0.0.tar.gz
b6477886fb07a15e7213fda0aa42364420aff32991b4a6b2fb24e4ac6064bcc83063bd091d6e00a58ac7faa7f142840ab5099b8f2365b1ca47646e02ac98b5fd  libdv-0.104-no-exec-stack.patch
de160c8cf9e0a7a3975958b42a4833a968a32448218800d975e84da71dcc2d7c55d0e08f01fd7b4c7a1d2e15487b401ec9f85436ebbed746b4749846665abfd6  libdv-1.0.0-dso-linking.patch
19397c8a5f5b0b3ec64909f1834715cf58baf3314c7a19e643c823e7b58177997d9ad56aa059a4da9d01a5c5084ddb6a861425ad9fb191b97b2ac1fff736513b  libdv-1.0.0-pic.patch
e2b8de4b1e8f9620f85b4e8f0f5aba5ac59c8912806ad06d4bcdc3f3e4448013ba3f968107a5fd6ba446e8ab9ff62505058eae540944c842b42ea67cda3a0c84  libdv-1.0.0-gtk2.patch
e219b4bf50f87cceb3a39d23b050945defa36cc343ad0ab87ce7491d4f21b7c2dee0c9e1e795bb332b8d94c5bfd59ac24f7cb74c77ac6f1aea4eea752bb002df  automake.patch"
