# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Arch Haskell Team <arch-haskell@haskell.org>

pkgname=hledger-ui
pkgver=1.22.2
pkgrel=26
pkgdesc="Curses-style terminal interface for the hledger accounting system"
url="http://hledger.org"
license=("GPL")
arch=('x86_64')
depends=('ghc-libs' 'hledger' 'haskell-hledger-lib' 'haskell-ansi-terminal' 'haskell-async'
         'haskell-base-compat-batteries' 'haskell-cmdargs' 'haskell-data-default' 'haskell-extra'
         'haskell-fsnotify' 'haskell-microlens' 'haskell-microlens-platform' 'haskell-megaparsec'
         'haskell-safe' 'haskell-split' 'haskell-text-zipper'
         'haskell-vector' 'haskell-brick' 'haskell-vty')
makedepends=('ghc')
source=("https://hackage.haskell.org/packages/archive/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('53ca171ed87eae4a3a244fe1e8858f6c24e41d8740232375022ccb78b9fffe797aff43cd783d7a994d98fd3705c4d84f8f5a32857ff4f0d69aad5a84ee97b357')

build() {
    cd $pkgname-$pkgver
    runhaskell Setup configure -O --enable-executable-dynamic --disable-library-vanilla \
        --prefix=/usr --docdir="/usr/share/doc/$pkgname" --datasubdir="$pkgname" \
            -fthreaded
    runhaskell Setup build $MAKEFLAGS
}

package() {
    cd $pkgname-$pkgver
    runhaskell Setup copy --destdir="$pkgdir"
    rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE

    install -Dm644 hledger-ui.1 -t "$pkgdir"/usr/share/man/man1/
}
