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

_realname=opencl-headers
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2025.07.22
pkgrel=1
epoch=2
pkgdesc='OpenCL (Open Computing Language) header files (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://registry.khronos.org/OpenCL/'
msys2_repository_url="https://github.com/KhronosGroup/OpenCL-Headers"
msys2_references=(
  'archlinux: opencl-headers'
)
license=('spdx:Apache-2.0')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-ninja")
source=(https://github.com/KhronosGroup/OpenCL-Headers/archive/v${pkgver}/OpenCL-Headers-${pkgver}.tar.gz)
sha256sums=('98f0a3ea26b4aec051e533cb1750db2998ab8e82eda97269ed6efe66ec94a240')

package() {
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake \
      -G'Ninja' \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DBUILD_TESTING=OFF \
      -S OpenCL-Headers-${pkgver} \
      -B build-${MSYSTEM}

  DESTDIR="${pkgdir}" cmake --install build-${MSYSTEM}

  install -D -m644 "${srcdir}"/OpenCL-Headers-${pkgver}/LICENSE \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
