# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=gawk
pkgver=5.1.0
pkgrel=1
pkgdesc="GNU version of awk"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/gawk/"
license=('GPL')
groups=('base-devel')
depends=('sh' 'mpfr' 'libintl' 'libreadline')
makedepends=('gettext-devel' 'mpfr-devel' 'libreadline-devel')
provides=('awk')
install=gawk.install
source=(https://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.sig})
sha256sums=('03a0360edcd84bec156fe211bbc4fc8c78790973ce4e8b990a11d778d40b1a26'
            'SKIP')
validpgpkeys=('D1967C63788713177D861ED7DF597815937EC0D2')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  autoreconf -fiv
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --build=${CHOST} \
              --prefix=/usr \
              --libexecdir=/usr/lib \
              --without-libiconv-prefix \
              --without-libintl-prefix \
              --without-libsigsegv

  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
  # remove unnessary import libraries of modules
  rm -fv ${pkg}/gawk/usr/lib/gawk/*.dll.a
}
