From: Randolph Sapp <[email protected]>

Bumping into the limitations of the binary_package class. This change
allows all rogue components to be optionally packaged without blowing
out the dependency chain.

Add a python function to fetch file paths from the FILE vars for each
component so we don't end up double tracking files. Add variables to
track component packages if things split up more later. Add a package
config string to set runtime dependencies and recommendations. Change
all logic to revolve around the PACKAGECONFIG instead of distro
features.

Signed-off-by: Randolph Sapp <[email protected]>
---
 .../ti-img-rogue-umlibs_23.1.6404501.bb       | 58 ++++++++++++++++---
 1 file changed, 49 insertions(+), 9 deletions(-)

diff --git 
a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
 
b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
index b166736c..c012859f 100644
--- 
a/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
+++ 
b/meta-ti-bsp/recipes-graphics/powervr-umlibs/ti-img-rogue-umlibs_23.1.6404501.bb
@@ -28,20 +28,63 @@ RDEPENDS:${PN} = " \
     ${PN}-firmware \
 "
 
+PACKAGECONFIG ?= " \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan x11 wayland', 'vulkan', 
'', d)} \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'opengl opencl', d)} \
+"
+
+PACKAGECONFIG[opengl] = ",,,${GLES_LIB_PACKAGES}"
+PACKAGECONFIG[vulkan] = ",,,${VULKAN_LIB_PACKAGES}"
+PACKAGECONFIG[opencl] = ",,,${OPENCL_LIB_PACKAGES},libopencl-rogue-tools"
+
+def get_file_list(package_list_var, d):
+    file_list = []
+    package_list = d.getVar(package_list_var)
+    if package_list:
+        for package in package_list.split():
+            package_files = d.getVar(f"FILES:{package}")
+            if package_files:
+                file_list.append(package_files)
+    return " ".join(file_list)
+
 do_install:append() {
+    if ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'false', 'true', d)}; 
then
+        for file in ${@get_file_list('GLES_PACKAGES', d)}; do
+            rm -rf ${D}/${file}
+            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
+        done
+    fi
+    if ${@bb.utils.contains('PACKAGECONFIG', 'vulkan', 'false', 'true', d)}; 
then
+        for file in ${@get_file_list('VULKAN_PACKAGES', d)}; do
+            rm -rf ${D}/${file}
+            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
+        done
+    fi
+    if ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'false', 'true', d)}; 
then
+        for file in ${@get_file_list('OPENCL_PACKAGES', d)}; do
+            rm -rf ${D}/${file}
+            rmdir --ignore-fail-on-non-empty $(dirname ${D}/${file})
+        done
+    fi
     if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'true', 'false', 
d)}; then
         mv ${D}/lib/firmware ${D}${nonarch_base_libdir}
         rmdir ${D}/lib
     fi
 }
 
+GLES_LIB_PACKAGES = "libgles1-rogue libgles2-rogue libgles3-rogue"
+GLES_PACKAGES = "${GLES_LIB_PACKAGES}"
+
+VULKAN_LIB_PACKAGES = "libvk-rogue"
+VULKAN_PACKAGES = "${VULKAN_LIB_PACKAGES}"
+
+OPENCL_LIB_PACKAGES = "libopencl-rogue"
+OPENCL_PACKAGES = "${OPENCL_LIB_PACKAGES} libopencl-rogue-tools"
+
 PACKAGES = " \
-    libgles1-rogue \
-    libgles2-rogue \
-    libgles3-rogue \
-    libvk-rogue \
-    libopencl-rogue \
-    libopencl-rogue-tools \
+    ${@bb.utils.contains('PACKAGECONFIG', 'opengl', d.getVar('GLES_PACKAGES'), 
'', d)} \
+    ${@bb.utils.contains('PACKAGECONFIG', 'vulkan', 
d.getVar('VULKAN_PACKAGES'), '', d)} \
+    ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 
d.getVar('OPENCL_PACKAGES'), '', d)} \
     ${PN}-tools \
     ${PN}-firmware \
     ${PN} \
@@ -94,9 +137,6 @@ FILES:${PN}-firmware = "${base_libdir}/firmware/*"
 INSANE_SKIP:${PN}-firmware += "arch"
 
 RRECOMMENDS:${PN} += " \
-    ${@bb.utils.contains("DISTRO_FEATURES", "opengl", "libgles1-rogue 
libgles2-rogue", "", d)} \
-    ${@bb.utils.contains("DISTRO_FEATURES", "vulkan x11 wayland", 
"libvk-rogue", "", d)} \
-    ${@bb.utils.contains("DISTRO_FEATURES", "opencl", "libopencl-rogue", "", 
d)} \
     ${PN}-tools \
 "
 
-- 
2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16764): 
https://lists.yoctoproject.org/g/meta-ti/message/16764
Mute This Topic: https://lists.yoctoproject.org/mt/99682421/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to