pkgname=bash
_basever=5.3
_patchver=0
if (( _patchver == 0 )); then
  pkgver=$_basever
else
  pkgver=$_basever.$_patchver
fi
pkgdesc='The GNU Bourne Again shell'
license=('GPL-3.0-or-later')
homepage='https://www.gnu.org/software/bash'
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://ftp.gnu.org/gnu/${pkgname}/${sources[0]}")
md5sums=("977c8c0c5ae6309191e7768e28ebc951")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  ./configure --prefix=/usr             \
              --without-bash-malloc     \
              --with-installed-readline \
              bash_cv_strtold_broken=no \
              --docdir=/usr/share/doc/bash-${pkgver}
  make
}

src_check() {
  chown -R leaf .
  su -s /usr/bin/expect leaf << "EOF"
set timeout -1
spawn make tests
expect eof
lassign [wait] _ _ _ value
exit $value
EOF
  #chown -R root .
}

src_install() {
  make DESTDIR="${pkgdir}" install
  ln -sv bash "${pkgdir}/usr/bin/sh"
}

