# Maintainer: taozuhong <taozuhong@gmail.com>

_realname=live-chart
pkgbase=mingw-w64-${_realname}-gtk3
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-gtk3"
pkgver=1.6.1
pkgrel=2
pkgdesc="Live Chart is a real-time charting library for GTK3 and Vala, based on Cairo."
arch=(any)
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/lcallarec/live-chart"
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-python3")
depends=("${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-gtk3"
         "${MINGW_PACKAGE_PREFIX}-libgee")
source=(https://github.com/lcallarec/${_realname}/archive/${pkgver}.tar.gz)
sha256sums=('7543e95040bf5d7899da5faee830da0ba1f5fef42721eeff3ebf73c51f17f7d5')

prepare() {
  cd ${_realname}-${pkgver}
}

build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype=plain \
    ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/ninja
}

package() {
  cd "${srcdir}"/build-${CARCH}
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/ninja install
}
