#!/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=groff
pkgver=1.23.0
pkgrel=05
pkgdesc='GNU troff text-formatting system'
url='https://www.gnu.org/software/groff/groff.html'
groups=( jobbot )
depends=('perl' 'gcc-libs')
makedepends=('netpbm' 'psutils'  'libxaw' 'perl-file-homedir')
optdepends=('netpbm: for use together with man -H command interaction in browsers'
            'psutils: for use together with man -H command interaction in browsers'
            'libxaw: for gxditview'
            'perl-file-homedir: for use with glilypond')
options=('!docs' '!emptydirs' '!makeflags')
source=("https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz"{,.sig}
        display-utc-times.patch
        site.tmac)

prepare() {
  cd $pkgname-$pkgver
  # always use UTC times for display - using localtime is problematic for reproducible builds
  # fixes FS#69123 - patch taken from Debian
  patch -Np1 -i ../display-utc-times.patch

}  

build() {
  cd $pkgname-$pkgver

  ./configure \
    --prefix=/usr \
    --with-x \
    --with-appresdir=/usr/share/X11/app-defaults
  make
}

check() {
  cd $pkgname-$pkgver
  make check
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  
  # add compatibility symlinks
  ln -s eqn "$pkgdir"/usr/bin/geqn
  ln -s tbl "$pkgdir"/usr/bin/gtbl
  ln -s soelim "$pkgdir"/usr/bin/zsoelim

  cat "$srcdir"/site.tmac >> \
  "$pkgdir"/usr/share/groff/site-tmac/man.local
  cat "$srcdir"/site.tmac >> \
  "$pkgdir"/usr/share/groff/site-tmac/mdoc.local

}

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

arch=(x86_64)

license=('GPL')

validpgpkeys=('2D0C08D2B0AD0D3D8626670272D23FBAC99D4E75') # Bertrand Garrigues <bertrand.garrigues@laposte.net>

sha256sums=(6b9757f592b7518b4902eb6af7e54570bdccba37a871fddb2d30ae3863511c13  # groff-1.23.0.tar.gz
	7ec23a8550fba8d942da06b1f84a090d80538ac062e8c73de6a4ad7a4f69e09f  # groff-1.23.0.tar.gz.sig
	489bb32bbd1c7bced33bf187611219527914ae46ce05238fe80dc11c4b1bb909  # display-utc-times.patch
	cbcfe19bc1271b91e2c3bb8864813118863a3d8d10e6ca341f82c0ca5dc37dff) # site.tmac

##  38dc02cfe44f976db07f406be11d491239d83c0854d49d0e5b6048e61f3e9f44  groff-1.23.0-05-x86_64.pkg.tar.lz
