# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Daniel Isenmann <daniel@archlinux.org>
# Contributor: Brice Carpentier <brice@dlfp.org>

# The mono-tool package now calls make-search-index by post_install().
# Whenever a package is installed which places doc-sources into:
# /usr/lib/monodoc/sources it should call --make-search-index with
# post_install() and with post remove. mond-tools itself deletes the index
# file pre_remove(), so pacman finds the directory empty an removes it
# properly.

pkgname=mono-tools
pkgver=4.2
pkgrel=4
pkgdesc="Collection of testing and development tools for use with mono"
arch=(x86_64 powerpc64le powerpc)
license=('GPL')
url="https://www.mono-project.com/"
depends=('gtk-sharp-2')
makedepends=('git' 'zip')
install=$pkgname.install
options=('!makeflags')
source=($pkgname-$pkgver.tar.gz::https://github.com/mono/mono-tools/archive/$pkgver.tar.gz
        drop-docbrowser-gendarme.patch
	monodoc.xml)
sha256sums=('104f7a7e98202c44cd4f025ab8a922bd193e83ce874a48e50ffb401128ca73a8'
            'f937cce8c59f50cb16f16103511af7ab45e13581becf172c4d16b370080c532a'
            '80de1af405556addbb481d9ac123e5f94b08ad7869c90fb469d71eb08c941480')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../drop-docbrowser-gendarme.patch
  mv configure.in configure.ac

  sed -e 's/-warnaserror+//' -i gendarme/options.make # Fix build with newer mono
}

build() {
  cd $pkgname-$pkgver
  glib-gettextize --force
  autoreconf -fi
  GMCS=/usr/bin/dmcs ./configure --prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -D -m644 "${srcdir}"/monodoc.xml "${pkgdir}"/usr/lib/monodoc/monodoc.xml
}
