# Description: Programmable completion functions for bash
# URL: https://github.com/scop/bash-completion
# Maintainer: Matt Housh, jaeger at crux dot ninja
# Depends on: bash

name=bash-completion
version=2.12.0
release=1
source=(https://github.com/scop/$name/releases/download/$version/$name-$version.tar.xz)

build() {
  cd $name-$version

  sed -i -e 's,profiledir = .*,profiledir = /etc,g' Makefile.*

  ./configure --prefix=/usr \
    --sysconfdir=/etc

  make
  make DESTDIR=$PKG install

  mv $PKG/etc/bash_completion{.sh,}
  chmod 0755 $PKG/usr/share/$name/bash_completion

  # remove package tools intended for other distributions which
  # do not exist in CRUX
  rm $PKG/usr/share/$name/completions/{apt-*,aptitude,dpkg*}
  rm $PKG/usr/share/$name/completions/{explode,install,make,remove,sbo,upgrade}pkg
  rm $PKG/usr/share/$name/completions/{pkg-get,pkg_*,pkg{add,rm,tool,util},slapt-*}
}
