Skip to contentSkip to conversation

libplacebo: fix glslang PACKAGECONFIG

PATCH Superseded Gyorgy Sarvari 1 participant 2 messages Feb 16, 2025 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libplacebo: fix glslang PACKAGECONFIG

In case glslang PACKAGECONFIG is enabled, compilation fails with a lot of errors about undefined references from the glslang namespace, e.g.

| /usr/src/debug/libplacebo/7.349.0/src/glsl/glslang.cc:79:(.text+0x160): undefined reference to `glslang::TShader::TShader(EShLanguage)'

This has been solved in the upstream project, and this change backports the commit that fixes the meson.build file to find the correct libraries during compilation.

Additionally, fix also the TMPDIR QA error that popped up after fixing the above issue: remove the RECIPE_SYSROOT value from the generated pkgconf file (and instead of referring to the libraries by absolute path, just refer to them by name, as they are supposed to be present in the standard library lookup path).

---
 ...n-add-glslang-lib-for-15.0.0-linking.patch | 34 +++++++++++++++++++
 .../mplayer/libplacebo_7.349.0.bb             | 10 +++++-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-multimedia/mplayer/libplacebo/0001-meson-add-glslang-lib-for-15.0.0-linking.patch
meta-oe/recipes-multimedia/mplayer/libplacebo/0001-meson-add-glslang-lib-for-15.0.0-linking.patch new file +34 -0
new file mode 100644
index 0000000000..8d784da0cc
@@ -0,0 +1,34 @@
+From d18a23cc275576bcefbdcc179d08ae643eeb3f3e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
+Date: Mon, 2 Dec 2024 17:10:00 +0100
+Subject: [PATCH] meson: add glslang lib for 15.0.0 linking
+
+Glslang 15.0.0 moved some code around, add also linking to glslang,
+while this is not needed for older versions, it will still work.
+
+Unfortunately CMake config embedded in distributions is not usable
+without installing additional package like glslang-tools, because at
+least Ubuntu splits it. On Arch it would work, but generally the CMake
+config require cmake binary to work also, so let's keep it as-is for
+now.
+
+Upstream-Status: Backport [https://github.com/haasn/libplacebo/commit/056b852018db04aa2ebc0982e27713afcea8106b]
+---
+ src/glsl/meson.build | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/glsl/meson.build b/src/glsl/meson.build
+index 5a881960..8fb5e699 100644
+--- a/src/glsl/meson.build
++++ b/src/glsl/meson.build
+@@ -39,6 +39,10 @@ elif not glslang_req.disabled()
+ 
+     glslang_deps += spirv
+ 
++    # Glslang 15.0.0 moved some code around, add also linking to glslang, while
++    # this is not needed for older versions, it will still work.
++    glslang_deps += cxx.find_library('glslang', required: required, static: static)
++
+     if static
+       glslang_deps += [
+         # Always required for static linking
meta-oe/recipes-multimedia/mplayer/libplacebo_7.349.0.bb +9 -1
index 15f324ff49..a5b38db335 100644
@@ -4,7 +4,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=435ed639f84d4585d93824e7da3d85da"
 
 DEPENDS += "fastfloat glad-native python3-mako-native python3-jinja2-native vulkan-headers"
 
-SRC_URI = "git://code.videolan.org/videolan/libplacebo.git;protocol=https;branch=v7.349"
+SRC_URI = "git://code.videolan.org/videolan/libplacebo.git;protocol=https;branch=v7.349 \
+           file://0001-meson-add-glslang-lib-for-15.0.0-linking.patch"
 SRCREV = "1fd3c7bde7b943fe8985c893310b5269a09b46c5"
 
 inherit meson pkgconfig
@@ -20,3 +21,10 @@ PACKAGECONFIG[lcms] = "-Dlcms=enabled,-Dlcms=disabled,lcms"
 PACKAGECONFIG[demos] = "-Ddemos=true,-Ddemos=false,ffmpeg libsdl2 libsdl2-image"
 
 EXTRA_OEMESON = "-Dvulkan-registry=${STAGING_DATADIR}/vulkan/registry/vk.xml"
+
+do_install:append(){
+  if [ -f ${D}${libdir}/pkgconfig/libplacebo.pc ]; then
+    sed -i "s,${RECIPE_SYSROOT}${libdir}/libSPIRV.so,-lSPIRV,g" ${D}${libdir}/pkgconfig/libplacebo.pc
+    sed -i "s,${RECIPE_SYSROOT}${libdir}/libglslang.so,-lglslang,g" ${D}${libdir}/pkgconfig/libplacebo.pc
+  fi
+}
#1 lore raw

PATCH 2/2 libplacebo: fix demos PACKAGECONFIG

In case the demos PACKAGECONFIG is enabled, linking fails with the following error:

| /usr/src/debug/libplacebo/7.349.0/demos/plplay.c:669:(.text.startup+0x90): undefined reference to `parse_args' | collect2: error: ld returned 1 exit status

The implementation of the missing function is guarded erroneously by an ifdef flag (HAVE_NUKLEAR, which is only true in case headers from the nuklear library are present - but in this recipe they are not included).

This patch moves the implementation of this function outside of the ifdef to avoid the build failure.

---
 ...-Fix-compiling-demos-without-nuklear.patch | 40 +++++++++++++++++++
 .../mplayer/libplacebo_7.349.0.bb             |  3 +-
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-multimedia/mplayer/libplacebo/0001-Fix-compiling-demos-without-nuklear.patch
meta-oe/recipes-multimedia/mplayer/libplacebo/0001-Fix-compiling-demos-without-nuklear.patch new file +40 -0
new file mode 100644
index 0000000000..bd849a75dd
@@ -0,0 +1,40 @@
+From ad0bbc5099d99bbb0c914b39cb5ab4920fd6eeda Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <[email protected]>
+Date: Sun, 16 Feb 2025 14:23:40 +0100
+Subject: [PATCH] Fix compiling demos without nuklear
+
+Demos can't be compiled if nuklear headers are not present, because
+the implementation of parse_args function is guarded by HAVE_NUKLEAR macro.
+
+To allow compiling demos without the Nuklear headers, move the implementation
+outside of this ifdef.
+
+Upstream-Status: Submitted [https://github.com/haasn/libplacebo/pull/315]
+---
+ demos/settings.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/demos/settings.c b/demos/settings.c
+index 197e8b7e..73f0e5b9 100644
+--- a/demos/settings.c
++++ b/demos/settings.c
+@@ -14,9 +14,6 @@
+ #define PL_BASENAME basename
+ #endif
+ 
+-#ifdef HAVE_NUKLEAR
+-#include "ui.h"
+-
+ bool parse_args(struct plplay_args *args, int argc, char *argv[])
+ {
+     static struct option long_options[] = {
+@@ -89,6 +86,9 @@ error:
+     return false;
+ }
+ 
++#ifdef HAVE_NUKLEAR
++#include "ui.h"
++
+ static void add_hook(struct plplay *p, const struct pl_hook *hook, const char *path)
+ {
+     if (!hook)
meta-oe/recipes-multimedia/mplayer/libplacebo_7.349.0.bb +2 -1
index a5b38db335..e79ab2e983 100644
@@ -5,7 +5,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=435ed639f84d4585d93824e7da3d85da"
 DEPENDS += "fastfloat glad-native python3-mako-native python3-jinja2-native vulkan-headers"
 
 SRC_URI = "git://code.videolan.org/videolan/libplacebo.git;protocol=https;branch=v7.349 \
-           file://0001-meson-add-glslang-lib-for-15.0.0-linking.patch"
+           file://0001-meson-add-glslang-lib-for-15.0.0-linking.patch \
+           file:///0001-Fix-compiling-demos-without-nuklear.patch"
 SRCREV = "1fd3c7bde7b943fe8985c893310b5269a09b46c5"
 
 inherit meson pkgconfig