# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libsystre
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
provides=("${MINGW_PACKAGE_PREFIX}-libgnurx")
conflicts=("${MINGW_PACKAGE_PREFIX}-libgnurx")
replaces=("${MINGW_PACKAGE_PREFIX}-libgnurx")
pkgver=1.0.2
pkgrel=2
pkgdesc="Wrapper library around TRE that provides POSIX API (mingw-w64)"
arch=('any')
msys2_references=(
  'internal'
)
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-libsystre"
license=('spdx:BSD-2-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-libtre")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson")
source=(
  COPYING
  README
  meson.build
  meson_post_install.py
  regex.h
  systre.c
)
sha256sums=('3200024286eb0a33c22da3a31c470df07c7b8cfbead2b9528195d67d107264ec'
            '5ba16345af82fd3aee07ccf407dbc37ff5793e305dfc9b203e1fecf5323dc101'
            '783d035a2c418d29add2d885015b014eef146def58639a1af9ab8d701a3756c2'
            '4dc9f7404ba23de7491ee8146adf72ccc87c3114c459d3c778e70389846f2a37'
            '5c06d602f089fe1f2a95a59dfe7866e90a3358c714b22f6aafd7c14bd5a0f7c4'
            '454cdacd0a31d15c1a7b7e9fa8d81d0137a1b628d157cb49071a8cf7f5537827')
build() {
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    meson setup \
      --prefix="${MINGW_PREFIX}" \
      --wrap-mode=nodownload \
      --auto-features=enabled \
      --buildtype=plain \
      "build-${MSYSTEM}" \
      .

  meson compile -C "build-${MSYSTEM}"
}

package() {
  meson install -C "build-${MSYSTEM}" --destdir "${pkgdir}"

  install -Dm644 "${srcdir}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
