# $Id: PKGBUILD 226758 2014-11-20 19:21:21Z anatolik $
# Maintainer: 

### rebuild on every ghostscript update -  FS#36562 ###

pkgname=groff
pkgver=1.22.3
pkgrel=2
pkgdesc="GNU troff text-formatting system"
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/groff/groff.html"
license=('GPL')
groups=('base-devel')
depends=('perl' 'gcc-libs')
makedepends=('netpbm' 'psutils' 'ghostscript' 'libxaw')
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')
source=(ftp://ftp.gnu.org/gnu/groff/groff-$pkgver.tar.gz{,.sig}
        site.tmac)
options=('!docs' '!emptydirs' '!makeflags')
install=groff.install
md5sums=('cc825fa64bc7306a885f2fb2268d3ec5'
         'SKIP'
         'a1fedafd7863b37968d32ad9ae1d8c13')

build() {
  cd $srcdir/$pkgname-$pkgver
  ./configure --prefix=/usr --with-x --with-appresdir=/usr/share/X11/app-defaults
  make
}

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

package() {
  cd $srcdir/$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

  # FS33760 - TERMCAP variables not followed
  # TODO: everyone is doing this - find out why upstream does not...
  cat $srcdir/site.tmac >> \
    $pkgdir/usr/share/groff/site-tmac/man.local
  cat $srcdir/site.tmac >> \
    $pkgdir/usr/share/groff/site-tmac/mdoc.local
}
