# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=sgmls
pkgname="perl-${_realname}"
pkgver=1.03ii
pkgrel=2
pkgdesc="A Post-Processor for SGMLS and NSGMLS"
arch=('any')
url="https://search.cpan.org/dist/SGMLSpm"
license=('GPL' 'PerlArtistic')
depends=('perl')
options=('!emptydirs' 'docs')
source=(http://backpan.perl.org/authors/id/D/DM/DMEGG/SGMLSpm-${pkgver}.tar.gz)
sha256sums=('f06895c0206dada9f9e7f07ecaeb6a3651fd648f4820f49c1f76bfeaec2f2913')

prepare() {
  cd  $srcdir/SGMLSpm
  patch Makefile <<EOF
84a85
> 	find \${HTMLDIR} -type l -exec rm -f {} \;
EOF
}

package() {
  cd  $srcdir/SGMLSpm

  mkdir -p \
    $pkgdir/usr/bin \
    $pkgdir/usr/lib/perl5/vendor_perl/SGMLS \
    $pkgdir/usr/share/doc/perl-sgmls

  make install install_html \
    BINDIR=$pkgdir/usr/bin \
    PERL5DIR=$pkgdir/usr/lib/perl5/vendor_perl \
    HTMLDIR=$pkgdir/usr/share/doc/perl-sgmls

  find $pkgdir -name '.packlist' -delete
  find $pkgdir -name '*.pod' -delete
}
