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

_realname=vss-text
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=26.0.0
pkgrel=1
pkgdesc="A high level Unicode text processing library. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
msys2_references=(
  'aur: libvss'
)
license=('spdx:Apache-2.0 WITH LLVM-exception')
url="https://github.com/AdaCore/vss-text"
conflicts=("${MINGW_PACKAGE_PREFIX}-libvss")
replaces=("${MINGW_PACKAGE_PREFIX}-libvss")
provides=("${MINGW_PACKAGE_PREFIX}-libvss")
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-gcc-ada")
makedepends=("${MINGW_PACKAGE_PREFIX}-gprbuild")
source=("https://github.com/AdaCore/vss-text/archive/v${pkgver}/vss-text-${pkgver}.tar.gz")
sha256sums=('c0566e4fdd6dffd4cdeabff1eeb0481bac8d5c8fa6c7aaa261626937fcd5367d')

build() {
  [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM}
  cp -r "${srcdir}/vss-text-${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-text-${pkgver}/LICENSE.txt" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
