# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=perl-common-sense
pkgver=3.75
pkgrel=8
pkgdesc="Implements some sane defaults for Perl programs"
arch=(any)
url="https://search.cpan.org/dist/common-sense"
license=('PerlArtistic' 'GPL')
depends=('perl')
options=('!emptydirs')
source=("https://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/common-sense-$pkgver.tar.gz"
        fix-man3pods.patch)
sha512sums=('cb6034d9ff721a4122e0215db8ad5279ec4b189c3364593d427d70a1e84a1583a0e1447e276aa9a4fcaeb2f9d47a465a5bc4c0f842c803d3ddf91755311f4af4'
            '4e8d0edd1156c07dcdf82160ad1c38b70c8b45aa8a7bb865fccb59dab39fbc0e2fe073074d1f08fe560145f94176cc6010fc48b3f9b06c4a04136ae396b8a9f4')

prepare() {
  cd common-sense-$pkgver
  # Workaround for empty man page: the default generated Makefile processes
  # both sense.pm and sense.pod to the same location, but sense.pm results in
  # empty pod2man output.
  patch -p1 -i ../fix-man3pods.patch
}

build() {
  cd common-sense-$pkgver
  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd common-sense-$pkgver
  make test
}

package() {
  cd common-sense-$pkgver
  make DESTDIR="$pkgdir" install
}
