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

pkgbase=bisoncpp
pkgname=bisonc++
pkgver=6.02.01
pkgrel=1
pkgdesc='C++ parser generator'
arch=('i686' 'x86_64')
url='http://fbb-git.gitlab.io/bisoncpp/'
license=('GPL')
# Versions taken from the 'required' file in sources
depends=('libbobcat>=4.02.00')
makedepends=('icmake>=8.01.00' 'yodl>=3.08.01' 'libbobcat-devel>=4.02.00')
optdepends=()
source=("${pkgbase}::git+https://gitlab.com/fbb-git/bisoncpp.git#tag=${pkgver}"
        "manual_license.patch")
sha256sums=('SKIP'
            '6f41ebf87253fe458bd4ed5df297e2c69f10bdb73b929297a233df5bd0cd993e')

build() {
  cd "${srcdir}/${pkgbase}/bisonc++"

  patch -p1 -i "$srcdir/manual_license.patch"
  CXXFLAGS="$CXXFLAGS --std=c++14"
  # Add the -P option not to use precompiled headers, which can be useful since
  # they require a lot of free space, compared to a normal compilation:
  # ./build -P program
  ./build program
  ./build man
  ./build manual
}

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

  # Since 4.12.00, first argument to install is <what to install> (x = all),
  # and second is the base directory
  ./build install x "${pkgdir}"
}
