# Contributor: Carlo Landmeter
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libcdio
pkgver=0.90
pkgrel=0
pkgdesc="GNU Compact Disc Input and Control Library"
url="http://www.gnu.org/software/libcdio/"
arch="all"
license="GPL3"
depends=
makedepends="libcddb-dev ncurses-dev"
if [ "$ALPINE_LIBC" != "eglibc" ]; then
	makedepends="$makedepends libiconv-dev"
fi
install=
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools ${pkgname}++:_cpp"
source="http://ftp.gnu.org/gnu/libcdio/${pkgname}-${pkgver}.tar.gz"

_builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	cd "$_builddir"
	# apply patches here
}

build() {
	cd "$_builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-vcd-info \
		--disable-static \
		--disable-rpath \
		--disable-cpp-progs
	make || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" install
	rm "$pkgdir"/usr/lib/*.la
}

tools() {
	pkgdesc="libcdio example tools"
	install -d "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

_cpp() {
	pkgdesc="libcdio bindings for C++"
	install -d "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*++.* "$subpkgdir"/usr/lib/
}

md5sums="1b245b023fb03a58d030fd2800db3247  libcdio-0.90.tar.gz"