pkgname=bison
pkgver=3.8.2
pkgdesc="The GNU general-purpose parser generator"
license=('GPL-3.0-or-later')
homepage="https://www.gnu.org/software/bison/bison.html"
sources=("${pkgname}-${pkgver}.tar.xz"
         "bison-3.8.2-gcc15-glibcxx-assertions.patch")
urls=("https://ftp.gnu.org/gnu/${pkgname}/${sources[0]}"
      "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-devel/bison/files/${sources[1]}")
md5sums=("c28f119f405a2304ff0a7ccdcc629713"
         "c82e47067aa2fb6f15ab930245b7bbb2")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  patch -Np1 -i ${distdir}/${sources[1]}
}

src_build() {
  ./configure --prefix=/usr --docdir=/usr/share/doc/${pkgname}-${pkgver}
  make
}

src_check() {
  make check
}

src_install() {
  make DESTDIR="$pkgdir" install
}
