#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=gettext
pkgver=0.22.4
pkgrel=02     ## built with icu 74
pkgdesc="GNU internationalization library"
url="https://www.gnu.org/software/gettext/"
#depends=(gcc-libs acl sh glib2 libunistring libcroco)
makedepends=(gettext emacs-git 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.2-disable-libtextstyle.patch)

prepare() {
  cd $pkgname-$pkgver

  # 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.2-disable-libtextstyle.patch
}

build() {
  cd $pkgname-$pkgver
  LTOFLAGS=""
  autoreconf --force

  ./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
  depends=(gcc-libs acl sh libunistring libxml2)
  make DESTDIR="$pkgdir" install
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL-2.0-only' 'LGPL-2.0-only' 'GFDL-1.2-only' 'GPL-2.0-or-later')

validpgpkeys=('462225C3B46F34879FC8496CD605848ED7E69871'  # Daiki Ueno
              '68D94D8AAEEAD48AE7DC5B904F494A942E4616C2'
              '9001B85AF9E1B83DF1BDA942F5BE8B267C6A406D') # Bruno Haible (Open Source Development)

sha256sums=(c1e0bb2a4427a9024390c662cd532d664c4b36b8ff444ed5e54b115fdb7a1aea  # gettext-0.22.4.tar.gz
	633f4730f476e01ef6609d7fbca8e6f0ec314d59e67ade0e166343fb26f36833  # gettext-0.22.4.tar.gz.sig
	a28a27192f336f0b0908bdbf840d3b19d7b587c4ac52cad635cb43e95eb3c78d) # gettext-0.22.2-disable-libtextstyle.patch

##  45511b6adb88a3652e57ddf3c6f9b1033886ae9772ca0be6b8c162023c580f3c  gettext-0.22.4-02-x86_64.pkg.tar.lz

