# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
# stolen from Archlinux

pkgname=re2c
pkgver=4.2
pkgrel=1
arch=('i686' 'x86_64')
pkgdesc='A tool for generating C-based recognizers from regular expressions'
url='https://re2c.org/'
msys2_repository_url="https://github.com/skvadrik/re2c"
msys2_references=(
  "anitya: 7664"
  "cpe: cpe:/a:re2c:re2c"
)
license=('public domain')
depends=('gcc-libs')
makedepends=('cmake' 'gcc' 'python' 'ninja')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/skvadrik/re2c/archive/${pkgver}.tar.gz)
sha256sums=('01b56c67ca2d5054b1aafc41ef5c15c50fbb6a7e760b1b2346e6116ef039525e')

build() {
  cd ${pkgname}-${pkgver}
  cmake -GNinja -B build -DCMAKE_INSTALL_PREFIX=/usr
  cmake --build build
}

check() {
  cd ${pkgname}-${pkgver}
  cmake --build build --target check
}

package() {
  cd ${pkgname}-${pkgver}
  DESTDIR="${pkgdir}" cmake --install build
  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
