# Maintainer: David Macek <david.macek.0@gmail.com>

_realname=nimble
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.14.2
pkgrel=1
pkgdesc='Package manager for the Nim programming language (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64')
url='https://github.com/nim-lang/nimble'
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-openssl")
makedepends=("${MINGW_PACKAGE_PREFIX}-nim" "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/nim-lang/nimble/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('d94f11c592d49aed6c5a492289f187010eb8c103b2b653252763d2f65a82abac')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  nim c -d:release src/nimble.nim
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  install -Dm 755 "src/nimble.exe" -t "${pkgdir}${MINGW_PREFIX}/bin/"
  install -Dm 644  "license.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
