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

pkgname=yelp-tools
pkgver=3.38.0
pkgrel=2
pkgdesc="Tools for creating Yelp documentation"
arch=('any')
license=('GPL')
url="https://www.gnome.org"
depends=("yelp-xsl" "itstool" "libxml2-python")
options=('strip' '!libtool' 'staticlibs')
makedepends=("libxml2-python" "intltool" "itstool")
source=(https://download.gnome.org/sources/${pkgname}/${pkgver:0:4}/${pkgname}-$pkgver.tar.xz
        yelp-no-symlinks.patch)
sha256sums=('607ce4b3ee8517c42db924a01a78660a03317595c75825731ea86a920e2b04b0'
            '276286ade313f9c31a990e77742b20a34c59d50f84a21e5d05c38e5a8ee654be')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/yelp-no-symlinks.patch
  autoreconf -ivf
}

build() {
  mkdir -p ${srcdir}/build-${CHOST} && cd ${srcdir}/build-${CHOST}

  ${srcdir}/${pkgname}-${pkgver}/configure \
    --prefix=/usr \
    --build=${CHOST} \
    --host=${CHOST}

  make
}

check() {
  cd ${srcdir}/build-${CHOST}
  make -k check
}

package() {
  cd ${srcdir}/build-${CHOST}
  make DESTDIR="${pkgdir}" install
  for ff in yelp-build yelp-check yelp-new; do
    sed -e "s| xsltproc| /usr/bin/xsltproc|g" -i ${pkgdir}/usr/bin/$ff
  done
}
