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

pkgname=bison
pkgver=3.8.1
pkgrel=1
pkgdesc="The GNU general-purpose parser generator"
arch=('i686' 'x86_64')
license=('GPL3')
url="https://www.gnu.org/software/bison/bison.html"
depends=('m4' 'sh')
groups=('base-devel')
options=('staticlibs')
makedepends=('flex')
install=bison.install
source=(https://ftp.gnu.org/gnu/bison/${pkgname}-${pkgver}.tar.xz{,.sig}
        bison-3.1-msys2.patch)
sha256sums=('31fc602488aad6bdecf0ccc556e0fc72fc57cdc595cf92398f020e0cf4980f15'
            'SKIP'
            '2ba57d420b630e57225b23f684317c7e399510a69a3ab9f3dcd5eafa4ff9c321')
validpgpkeys=('7DF84374B1EE1F9764BBE25D0DDCAA3278D5264E')  # Akim Demaille

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/bison-3.1-msys2.patch

  autoreconf -vfi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

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

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