# Maintainer: David Macek <david.macek.0@gmail.com>

pkgname=getent
pkgver=2.18.90
pkgrel=2
pkgdesc="Get entries from Name Service Switch libraries"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/libc/libc.html"
license=('LGPL')
depends=('libargp')
makedepends=('libargp-devel')
source=(getent-${pkgver}.tar.gz
        cygwin-getent.patch
        msysize.patch)
sha256sums=('290440924c7e1ba9cdb2b2a2629899bfc497024fb393de77907c6f8394e0259c'
            '260efd98496dc54537d133daa903ed3f329b833e9726ea3f2533c1710ce65b9e'
            'ae576366f80d9beafe4863f23065a466efa1f5aa6c99493fd52ba2ee8d79566e')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p2 -i ${srcdir}/cygwin-getent.patch
  patch -p0 -i ${srcdir}/msysize.patch

  autoreconf -fi
}

build() {
  mkdir -p "${srcdir}/build-${CHOST}"
  cd "${srcdir}/build-${CHOST}"

  ../${pkgname}-${pkgver}/configure \
    --prefix=/usr \
    --build=${CHOST} \
    --host=${CHOST} \
    --target=${CHOST}

  make
}

package() {
  cd "${srcdir}/build-${CHOST}"
  make DESTDIR="${pkgdir}" install
}
