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

pkgname=less
pkgver=679
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=('39d3f4f716d2889a7118f23e5ab561b50c8122ef51042dd114a40eda235716e1')
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
}
