
_realname=reflex
pkgname=${_realname}
pkgver=20210510
pkgrel=1
pkgdesc="A variant of the flex fast lexical scanner"
arch=('i686' 'x86_64')
url="https://invisible-island.net/reflex"
license=('BSD')
groups=('base-devel')

# source=("${_realname}-${pkgver}.tar.gz::https://invisible-island.net/datafiles/release/${_realname}.tar.gz")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/ThomasDickey/${_realname}-snapshots/archive/t${pkgver}.tar.gz")
sha256sums=('12b4f1b7b4d69bd43a8c976c5807fd1aeb2495ac4497c02d63f443c02d0eb900')


_src_dir=${_realname}-snapshots-t${pkgver}
_build_dir=build-${pkgver}-${MSYSTEM_CHOST}


prepare() {
  autoreconf -vfi ${_src_dir}
}

build() {
  mkdir -p ${_build_dir}
  cd ${_build_dir}
  ../${_src_dir}/configure -C
  make
}

check() {
  make -C ${_build_dir} check
}

package() {
  mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"
  cp -pv ${_src_dir}/package/debian/copyright "${pkgdir}/usr/share/licenses/${pkgname}"
  make -C ${_build_dir} DESTDIR=${pkgdir} install
}
