# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

pkgname=meson
pkgver=1.9.1
pkgrel=1
pkgdesc='High-productivity build system'
arch=('any')
url="https://mesonbuild.com/"
msys2_repository_url="https://github.com/mesonbuild/meson"
msys2_references=(
  "archlinux: meson"
  "gentoo: dev-build/meson"
  "purl: pkg:pypi/meson"
)
license=('spdx:Apache-2.0')
depends=('python' 'ninja' 'pkgconf')
makedepends=(
  "python-setuptools"
  "python-build"
  "python-installer"
)
source=("https://github.com/mesonbuild/${pkgname}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz"{,.asc}
        "0001-cygwin-disguise.patch")
sha256sums=('4e076606f2afff7881d195574bddcd8d89286f35a17b4977a216f535dc0c74ac'
            'SKIP'
            '33cd4ff57565cb8066454cdd255df72782421f37f9749b8dc0e96dfeec68daad')
validpgpkeys=(
  19E2D6D9B46D8DAA6288F877C24E631BABB1FE70 # Jussi Pakkanen <jpakkane@gmail.com>
  BD27B07A5EF45C2ADAF70E0484818A6819AF4A9B # Eli Schwartz <eschwartz93@gmail.com>
)

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i "${srcdir}"/0001-cygwin-disguise.patch
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}
