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

pkgname=cgrep
pkgver=8.1.0
pkgrel=80
pkgdesc="A context-aware grep for source codes"
url="https://awgn.github.io/cgrep/"
license=("GPL2")
arch=('x86_64')
depends=('ghc-libs' 'haskell-aeson' 'haskell-ansi-terminal' 'haskell-async' 'haskell-bitarray'
         'haskell-bitwise' 'haskell-bytestring-strict-builder' 'haskell-cmdargs' 'haskell-dlist'
         'haskell-either' 'haskell-extra' 'haskell-mmap' 'haskell-monad-loops'
         'haskell-mono-traversable' 'haskell-posix-paths' 'haskell-rawfilepath' 'haskell-regex-base'
         'haskell-regex-pcre' 'haskell-regex-posix' 'haskell-safe' 'haskell-split'
         'haskell-stringsearch' 'haskell-unagi-chan' 'haskell-unicode-show' 'haskell-unix-compat'
         'haskell-unordered-containers' 'haskell-utf8-string' 'haskell-vector' 'haskell-yaml')
makedepends=('ghc')
source=("https://hackage.haskell.org/packages/archive/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('ccaf546dd4ab43f7d12694d14478fe237b05bf0efe6fc9c4775debf1b3d6f310bec99742df62accd70efba7357cb91d3922a00511e149ea15a0d8778a0e1e22c')

build() {
    cd $pkgname-$pkgver

    runhaskell Setup configure -O --prefix=/usr --ghc-option='-pie' \
                               --enable-executable-dynamic --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname
    runhaskell Setup build $MAKEFLAGS
}

package() {
    cd $pkgname-$pkgver
    runhaskell Setup copy --destdir="$pkgdir"
}
