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

pkgname=hledger-ui
pkgver=1.15
pkgrel=1
pkgdesc="Curses-style user interface for the hledger accounting tool"
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-fsnotify'
         'haskell-microlens' 'haskell-microlens-platform' 'haskell-megaparsec' 'haskell-pretty-show'
         '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=('67b5f6d013b9aed9e139b0f87510ee01e07c78ca8a003d8db74f3d851d00acf4df1f2b991e0e7b4ed847a2bdf5d38412798e02581c332b4d7c527155f5232565')

prepare() {
    # It does nothing
    sed -e '/mtl-compat/d' \
        -i ${pkgname}-${pkgver}/${pkgname}.cabal
}

build() {
    cd "${srcdir}/${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
}

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