# Maintainer: Peter Budai <peterbudai at hotmail dot com>
# Contributor: Biswapriyo Nath <nathbappai@gmail.com>

pkgname=po4a
pkgver=0.73
pkgrel=1
pkgdesc="Tools for helping translation of documentation"
arch=('any')
url="https://po4a.org/"
msys2_repository_url="https://github.com/mquinson/po4a"
license=('GPL')
depends=("perl" "gettext" 'perl-YAML-Tiny' 'perl-Text-WrapI18N'
         'perl-Locale-Gettext' 'perl-TermReadKey' 'perl-sgmls'
         'perl-Unicode-LineBreak' 'perl-Pod-Parser')
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=('6f18f82d8cb2a377394137ea396cc3e8195d6cd6e454fe0218aa0f0e36038ea0'
            '77e6dd250bc9562efa05614821db0597b9855e677435b9342d9323419b9a1e20')

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
}
