pkgname=flex
pkgver=2.6.4
pkgdesc="A tool for generating text-scanning programs"
homepage="https://github.com/westes/flex"
license=('custom')
sources=("${pkgname}-${pkgver}.tar.gz")
urls=(
  "https://github.com/westes/flex/releases/download/v${pkgver}/${sources[0]}"
)
md5sums=("2882e3179748cc9f9c23ec593d6adc8d")


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

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

src_check() {
  make check
}

src_install() {
  make DESTDIR="$pkgdir" install
  ln -sv flex   "${pkgdir}/usr/bin/lex"
  ln -sv flex.1 "${pkgdir}/usr/share/man/man1/lex.1"
  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/license.txt"
}
