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

pkgname=tig
pkgver=2.5.3
pkgrel=2
pkgdesc='Text-mode interface for Git'
depends=('git' 'libreadline' 'ncurses')
makedepends=('asciidoc' 'xmlto' 'libreadline-devel' 'ncurses-devel' 'libiconv-devel')
url='https://jonas.github.io/tig/'
license=('GPL')
arch=('i686' 'x86_64')
backup=('etc/tigrc')
source=("https://github.com/jonas/${pkgname}/releases/download/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('e528068499d558beb99a0a8bca30f59171e71f046d76ee5d945d35027d3925dc')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  CPPFLAGS="-D_GNU_SOURCE" \
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --build=${CHOST}
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}" install install-doc-man
  install -Dm0644 contrib/tig-completion.bash "${pkgdir}/usr/share/bash-completion/completions/tig"
}
