# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=vss-extra
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=26.0.0
pkgrel=1
pkgdesc="Extra features for VSS. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
license=('spdx:Apache-2.0 WITH LLVM-exception')
url="https://github.com/AdaCore/vss-extra"
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-gcc-ada"
         "${MINGW_PACKAGE_PREFIX}-vss-text"
         "${MINGW_PACKAGE_PREFIX}-xmlada")
makedepends=("${MINGW_PACKAGE_PREFIX}-gprbuild")
source=("https://github.com/AdaCore/vss-extra/archive/v${pkgver}/vss-extra-${pkgver}.tar.gz")
sha256sums=('ca35dc2d0e796ff992deefbad39df3fcf1f55afe99f297f013c3afb860b5b24a')

build() {
  [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM}
  cp -r "${srcdir}/vss-extra-${pkgver}" "${srcdir}"/build-${MSYSTEM}
  cd "${srcdir}"/build-${MSYSTEM}

  make PREFIX=${MINGW_PREFIX} BUILD_PROFILE=release build-all-libs
}

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

  make DESTDIR="${pkgdir}" PREFIX=${MINGW_PREFIX} install-all-libs

  install -Dm644 "${srcdir}/vss-extra-${pkgver}/LICENSE.txt" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
