# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>

pkgname=bash-completion
pkgver=2.17.0
pkgrel=1
pkgdesc='Programmable completion for the bash shell'
arch=(any)
url='https://github.com/scop/bash-completion'
license=(GPL-2.0-only)
depends=(bash)
options=(!emptydirs !makeflags)
backup=('etc/bash_completion.d/000_bash_completion_compat.bash')
source=($url/releases/download/$pkgver/$pkgname-$pkgver.tar.xz)
validpgpkeys=(A558062B6D5DA1347CD468D52B0AE2C1B09B07CB)
b2sums=('ee11f2bff82b0852979e4843c7ad5e5b976e4d1e44ab5ed1b96da64fe9b32d91150f12f32bf7c6c0286cd2a0c424d786bbad47066403c71f8d3c8425487427dd')

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

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install

  # bash-completion is sourced in /etc/bash.bashrc so that non-bash shell don't source it
  rm "${pkgdir}/etc/profile.d/bash_completion.sh"

  # remove Slackware's makepkg completion
  rm "${pkgdir}/usr/share/bash-completion/completions/makepkg"
}

