# Maintainer: Benoît Allard <benoit dot allard at gmx dot de>
# Contributor: promach
_gitname=SymbiYosys # TODO: git name has been changed to sby
pkgname=symbiyosys-git
pkgver=r431.46ca20f
pkgrel=1
pkgdesc="A front-end driver program for Yosys-based formal hardware verification flows"
arch=('any')
url="https://github.com/YosysHQ/sby"
license=('custom:ISC')
depends=('python')
makedepends=('git')
provides=('symbiyosys')
conflicts=('symbiyosys')
optdepends=('yices: solving using yices2'
            'z3: solving using z3'
            'boolector: solving using boolector')
source=("git+https://github.com/YosysHQ/${_gitname}.git"
        'LICENSE')
sha512sums=('SKIP'
            'a3202289ff7828c55d3ec3e22d23ed78a34fcae165a7c666d71d3cedd9abe06f638a09750d8c2d43dfca5781f1b32a616f439c3713a12265c02473f88c0f426d')

pkgver() {
  cd "${_gitname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  # SymbiYosys uses features in yosys that has not been released
  depends+=(yosys-git)
  cd "${_gitname}"
  make PREFIX=/usr DESTDIR="$pkgdir" install
  python -m compileall -d /usr/share/yosys "$pkgdir"/usr/share/yosys
  python -O -m compileall -d /usr/share/yosys "$pkgdir"/usr/share/yosys

  install -D -m 644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
