# Maintainer: Quinton Miller <nicetas.c@gmail.com>

_realname=shards
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.19.1
pkgrel=1
pkgdesc="Package manager for the Crystal programming language (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'mingw64' 'clang64' 'clangarm64')
url="https://crystal-lang.org/"
msys2_repository_url="https://github.com/crystal-lang/shards"
msys2_documentation_url="https://crystal-lang.org/reference/${pkgver%.*}/man/shards/index.html"
msys2_changelog_url="https://github.com/crystal-lang/shards/releases/tag/v${pkgver}"
msys2_references=(
  "archlinux: shards"
)
license=('spdx:Apache-2.0')
depends=(
  "${MINGW_PACKAGE_PREFIX}-gc"
  "${MINGW_PACKAGE_PREFIX}-libiconv"
  "${MINGW_PACKAGE_PREFIX}-libyaml"
  "${MINGW_PACKAGE_PREFIX}-pcre2"
)
makedepends=(
  "git"
  "${MINGW_PACKAGE_PREFIX}-crystal"
)
source=(
  "$pkgname-$pkgver::git+${msys2_repository_url}.git#tag=v${pkgver}"
)
sha256sums=('1eb52fd77834a13f9220a45b2728a4f4ca96fbcee1a1be2d48974e49a8511bbd')

build() {
  cd "$pkgname-$pkgver"
  make SHARDS=false release=1
}

package() {
  cd "$pkgname-$pkgver"
  touch shard.lock # FIXME: remove after 0.20.0
  make install DESTDIR="$pkgdir" PREFIX="${MINGW_PREFIX}"
}
