# $Id: Portfile 67289 2010-05-04 22:01:05Z raimue@macports.org $

PortSystem      1.0

name            bash-completion
version         1.1
revision        8
epoch           1
categories      sysutils
platforms       darwin
maintainers     raimue
description     Programmable bash completions
long_description \
    Programmable completion library for bash.

homepage        http://bash-completion.alioth.debian.org/
master_sites    http://bash-completion.alioth.debian.org/files/
checksums       md5     593d3edcf287b9e9d735049bd4d3f229 \
                sha1    0e666ebda3d577571ab62bcecc16e1024922cd18 \
                rmd160  4f3c29479225b44bb3fb682a7ea925bef2e923b6

patchfiles      patch-avahi.diff \
                patch-man.diff \
                patch-mailman-arch.diff

post-patch {
    reinplace "s:/etc/bash_completion:${prefix}/etc/bash_completion:g" \
        ${worksrcpath}/bash_completion
    reinplace "s:readlink -f:readlink:g" \
        ${worksrcpath}/bash_completion
}

destroot {
    xinstall -d ${destroot}${prefix}/etc/bash_completion.d
    xinstall -m 755 ${worksrcpath}/bash_completion ${destroot}${prefix}/etc/
    eval xinstall -m 644 [glob ${worksrcpath}/contrib/*] ${destroot}${prefix}/etc/bash_completion.d/
    xinstall -m 644 -W ${filespath} port launchctl ${destroot}${prefix}/etc/bash_completion.d/
}

notes "
To use bash_completion, add the following lines at the end of your .bash_profile:
  if \[ -f ${prefix}/etc/bash_completion ]; then
      . ${prefix}/etc/bash_completion
  fi
"

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
