# Maintainer:

pkgname=gettext
pkgver=0.20.1
pkgrel=2
pkgdesc="GNU internationalization library"
url="https://www.gnu.org/software/gettext/"
arch=(x86_64)
license=(GPL)
groups=(base base-devel)
depends=(gcc-libs acl sh glib2 libunistring libcroco)
makedepends=(gettext emacs git)
optdepends=('git: for autopoint infrastructure updates')
options=(!docs)
source=(https://ftp.gnu.org/pub/gnu/gettext/$pkgname-$pkgver.tar.gz{,.sig}
        fix-empty-po.patch)
sha256sums=('66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c'
            'SKIP'
            '8d0773334af935060762a3dfc756c997d216df04b8875df508a9598195b60dbe')
validpgpkeys=('462225C3B46F34879FC8496CD605848ED7E69871'  # Daiki Ueno
              '68D94D8AAEEAD48AE7DC5B904F494A942E4616C2') # Bruno Haible (Open Source Development)

prepare() {
  cd $pkgname-$pkgver

  # Get GCR 3.33.4 to build: https://gitlab.gnome.org/GNOME/gcr/issues/25
  patch -Np1 -i ../fix-empty-po.patch
}

build() {
  cd $pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --enable-csharp \
    --enable-nls \
    --with-xz \
    --without-included-gettext

  sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' \
      -i gettext-{tools,runtime,runtime/libasprintf}/libtool

  make
}

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

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
