# Contributor: Kazuki Shigemichi <shigemichik@gmail.com>

_realname=libcello
pkgbase="mingw-w64-${_realname}-git"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=2.1.0.313.dfcd86c
pkgrel=1
_commit='dfcd86c9c2d32e09d86effd6cfd7c9b97a0291a0'
pkgdesc="A library brings higher level programming to C (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://libcello.org/"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=(${_realname}::"git+https://github.com/orangeduck/Cello.git#commit=${_commit}")
sha256sums=('SKIP')

pkgver() {
  cd $_realname
  version=$(grep "^VERSION =" Makefile | cut -d " " -f 3)
  revision=$(git rev-list --count "${_commit}")
  hash=$(git log --pretty=format:'%h' -n 1)
  echo ${version}.${revision}.${hash}
}

build() {
  cd ${_realname}
  make
}

check() {
  cd ${_realname}

  make check
}

package() {
  cd ${_realname}
  mkdir -p "${pkgdir}"${MINGW_PREFIX}/{bin,include,lib}
  make PREFIX="${pkgdir}${MINGW_PREFIX}" install
  install -Dm644 LICENSE.md "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
