# Maintainer: Alexander Rosenberg <zanderpkg at pm dot me>

pkgname='license-tool-hs'
pkgver=6
pkgrel=1
pkgdesc='A simple tool for creating LICENSE files'
url='https://git.zander.im/Zander671/license-tool-hs'
arch=('x86_64')
license=('GPL3')
# Actually, depend on stack, ghc, etc. but no packages for (some of) them
depends=()
conflicts=('license-tool')
provides=('license-tool')
source=('git+https://git.zander.im/Zander671/license-tool-hs.git')
sha256sums=('SKIP')

pkgver(){
  cd "$pkgname"
  git rev-list --count HEAD
}

build() {
    cd "$pkgname"
    stack build
}

package() {
    export STACK_YAML="$pkgname/stack.yaml"
    stack --local-bin-path "$pkgdir/usr/bin/" build --copy-bins
    install -m 0644 -D "$pkgname/completion/license-tool.zsh" \
            "$pkgdir/usr/share/zsh/site-functions/_license-tool"
    mkdir -p "$pkgdir/usr/share/"
    cp -r "$pkgname/licenses" "$pkgdir/usr/share/license-tool"
}
