# Contributor: Carlo Landmeter
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libcdio
pkgver=0.94
pkgrel=2
pkgdesc="GNU Compact Disc Input and Control Library"
url="https://www.gnu.org/software/libcdio/"
arch="all"
license="GPL-3.0"
depends=
makedepends="libcddb-dev ncurses-dev linux-headers"
install=
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools ${pkgname}++:_cpp"
source="http://ftp.gnu.org/gnu/libcdio/${pkgname}-${pkgver}.tar.gz
	disable-broken-test.patch
	fix-cdtext-double-free.patch"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-vcd-info \
		--disable-static \
		--disable-rpath \
		--disable-cpp-progs
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
}

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/
}

sha512sums="e1d3c96c4acc7be923c97109c3f76223adc00b293278daef7d5008b1e5d67f33402f9f224f05120e9e1e8b3a8d1fa1b0bd5069dc6dd309741e3590e2c19e0e66  libcdio-0.94.tar.gz
be0149128bb2fa131f514bcff848279d826340a99a05b958e104f4640bda1a89d6146b0ec348783f4bbd8a3c313c41297152f75ee04f492f08b337bd79dd9c3e  disable-broken-test.patch
9beb2dcecb6d7d43f4d11c7cca0de8de9eb6e580e92c5665816bd0907960dd32d3573c2591deeb4ab23fe962c16af8043f2101a8fdb8f4163ecee960ce0a545d  fix-cdtext-double-free.patch"
