# $Id: Portfile 54353 2009-07-25 09:16:01Z raimue@macports.org $

PortSystem 1.0

name                bash
set bash_version    4.0
set bash_patchlevel 28
version             ${bash_version}.${bash_patchlevel}
distname            ${name}-${bash_version}
categories          shells
maintainers         raimue
description         Bash (bourne-again shell) is a UNIX command interpreter
long_description    \
    Bash is an sh-compatible shell that incorporates useful     \
    features from the Korn shell (ksh) and C shell (csh). It is     \
    intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell  \
    and Tools standard. It offers functional improvements over sh   \
    for both programming and interactive use. In addition, most     \
    sh scripts can be run by Bash without modification.
homepage            http://www.gnu.org/software/bash/bash.html
platforms           darwin freebsd

master_sites        gnu
patch_sites         gnu:${name}/${distname}-patches
checksums           ${distname}${extract.suffix} \
                    md5     a90a1b5a6db4838483f05438e05e8eb9 \
                    sha1    2bbed30879f9f424c091a846a48111c27d0b2370 \
                    rmd160  82aba4b2cb475c2030904a9d22af6208dfa85eb3

eval {
  set low 1
  while {$low <= $bash_patchlevel} {
    set high [expr $low + 99];
    if {$high < $bash_patchlevel} {

      ###
      # disabled because there haven't been a hundred patches for bash yet
      # and there's no way to tell the format in advance

      # patchfiles-append [format "%s.%03d-%03d.gz" $bash_version $low $high]
      # incr low 100

    } else {
      patchfiles-append \
        [format "%s%s-%03d" $name [strsed ${bash_version} {g/\.//}] $low]
      incr low 1
    }
  }
}

depends_build           bin:grep:grep \
                        bin:bison:bison
depends_lib             port:gettext \
                        port:readline

configure.ldflags-append \
    "-Wl,-search_paths_first -lncurses"
configure.args          --mandir=${prefix}/share/man --with-installed-readline \
                        --infodir=${prefix}/share/info

include checksums_patch

livecheck.check         regex
livecheck.url           http://ftp.gnu.org/gnu/${name}/${name}-${bash_version}-patches/?C=M&O=D
livecheck.version       [format %03d ${bash_patchlevel}]
livecheck.regex         ${name}[strsed ${bash_version} {g/\.//}]-(\\d\\d\\d)
