# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=less
pkgver=685
pkgrel=1
pkgdesc="A terminal based program for viewing text files"
license=('GPL3')
arch=('i686' 'x86_64')
url="http://www.greenwoodsoftware.com/less"
msys2_repository_url="https://github.com/gwsw/less"
msys2_references=(
  "cpe: cpe:/a:gnu:less"
)
depends=('ncurses' 'libpcre2_8')
makedepends=('ncurses-devel' 'pcre2-devel' 'autotools' 'gcc' 'groff')
source=("https://github.com/gwsw/${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('507699ab586a420600bbbb21266ea4ddce6953af4ed3442eba9c5f36ea362c91')
validpgpkeys=('AE27252BD6846E7D6EAE1DD6F153A7C833235259') # Mark Nudelman

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}

  autoreconf -vfi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make -f Makefile.aut distfiles

  ./configure \
      --build=${CHOST} \
      --prefix=/usr \
      --sysconfdir=/etc \
      --with-regex=pcre2
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
