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

pkgname=gnome-doc-utils
pkgver=0.20.10
pkgrel=3
pkgdesc="Documentation utilities for Gnome"
arch=('any')
license=('GPL' 'LGPL')
depends=('libxslt' 'python' 'docbook-xml' 'rarian')
makedepends=('intltool' 'libxml2-devel' 'libxslt-devel' 'libxml2-python')
url="https://www.gnome.org"
source=(https://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
        0.18.0-abs_top_srcdir.patch
        gnome-doc-utils-0.20.10-python3.patch
        more-python3-fixes.patch
        msysize.patch)
sha256sums=('cb0639ffa9550b6ddf3b62f3b1add92fb92ab4690d351f2353cffe668be8c4a6'
            '39cb4c5c1fdc59f3d03ce4362d579d216c1ac3910c1e8c5b1b4d052f63e447b3'
            'cf9bdb057cef5877a884117a607bf850df357c75c30a13d01ed77b2c36f78ee7'
            'd67166cbc39b5f759c4d3ede409e9db7f7eafb38f1fd8bd49e005eacbffb93ea'
            'db5db69b298fe27a29cb1c72ae2737f79bf04cbe871a98ceb9d1389865a31acd')

prepare() {
  cd "$pkgname-$pkgver"
  patch -p2 -i ${srcdir}/0.18.0-abs_top_srcdir.patch
  patch -p1 -i ${srcdir}/msysize.patch

  # From fedora: https://src.fedoraproject.org/rpms/gnome-doc-utils/blob/master/f/gnome-doc-utils-0.20.10-python3.patch
  patch -p1 -i ${srcdir}/gnome-doc-utils-0.20.10-python3.patch

  # Some more things I found, only partly tested. There is probably more...
  patch -p1 -i ${srcdir}/more-python3-fixes.patch
}

build() {
  cd "$pkgname-$pkgver"
  PYTHON=/usr/bin/python ./configure --prefix=/usr \
      --sysconfdir=/etc --mandir=/usr/share/man \
      --localstatedir=/var --disable-scrollkeeper
  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
}
