# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=gettext
pkgver=0.22.5
pkgrel=1
pkgdesc="GNU internationalization library"
url="https://www.gnu.org/software/gettext/"
arch=(x86_64)
license=('GPL-2.0-only' 'LGPL-2.0-only' 'GFDL-1.2-only' 'GPL-2.0-or-later')
depends=(gcc-libs acl sh libunistring libxml2)
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}
        gettext-0.22-disable-libtextstyle.patch)
sha256sums=('ec1705b1e969b83a9f073144ec806151db88127f5e40fe5a94cb6c8fa48996a0'
            'SKIP'
            'a28a27192f336f0b0908bdbf840d3b19d7b587c4ac52cad635cb43e95eb3c78d')
              '68D94D8AAEEAD48AE7DC5B904F494A942E4616C2'
              '9001B85AF9E1B83DF1BDA942F5BE8B267C6A406D') # Bruno Haible (Open Source Development)

prepare() {
  cd $pkgname-$pkgver
  automake
  # Do not build libtextstyle, as it depends on libcroco
  # which is now unmaintained and has known security bugs.
  # patch from Fedora	
   patch -p1 -i $srcdir/gettext-0.22-disable-libtextstyle.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
}
