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

pkgbase=bisoncpp
pkgname=bisonc++
pkgver=6.09.02
pkgrel=1
pkgdesc='C++ parser generator'
arch=('i686' 'x86_64')
url='https://fbb-git.gitlab.io/bisoncpp/'
msys2_repository_url='https://gitlab.com/fbb-git/bisoncpp'
msys2_changelog_url='https://gitlab.com/fbb-git/bisoncpp/-/blob/master/bisonc++/changelog'
msys2_references=(
  'aur: bisonc++'
)
license=('spdx:GPL-3.0-or-later')
depends=('libbobcat')
makedepends=('icmake' 'gcc' 'libbobcat-devel' 'yodl')
source=("https://gitlab.com/fbb-git/bisoncpp/-/archive/${pkgver}/bisoncpp-${pkgver}.tar.gz")
# 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=('3f111818d7c08b3cb6008506c0f16b73ae806257e3f7f793f42e1ecb7e0183d2')

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

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/"
}
