# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
# Ported straight from Archlinux

pkgname=txt2html
pkgver=2.5201
pkgrel=1
pkgdesc="Convert plain text files to HTML"
arch=('i686' 'x86_64')
url="http://txt2html.sourceforge.net/"
license=('GPL' 'PerlArtistic')
depends=('perl>=5.10.0' 'perl-Getopt-ArgvFile')
options=(!emptydirs)
source=(https://www.cpan.org/authors/id/R/RU/RUBYKAT/${pkgname}-${pkgver}.tar.gz)
sha256sums=('8162bd4ff5de1022d69435b86ec8dc77f9379bc509388513a535722aec918203')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  sed -i 's/^use strict;$/&\nour ${VERSION};/' scripts/txt2html
  sed -i 's/use YAML/#use YAML/g' lib/HTML/TextToHTML.pm
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  /usr/bin/perl Build.PL --installdirs vendor
  ./Build
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./Build install --destdir "${pkgdir}" --install_path script=usr/bin
}
