#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=less
pkgver=633
pkgrel=01
epoch=1
pkgdesc='A terminal based program for viewing text files'
url='https://www.greenwoodsoftware.com/less/'
depends=('glibc' 'ncurses' 'pcre2')
source=("https://www.greenwoodsoftware.com/$pkgname/$pkgname-$pkgver.tar.gz"
        "$pkgname-$pkgver.tar.gz.sig::https://www.greenwoodsoftware.com/$pkgname/$pkgname-$pkgver.sig")

prepare() {
  cd $pkgname-$pkgver
#  patch -Np1 < ../less-CVE-2022-46663.patch
  # apply patch from the source array (should be a pacman feature)
  local src
  for src in "${source[@]}"; do
    src="${src%%::*}"
    src="${src##*/}"
    [[ $src = *.patch ]] || continue
    echo "Applying patch $src..."
    patch -Np1 < "../$src"
  done

}

build() {
  cd $pkgname-$pkgver
  sh configure --prefix=/usr --sysconfdir=/etc --with-regex=pcre2
  make
}

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

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL3')

validpgpkeys=('AE27252BD6846E7D6EAE1DD6F153A7C833235259') # Mark Nudelman

sha256sums=(2f201d64b828b88af36dfe6cfdba3e0819ece2e446ebe6224813209aaefed04f  # less-633.tar.gz
	08707590b9d350f66394430960971c776f48649c2d2b175f9b8f23acbde551f7) # less-633.tar.gz.sig

##  5dea7d3f876493a9dbfa27a5c5a3976d4d83c180e3ccd18af47b98bf722b225b  less-1:633-01-x86_64.pkg.tar.lz
