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

pkgname=po4a
pkgver=0.63
pkgrel=1
pkgdesc="Tools for helping translation of documentation"
arch=('any')
url="https://po4a.org/"
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=('e21be3ee545444bae2fe6a44aeb9d320604708cc2e4c601bcb3cc440db75b4ce'
            '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
}
