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

pkgname=tig
pkgver=2.6.0
pkgrel=1
pkgdesc='Text-mode interface for Git'
depends=('git' 'libreadline' 'ncurses')
makedepends=('asciidoc' 'xmlto' 'libreadline-devel' 'ncurses-devel' 'libiconv-devel' 'autotools' 'gcc')
url='https://jonas.github.io/tig/'
msys2_repository_url="https://github.com/jonas/tig"
msys2_references=(
  "anitya: 4969"
  "archlinux: tig"
  "gentoo: dev-vcs/tig"
)
license=('spdx:GPL-2.0-or-later')
arch=('i686' 'x86_64')
backup=('etc/tigrc')
source=("https://github.com/jonas/${pkgname}/releases/download/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('99d4a0fdd3d93547ebacfe511195cb92e4f75b91644c06293c067f401addeb3e')

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"
}
