# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: 
pkgname=cdparanoia
pkgver=10.2
pkgrel=8
pkgdesc="An audio CD extraction application"
url="https://xiph.org/paranoia"
arch="all"
options="!check"  # Build system has test suite commented out.
license="LGPL-2.0+"
depends=""
makedepends="libtool autoconf automake linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="http://downloads.xiph.org/releases/cdparanoia/$pkgname-III-$pkgver.src.tgz
	fix-includes.patch
	gcc.patch"

builddir="$srcdir/cdparanoia-III-$pkgver"

prepare() {
	default_prepare
	mv configure.guess config.guess
	mv configure.sub config.sub
	update_config_sub
	sed -i -e '/configure.\(guess\|sub\)/d' configure.in
	aclocal && autoconf
	libtoolize
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make -j1
}

package() {
	make prefix="$pkgdir"/usr MANDIR="$pkgdir"/usr/share/man install
}

libs() {
	pkgdesc="Libraries for libcdda_paranoia (Paranoia III)"
	replaces="cdparanoia"
	install -d "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
}

sha512sums="4ab0a0f5ef44d56c1af72d1fc1035566a1a89c4eeddb9e8baea675fe51c06138d913342afc8bed167d9fa55672fa25a2763ce21f7e24c1232e4739aff20733a7  cdparanoia-III-10.2.src.tgz
27bf216e8b5b9d6971e3999166544025f166587df06065b89657dac62d0d53c01b76f53146c1e9a400dd71460567fadb8fd4ce00576836f972914d69e8855909  gcc.patch
e8a5ef0f5bcdba697d2d49e31346832bfa2460e6f6cac9256420f57c74a5da2945bdc664368c91365a880ba76e638f58773468d8e8bd16e7afcaff955a1a82ce  fix-includes.patch"