# Maintainer: LoveSy <shana@zju.edu.cn>

pkgbase=bisoncpp
pkgname=bisonc++
pkgver=6.04.04
pkgrel=3
pkgdesc='C++ parser generator'
arch=('i686' 'x86_64')
url='https://fbb-git.gitlab.io/bisoncpp/'
license=('GPL')
depends=('libbobcat')
makedepends=('icmake'
             'gcc'
             'libbobcat-devel'
             'yodl'
            )
source=("https://gitlab.com/fbb-git/bisoncpp/-/archive/${pkgver}/bisoncpp-${pkgver}.tar.gz"
        'manual_license.patch'
        )
# need to untar gz-file manually, since makepkg's untar program seems
# not to be able to handle symlinks in the gz-file
noextract=("bisoncpp-${pkgver}.tar.gz")
sha256sums=('55df315fb925933ddd0ec4537e67275a62e454768badd4cf0baa1c84ec6237ab'
            '6f41ebf87253fe458bd4ed5df297e2c69f10bdb73b929297a233df5bd0cd993e')

prepare() {
  # unzip manually
  tar -xf "bisoncpp-${pkgver}.tar.gz"

  cd "${srcdir}/${pkgbase}-${pkgver}/bisonc++"
  patch -p1 -i "$srcdir/manual_license.patch"
}

build() {
  cd "${srcdir}/${pkgbase}-${pkgver}/bisonc++"
  ./build program
  ./build man
}

package() {
  cd "${srcdir}/${pkgbase}-${pkgver}/bisonc++"

  ./build install bm "${pkgdir}"
  rm -fr "${pkgdir}/usr/share/doc/"
}
