# Maintainer (arch): Konstantin Gizdov <arch at kge dot pw>
# Contributor (arch): Baptiste Jonglez <archlinux at bitsofnetworks dot org>
# Contributor (arch): Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Contributor (arch): solsTiCe d'Hiver <solstice.dhiver@gmail.com>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Omar Vega Ramos <ovruni@gnu.org.pe>
# Maintainer: Parabola Hackers <dev@lists.parabola.nu>

# parabola changes and rationale:
# - Recomment librachive instead of unrar

pkgname=lesspipe
pkgver=2.07
pkgrel=1
pkgrel+=.par1
pkgdesc='an input filter for the pager less'
pkgdesc+=', with libarchive recommendation'
depends=('less' 'perl')
makedepends=('zsh')
arch=('any')
license=('GPL')
replaces=(${pkgname}-libre)
conflicts=(${pkgname}-libre)
optdepends=('rpmextract: support for rpm files'
	    'fastjar: support for jar files'
	    'unzip: support for zip files'
	    'libarchive: support for rar files'
	    'p7zip: support for 7za files'
	    'cabextract: support for cab files'
	    'cdrtools: support for iso files'
	    'html2text: support for html files'
	    'ghostscript: support for ps files'
	    'djvulibre: support for DjVu files'
	    'odt2txt: support for OpenDocument files'
	    'antiword: support for word file'
	    'catdoc: support for word file'
	    'pandoc: support for word file'
	    'libreoffice-fresh: support for MS Office files'
	    'unrtf: support for rtf file'
	    'mediainfo: support for mp4 file'
	    'imagemagick: support for some image file')
url="https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html"
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/wofr06/lesspipe/archive/refs/tags/v${pkgver}.tar.gz"
        'lesspipe.sh')
b2sums=('b9be5968d808dc57caa00551cdf663be75dff1c9662b585ddd2e1891f6f66fce0b71a468d9b9172af2833bd6ee255ad9b5fb917dac527eeb8b57427c568cd620'
        'bf7dfbd8e00257995e1be518e1c46619139635e33dd4f6fbb89340b6a94494f076095efd6351829d390eaf0ed6e119dbc3fba3a7bc39d8e83f093c458df792b2')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  PREFIX=/usr make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  mkdir -p "${pkgdir}"/usr/share/man/man1
  make DESTDIR="${pkgdir}" PREFIX=/usr install
  install -D "${srcdir}"/lesspipe.sh "${pkgdir}"/etc/profile.d/lesspipe.sh
}
