{% set name = "ocl-icd" %}
{% set version = "2.3.3" %}
{% set sha256 = "8cd8e8e129db3081a64090fc1252bec39dc88cdb7b3f929315e014b75069bd9d" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/OCL-dev/{{ name }}/archive/v{{ version }}.tar.gz
  sha256: {{ sha256 }}

  patches:
  # Recursively check for icds in vendor dir
    - check_icds_recursively.diff

build:
  number: 0
  skip: true  # [not linux]
  run_exports:
    - {{ pin_subpackage("ocl-icd") }}

requirements:
  build:
    - pkg-config
    - libtool
    - automake
    - autoconf
    - make
    - {{ compiler('c') }}
    - {{ stdlib('c') }}
    - ruby *
  host:
    - opencl-headers =2025.07.22
  run:
    - {{ pin_compatible("opencl-headers", max_pin=None) }}

test:
  requires:
    - {{ compiler('c') }}
    - {{ stdlib('c') }}
    - pkg-config
  source_files:
    - ocl_test.c
  commands:
    - test -f "${PREFIX}/include/CL/cl.h"
    - test -f "${PREFIX}/lib/libOpenCL.so.1"
    - test -d "${PREFIX}/etc/OpenCL/vendors"
    - $CC -o test ocl_test.c -L${PREFIX}/lib -lOpenCL -I${PREFIX}/include
    - ./test
    - ./test | grep "No platforms found!"
    - pkg-config OpenCL --libs --cflags

about:
  home: https://github.com/OCL-dev/ocl-icd
  # https://forge.imag.fr/projects/ocl-icd/ also exists but appears out of date
  license: BSD-2-Clause
  license_family: BSD
  license_file: COPYING
  summary: An OpenCL ICD Loader under an open-source license
  doc_source_url: https://github.com/OCL-dev/ocl-icd/tree/v{{ version }}/doc
  dev_url: https://github.com/OCL-dev/ocl-icd
  description: |
    `libOpenCL.so` is the library linked by OpenCL programs. It does not contains
    any OpenCL implementation itself, but merely act as a dispatcher to real OpenCL
    implementations provided as OpenCL Installable Client Driver (ICD).

extra:
  recipe-maintainers:
    - inducer
    - isuruf
    - matthiasdiener
