# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Martell Malone <martellmalone@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

pkgname=pacman-contrib
pkgver=1.4.0
pkgrel=2
pkgdesc="Contributed scripts and tools for pacman systems (MSYS2 port)"
arch=('i686' 'x86_64')
url="https://git.archlinux.org/pacman-contrib.git/about/"
license=('GPL')
depends=('perl'
         'pacman'
         'bash')
optdepends=('vim')
makedepends=('asciidoc'
             'autoconf'
             'automake-wrapper'
             'libtool'
             'libarchive-devel'
             'libcurl-devel'
             'libgpgme-devel'
             )
source=(https://git.archlinux.org/pacman-contrib.git/snapshot/${pkgname}-${pkgver}.tar.gz
        "0100-contrib.patch"
        '0001-pactree-fix-compilation-with-pacman-6.patch')
sha256sums=('8746f1352aaad990fe633be34f925d5ab8bd8a19a5f1274e72dbde426deb86bd'
            '4af0cced6f68504075f59a83517c550b97323dbbb72697d8ed3ddc33c2605f4f'
            '774d27532a91e2fe490ccc8d21c2d1d4d2a2dbfc8678a8406abb8bb8f9e6626c')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -p1 -i ${srcdir}/0100-contrib.patch
  patch -p1 -i ${srcdir}/0001-pactree-fix-compilation-with-pacman-6.patch

  ./autogen.sh
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}

  make check
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --disable-git-version

  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}

  make -j1 DESTDIR=${pkgdir} install
}
