# Maintainer: Taozuhong <taozuhong@gmail.com>

_realname=vala-language-server
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.48.3
pkgrel=2
pkgdesc="Vala Language Server for the Vala programming language (mingw-w64)"
arch=('any')
url="https://github.com/Prince781/vala-language-server"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-vala>=0.48.12"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-meson")
depends=("${MINGW_PACKAGE_PREFIX}-jsonrpc-glib"
         "${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-json-glib"
         "${MINGW_PACKAGE_PREFIX}-libgee")
source=("https://github.com/Prince781/vala-language-server/archive/refs/tags/${pkgver}.tar.gz")
sha256sums=('1a752515efda561aec535d088a6f52888b13ad2d52f2d27770ddf6a519f0028b')

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

build() {
  rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"

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

  meson compile
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  DESTDIR="${pkgdir}" meson install
}
