pkgname="sed"
pkgver="4.9"
pkgdesc='GNU stream editor'
homepage="https://www.gnu.org/software/sed/"
license=('GPL3')
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://ftp.gnu.org/gnu/${pkgname}/${sources[0]}")
md5sums=("6aac9b2dbafcd5b7a67a8a9bcb8036c3")

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

src_build() {
  ./configure --prefix=/usr
  make
  make html
}

src_check() {
  chown -R leaf .
  su leaf -c "PATH=$PATH make check"
}

src_install() {
  make DESTDIR="$pkgdir" install
  install -d -m755           "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
  install -m644 doc/sed.html "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
}
