diff mbox series

[v3,3/3] mesa: Add PACKAGECONFIG "rusticl"

Message ID 20230306091108.3347363-4-zboszor@gmail.com
State New
Headers show
Series Mesa 23.0.0 | expand

Commit Message

Zoltán Böszörményi March 6, 2023, 9:11 a.m. UTC
In the anonymous python function that creates packages based
on PACKAGECONFIG, use a single synthetic "opencl" setting
that is added when either "clover" or "rusticl" are present.

Without this, creating variables for two "libopencl-mesa" will
confuse the packaging code, resulting in subsequent packages
(like mesa-megadriver and others) being renamed incorrectly.

This also makes sense from a packaging standpoint: currently
both clover and rusticl can be enabled, in which case both CL
frontends should go into the same libopencl-mesa subpackage.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 meta/recipes-graphics/mesa/mesa.inc | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Comments

Otavio Salvador March 6, 2023, 3:59 p.m. UTC | #1
Em seg., 6 de mar. de 2023 às 06:11, Zoltan Boszormenyi
<zboszor@gmail.com> escreveu:
>
> In the anonymous python function that creates packages based
> on PACKAGECONFIG, use a single synthetic "opencl" setting
> that is added when either "clover" or "rusticl" are present.
>
> Without this, creating variables for two "libopencl-mesa" will
> confuse the packaging code, resulting in subsequent packages
> (like mesa-megadriver and others) being renamed incorrectly.
>
> This also makes sense from a packaging standpoint: currently
> both clover and rusticl can be enabled, in which case both CL
> frontends should go into the same libopencl-mesa subpackage.
>
> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>

Please name the PACKAGECONFIG as opencl-rusticl

>  inherit meson pkgconfig python3native gettext features_check
> +inherit ${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'rust', '', d)}

Here.

>  BBCLASSEXTEND = "native nativesdk"
>
> @@ -136,6 +137,9 @@ PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
>  OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}"
>  PACKAGECONFIG[clover] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools"
>
> +# "rusticl" requires libclc, spirv-llvm-translator and bindgen-cli-native from meta-clang and spirv-tools from OE-Core
> +PACKAGECONFIG[rusticl] = "-Dgallium-rusticl=true -Drust_std=2021,-Dgallium-rusticl=false,bindgen-cli-native libclc spirv-tools spirv-llvm-translator,libclc spirv-tools spirv-llvm-translator"

Here.

>  RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'clover', 'libclc spirv-tools', '', d)}"
> +RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'libclc spirv-tools spirv-llvm-translator', '', d)}"

Here.

>
>  PACKAGES =+ "libegl-mesa libegl-mesa-dev \
>               libosmesa libosmesa-dev \
> @@ -250,6 +255,11 @@ do_install:append () {
>  # RPROVIDEs/RCONFLICTs on the generic libgl name.
>  python __anonymous() {
>      pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
> +    # Add the synthetic "opencl" string to pkgconfig because
> +    # both "clover" and "rusticl" would create libopencl-mesa.
> +    # Both CL frontends should go into the same package.
> +    if "clover" in pkgconfig or "rusticl" in pkgconfig:
> +        pkgconfig.append("opencl")

Here.

Also, we need to add RREPLACES, RRECOMMENDS and RCONFLICTS to old
clover package so we support package feed upgrades.
Zoltán Böszörményi March 7, 2023, 6:32 a.m. UTC | #2
2023. 03. 06. 16:59 keltezéssel, Otavio Salvador írta:
> Em seg., 6 de mar. de 2023 às 06:11, Zoltan Boszormenyi
> <zboszor@gmail.com> escreveu:
>> In the anonymous python function that creates packages based
>> on PACKAGECONFIG, use a single synthetic "opencl" setting
>> that is added when either "clover" or "rusticl" are present.
>>
>> Without this, creating variables for two "libopencl-mesa" will
>> confuse the packaging code, resulting in subsequent packages
>> (like mesa-megadriver and others) being renamed incorrectly.
>>
>> This also makes sense from a packaging standpoint: currently
>> both clover and rusticl can be enabled, in which case both CL
>> frontends should go into the same libopencl-mesa subpackage.
>>
>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
> Please name the PACKAGECONFIG as opencl-rusticl
>
>>   inherit meson pkgconfig python3native gettext features_check
>> +inherit ${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'rust', '', d)}
> Here.
>
>>   BBCLASSEXTEND = "native nativesdk"
>>
>> @@ -136,6 +137,9 @@ PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
>>   OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}"
>>   PACKAGECONFIG[clover] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools"
>>
>> +# "rusticl" requires libclc, spirv-llvm-translator and bindgen-cli-native from meta-clang and spirv-tools from OE-Core
>> +PACKAGECONFIG[rusticl] = "-Dgallium-rusticl=true -Drust_std=2021,-Dgallium-rusticl=false,bindgen-cli-native libclc spirv-tools spirv-llvm-translator,libclc spirv-tools spirv-llvm-translator"
> Here.
>
>>   RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'clover', 'libclc spirv-tools', '', d)}"
>> +RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'libclc spirv-tools spirv-llvm-translator', '', d)}"
> Here.
>
>>   PACKAGES =+ "libegl-mesa libegl-mesa-dev \
>>                libosmesa libosmesa-dev \
>> @@ -250,6 +255,11 @@ do_install:append () {
>>   # RPROVIDEs/RCONFLICTs on the generic libgl name.
>>   python __anonymous() {
>>       pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
>> +    # Add the synthetic "opencl" string to pkgconfig because
>> +    # both "clover" and "rusticl" would create libopencl-mesa.
>> +    # Both CL frontends should go into the same package.
>> +    if "clover" in pkgconfig or "rusticl" in pkgconfig:
>> +        pkgconfig.append("opencl")
> Here.

Thanks, I will rename the PACKAGECONFIG names.

>
> Also, we need to add RREPLACES, RRECOMMENDS and RCONFLICTS to old
> clover package so we support package feed upgrades.

There is no "clover" package, there is libopencl-mesa.
That doesn't change with this, with either or both PACKAGECONFIGs
enabled, there is still libopencl-mesa that ships either or
both CL frontends. The versioning should be enough for the upgrade.
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index ff352822a3..56451d9eea 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -46,6 +46,7 @@  PROVIDES = " \
     "
 
 inherit meson pkgconfig python3native gettext features_check
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'rust', '', d)}
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -136,6 +137,9 @@  PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
 OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}"
 PACKAGECONFIG[clover] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools"
 
+# "rusticl" requires libclc, spirv-llvm-translator and bindgen-cli-native from meta-clang and spirv-tools from OE-Core
+PACKAGECONFIG[rusticl] = "-Dgallium-rusticl=true -Drust_std=2021,-Dgallium-rusticl=false,bindgen-cli-native libclc spirv-tools spirv-llvm-translator,libclc spirv-tools spirv-llvm-translator"
+
 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ""
 PACKAGECONFIG[freedreno] = ""
@@ -214,6 +218,7 @@  DEV_PKG_DEPENDENCY = ""
 RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev"
 
 RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'clover', 'libclc spirv-tools', '', d)}"
+RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'libclc spirv-tools spirv-llvm-translator', '', d)}"
 
 PACKAGES =+ "libegl-mesa libegl-mesa-dev \
              libosmesa libosmesa-dev \
@@ -250,6 +255,11 @@  do_install:append () {
 # RPROVIDEs/RCONFLICTs on the generic libgl name.
 python __anonymous() {
     pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
+    # Add the synthetic "opencl" string to pkgconfig because
+    # both "clover" and "rusticl" would create libopencl-mesa.
+    # Both CL frontends should go into the same package.
+    if "clover" in pkgconfig or "rusticl" in pkgconfig:
+        pkgconfig.append("opencl")
     suffix = ""
     if "-native" in d.getVar("PN"):
         suffix = "-native"
@@ -259,7 +269,7 @@  python __anonymous() {
               ("gles", "libgles1", "libglesv1-cm1"),
               ("gles", "libgles2", "libglesv2-2"),
               ("gles", "libgles3",),
-              ("clover", "libopencl",)):
+              ("opencl", "libopencl",)):
         if not p[0] in pkgconfig:
             continue
         mlprefix = d.getVar("MLPREFIX")
@@ -320,7 +330,7 @@  FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*"
 FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*"
 FILES:libgl-mesa = "${libdir}/libGL.so.*"
 FILES:libglx-mesa = "${libdir}/libGLX*.so.*"
-FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd"
+FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/libRusticlOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd ${sysconfdir}/OpenCL/vendors/rusticl.icd"
 FILES:libglapi = "${libdir}/libglapi.so.*"
 FILES:libosmesa = "${libdir}/libOSMesa.so.*"
 FILES:libxatracker = "${libdir}/libxatracker.so.*"
@@ -334,7 +344,7 @@  FILES:libglapi-dev = "${libdir}/libglapi.*"
 FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
 FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
 FILES:libgles3-mesa-dev = "${includedir}/GLES3"
-FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so"
+FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so ${libdir}/libRusticlOpenCL.so"
 FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
 FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
                           ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \