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

pkgname=yelp-tools
pkgver=3.14.1
pkgrel=1
pkgdesc="Tools for creating Yelp documentation"
arch=('any')
license=('GPL')
url="http://www.gnome.org"
depends=("yelp-xsl" "itstool" "libxslt-python" "libxml2-python")
options=('strip' '!libtool' 'staticlibs')
makedepends=("libxml2-python" "libxslt-python" "intltool" "itstool")
source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/${pkgver:0:4}/${pkgname}-$pkgver.tar.xz
        yelp-no-symlinks.patch)
sha256sums=('000222baf5d2db394df6025591054976b5cecd0b27872601de7538f36520f60f'
            'f5cdcdc450d2689196e37855f1fa3bcd2b4459563b1bf147c8b01e7e8b735979')

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}
  export PYTHON=/usr/bin/python2
  ${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
}
