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

pkgname=bison
pkgver=3.8.2
pkgrel=5
pkgdesc="The GNU general-purpose parser generator"
arch=('i686' 'x86_64')
license=('spdx:GPL-3.0-or-later')
url="https://www.gnu.org/software/bison/bison.html"
msys2_references=(
  "cpe: cpe:/a:gnu:bison"
)
depends=('m4' 'sh' 'libiconv' 'libintl')
options=('staticlibs')
makedepends=('flex' 'autotools' 'gcc' 'gettext-devel' 'libiconv-devel')
source=(https://ftp.gnu.org/gnu/bison/${pkgname}-${pkgver}.tar.xz{,.sig})
sha256sums=('9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2'
            'SKIP')
validpgpkeys=('7DF84374B1EE1F9764BBE25D0DDCAA3278D5264E')  # Akim Demaille <akim.demaille@gmail.com>

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

  autoreconf -vfi
}

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

  ./configure -C \
    --build=${CHOST} \
    --prefix=/usr \
    gl_cv_have_weak=no
  make
}

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

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