# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

_hkgname=pango
pkgname=haskell-pango
pkgver=0.13.11.0
pkgrel=94
pkgdesc="Binding to the pango library for Gtk2Hs."
url="https://hackage.haskell.org/package/pango"
license=('LGPL2.1')
arch=('x86_64')
depends=('ghc-libs' 'pango' 'haskell-glib' 'haskell-cairo')
makedepends=('ghc' "haskell-gtk2hs-buildtools" "mesa")
provides=('gtk2hs-pango')
replaces=('gtk2hs-pango')
conflicts=('gtk2hs-pango')
source=("https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz")
sha512sums=('d9cacf72221ca55ecc15e0712a90b14cf8c91569ea0e72bdb3c6e2c1d7a054619cee9eac546fbb95cc953c0605d082a7cbae18357f5d870598439a1928abd69c')

build() {
    cd $_hkgname-$pkgver
    
    runhaskell Setup configure -O --enable-shared --enable-debug-info --enable-executable-dynamic --disable-library-vanilla \
        --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname \
        --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid
    runhaskell Setup build $MAKEFLAGS
    runhaskell Setup register --gen-script
    runhaskell Setup unregister --gen-script
    sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
    sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
}

package() {
    cd $_hkgname-$pkgver
    
    install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
    install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
    runhaskell Setup copy --destdir="$pkgdir"
}
