# Maintainer: Peter Budai <peterbudai at hotmail dot com>

pkgname=po4a
pkgver=0.54
pkgrel=1
pkgdesc="The po4a (PO for anything) project goal is to ease translations (and more interestingly, the maintenance of translations) using gettext tools on areas where they were not expected like documentation"
arch=('any')
url="https://po4a.org/"
license=('GPL')
depends=("perl" "gettext" 'perl-Text-WrapI18N' 'perl-Locale-Gettext' 
         'perl-TermReadKey' 'perl-sgmls'
         'perl-Unicode-GCString')
makedepends=('perl-Module-Build' 'docbook-xsl')
options=('!emptydirs')
source=(https://github.com/mquinson/po4a/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz
        001-fix-man-names.patch)
sha256sums=('596f7621697f9dd12709958c229e256b56683d25997ac73c9625a2cc0c603d51'
            'b2dc4f9cd6aa1ee38fa5a32b6f36847c34d876ce8852011e462c2ce7c6149aff')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/001-fix-man-names.patch
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  perl Build.PL INSTALLDIRS=vendor create_packlist=0
  # The script expects a UTF-8 locale
  LC_ALL=en_US.UTF-8 perl Build
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  perl Build destdir="${pkgdir}" install

  # remove perllocal.pod and .packlist
  find "${pkgdir}" -name .packlist -o -name perllocal.pod -delete
}
