# $Id$
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
# stolen from Archlinux

_realname=docbook-dsssl
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.79
pkgrel=1
pkgdesc="DSSSL Stylesheets for DocBook (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://docbook.sourceforge.io/"
license=('custom')
depends=("${MINGW_PACKAGE_PREFIX}-sgml-common" "perl")
install="${_realname}-${CARCH}.install"
source=(https://sourceforge.net/projects/docbook/files/${_realname}/${pkgver}/${_realname}-${pkgver}.tar.bz2
        docbook-style-dsssl.Makefile)
sha256sums=('2f329e120bee9ef42fbdd74ddd60e05e49786c5a7953a0ff4c680ae6bdf0e2bc'
            '563662f6a3a0777f1ac037a0aebcfcdf7e9c8a8d3e042e69a33edffc0bcae1f1')

prepare() {
  cd "$srcdir"/ 
  cp -r "${_realname}-${pkgver}" "build-${CARCH}"
  cd "build-${CARCH}"
  cp ${srcdir}/docbook-style-dsssl.Makefile Makefile
}

package(){
  cd "$srcdir/build-${CARCH}"
  make install \
     BINDIR="${pkgdir}${MINGW_PREFIX}/bin" \
     DESTDIR="${pkgdir}${MINGW_PREFIX}/share/sgml/docbook/dsssl-stylesheets-${pkgver}" \
     MANDIR="${pkgdir}${MINGW_PREFIX}/share/man"
  
  ln -s dsssl-stylesheets-${pkgver} ${pkgdir}${MINGW_PREFIX}/share/sgml/docbook/dsssl-stylesheets
  # license
  install -Dm644 README "$pkgdir${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
