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

pkgname=less
pkgver=621
pkgrel=2
pkgdesc="A terminal based program for viewing text files"
license=('GPL3')
arch=('i686' 'x86_64')
url="http://www.greenwoodsoftware.com/less"
depends=('ncurses' 'libpcre2_8')
makedepends=('ncurses-devel' 'pcre2-devel')
source=("https://github.com/gwsw//${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('cfcc4537e8bbabe0783ccf53a302b7341547bc98be5d8c8771616768aeca30de')
validpgpkeys=('AE27252BD6846E7D6EAE1DD6F153A7C833235259') # Mark Nudelman
if [ "${CARCH}" == 'x86_64' ]; then
       # Git for Windows' i686-bit SDK does not have the `autotools` package
       makedepends+=('autotools' 'gcc' 'groff')
fi

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
}
