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

_realname=opencl-headers
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2024.10.24
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/'
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=('159f2a550592bae49859fee83d372acd152328fdf95c0dcd8b9409f8fad5db93')

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

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake \
      -G'Ninja' \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DBUILD_TESTING=OFF \
      ../${_realname}-${pkgver}

  DESTDIR="${pkgdir}" cmake --install .

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