# $Id$
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
# shamelessly stolen from Archlinux
pkgname='sgml-common'
pkgver=0.6.3
pkgrel=2
pkgdesc='Tools for maintaining centralized SGML catalogs.'
arch=('any')
url='https://www.docbook.org/xml/'
msys2_references=(
  "anitya: 227355"
)
license=('GPL')
install='sgml-common.install'
depends=('sh')
makedepends=('autotools')
source=("https://ftp.osuosl.org/pub/blfs/conglomeration/sgml-common/sgml-common-${pkgver}.tgz"
        'sgml-common-0.6.3-manpage-1.patch')
noextract=("sgml-common-${pkgver}.tgz")
sha512sums=('3c4a55f555596b2a6bf6af66c497679226e7b40625ac16832150488311cba7f9fc523435eea5837262a5517f5c09c4c0e07fe4a2cf02184d4027609c26e4bc0c'
            'c584ff6e66e1d58456c07849bf96fedd3f1df0b93430f6301c4d4ab9906821dea0cbac82eada19197540b5e31f13febd04fadda5b6e2ba4b0b6ee8f0328292f7')

prepare() {
  cd $srcdir
  # work around an issue with symbolic links in the tarball.
  /usr/bin/bsdtar zxvf $srcdir/sgml-common-${pkgver}.tgz || true 
  cd "${srcdir}"/${pkgname}-${pkgver}
  # The symbolic links themselves were simply linking files from /usr/share/automake to the dist folder.
  cp /usr/share/automake-1.15/install-sh .
  cp /usr/share/automake-1.15/mkinstalldirs .
  cp /usr/share/automake-1.15/missing .
  cp /usr/share/automake-1.15/INSTALL .
  cp /usr/share/automake-1.15/COPYING .
  patch -Np1 -i ../sgml-common-0.6.3-manpage-1.patch

  WANT_AUTOCONF="2.69" autoreconf -vfi
}

build() {
  cd "${srcdir}"/${pkgname}-${pkgver}
  ./configure --prefix=/usr --sysconfdir=/etc
  make
}
package(){
  cd "${srcdir}"/${pkgname}-${pkgver}
  make DESTDIR="$pkgdir" docdir=/usr/share/doc install

#   "$pkgdir/usr/doc" "$pkgdir/usr/share/doc"
}

