# Automatically generated by apkbuild-cpan, template 2
# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=perl-dbd-pg
_pkgreal=DBD-Pg
pkgver=3.7.0
pkgrel=0
pkgdesc="DBI PostgreSQL interface"
url="http://search.cpan.org/dist/DBD-Pg/"
arch="all"
license="GPL PerlArtistic"
cpandepends="perl-dbi"
cpanmakedepends="perl-dbi"
cpancheckdepends=""
depends="$cpandepends"
makedepends="perl-dev postgresql-dev $cpanmakedepends"
checkdepends="$cpancheckdepends"
subpackages="$pkgname-doc"
source="http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/$_pkgreal-$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

prepare() {
	default_prepare || return 1

	cd "$builddir"
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
	PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
}

build() {
	cd "$builddir"
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1
	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
}

check() {
	cd "$builddir"
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
	make test
}

sha512sums="edd4d3448dac1b563899c5fd4a1bad6cb810afdbbbf57b558bbe6710aa3e58530a6cf0932e35c3316c7f4f59763764d75ce1049f13c8c13deeb2e8a7c60ff73e  DBD-Pg-3.7.0.tar.gz"
