@@ -1710,6 +1710,7 @@ menu "Graphics"
source "package/menu-cache/Config.in"
source "package/onevpl-intel-gpu/Config.in"
source "package/opencl-clhpp/Config.in"
+ source "package/opencl-headers/Config.in"
source "package/opencv3/Config.in"
source "package/opencv4/Config.in"
source "package/opencv4-contrib/Config.in"
@@ -61,7 +61,7 @@ MESA3D_HEADERS_DIRS += GLES GLES2
endif
ifeq ($(BR2_PACKAGE_HAS_LIBOPENCL),y)
-MESA3D_HEADERS_DIRS += CL
+MESA3D_HEADERS_DEPENDENCIES += opencl-headers opencl-clhpp
endif
define MESA3D_HEADERS_BUILD_CMDS
new file mode 100644
@@ -0,0 +1,71 @@
+From 619f806413c60583ba5e3f88f6ef16a60d1958e4 Mon Sep 17 00:00:00 2001
+From: Antoine Coutant <antoine.coutant@smile.fr>
+Date: Wed, 28 Feb 2024 16:04:21 +0100
+Subject: [PATCH] include: remove the installation of CL headers
+
+The CL headers installed by mesa are old and
+does not support the last versions of OpenCL.
+
+In buildroot, instead of using mesa CL headers
+use official headers from Khronos. Moreover,
+the OpenCL headers are backward compatible.
+See:
+https://github.com/KhronosGroup/OpenCL-Headers#compatibility-notes
+
+Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
+---
+ include/meson.build | 28 -----------------------
+ src/gallium/frontends/rusticl/meson.build | 1 -
+ 2 files changed, 29 deletions(-)
+
+diff --git a/include/meson.build b/include/meson.build
+index a955ac71073..18f5f2d259e 100644
+--- a/include/meson.build
++++ b/include/meson.build
+@@ -110,31 +110,3 @@ if with_gallium_st_nine
+ )
+ endif
+
+-opencl_headers = files(
+- 'CL/cl.h',
+- 'CL/cl.hpp',
+- 'CL/cl2.hpp',
+- 'CL/cl_d3d10.h',
+- 'CL/cl_d3d11.h',
+- 'CL/cl_dx9_media_sharing.h',
+- 'CL/cl_dx9_media_sharing_intel.h',
+- 'CL/cl_egl.h',
+- 'CL/cl_ext.h',
+- 'CL/cl_ext_intel.h',
+- 'CL/cl_gl.h',
+- 'CL/cl_gl_ext.h',
+- 'CL/cl_icd.h',
+- 'CL/cl_platform.h',
+- 'CL/cl_va_api_media_sharing_intel.h',
+- 'CL/cl_version.h',
+- 'CL/opencl.h',
+- 'CL/opencl.hpp',
+-)
+-# Only install the headers if we are building a stand alone implementation and
+-# not an ICD enabled implementation
+-if with_gallium_opencl and not with_opencl_icd
+- install_headers(
+- opencl_headers,
+- subdir: 'CL'
+- )
+-endif
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index eb87dad2659..e157377404c 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -162,7 +162,6 @@ cl_c_args = [
+ rusticl_opencl_bindings_rs = rust.bindgen(
+ input : [
+ 'rusticl_opencl_bindings.h',
+- opencl_headers,
+ ],
+ output : 'rusticl_opencl_bindings.rs',
+ include_directories : [
+--
+2.34.1
+
new file mode 100644
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_OPENCL_HEADERS
+ bool "opencl-headers"
+ depends on BR2_PACKAGE_HAS_LIBOPENCL
+ help
+ C language headers for the OpenCL API
+
+ https://github.com/KhronosGroup/OpenCL-Headers
new file mode 100644
@@ -0,0 +1,3 @@
+#Locally generated
+sha256 3c3dd236d35f4960028f4f58ce8d963fb63f3d50251d1e9854b76f1caab9a309 OpenCL-Headers-2024.05.08.tar.gz
+sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
new file mode 100644
@@ -0,0 +1,22 @@
+################################################################################
+#
+# opencl-headers
+#
+################################################################################
+
+OPENCL_HEADERS_VERSION = 2024.05.08
+OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
+OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
+OPENCL_HEADERS_LICENSE = Apache-2.0
+OPENCL_HEADERS_LICENSE_FILES = LICENSE
+OPENCL_HEADERS_INSTALL_STAGING = YES
+
+OPENCL_HEADERS_INSTALL_TARGET = NO
+
+define OPENCL_HEADERS_INSTALL_STAGING_CMDS
+ mkdir -p $(STAGING_DIR)/usr/include/CL
+ $(INSTALL) -D -m 0644 $(@D)/CL/* \
+ $(STAGING_DIR)/usr/include/CL
+endef
+
+$(eval $(generic-package))