]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
gstreamer1.0-plugins-bad: Fix build with musl
authorKhem Raj <raj.khem@gmail.com>
Thu, 13 Jun 2024 06:00:45 +0000 (23:00 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 18 Jun 2024 07:41:55 +0000 (08:41 +0100)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch [new file with mode: 0644]
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.24.3.bb

diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch
new file mode 100644 (file)
index 0000000..cc21435
--- /dev/null
@@ -0,0 +1,96 @@
+From 7c558e8ef9375aea953d1e7c854b25947c967f76 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jun 2024 23:09:54 -0700
+Subject: [PATCH] uvcgadget: Use g_path_get_basename instead of libc basename
+
+Musl does not implement GNU basename and have fixed a bug where the
+prototype was leaked into string.h [1], which resullts in compile errors
+with GCC-14 and Clang-17+
+
+| sys/uvcgadget/configfs.c:262:21: error: call to undeclared function 'basename'
+ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
+|   262 |     const char *v = basename (globbuf.gl_pathv[i]);
+|       |                     ^
+
+Use glib function instead makes it portable across musl and glibc on
+linux
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7a
+
+Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/7006]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ .../gst-plugins-bad/sys/uvcgadget/configfs.c   | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+--- a/sys/uvcgadget/configfs.c
++++ b/sys/uvcgadget/configfs.c
+@@ -7,7 +7,7 @@
+  * Contact: Kieran Bingham <kieran.bingham@ideasonboard.com>
+  */
+-/* To provide basename and asprintf from the GNU library. */
++/* To provide asprintf from the GNU library. */
+ #define _GNU_SOURCE
+ #include <dirent.h>
+@@ -259,9 +259,10 @@ udc_find_video_device (const char *udc,
+   }
+   if (i < globbuf.gl_pathc) {
+-    const char *v = basename (globbuf.gl_pathv[i]);
++    gchar *v = g_path_get_basename (globbuf.gl_pathv[i]);
+     video = path_join ("/dev", v);
++    g_free (v);
+   }
+   globfree (&globbuf);
+@@ -894,6 +895,7 @@ configfs_parse_uvc_function (const char
+ {
+   struct uvc_function_config *fc;
+   char *fpath;
++  gchar *bname;
+   int ret = 0;
+   fc = malloc (sizeof *fc);
+@@ -923,11 +925,10 @@ configfs_parse_uvc_function (const char
+    * Parse the function configuration. Remove the gadget name qualifier
+    * from the function name, if any.
+    */
+-  if (function)
+-    function = basename (function);
++  bname = g_path_get_basename (function);
+   fc->udc = attribute_read_str (fpath, "../../UDC");
+-  fc->video = udc_find_video_device (fc->udc, function);
++  fc->video = udc_find_video_device (fc->udc, bname);
+   if (!fc->video) {
+     ret = -ENODEV;
+     goto done;
+@@ -942,6 +943,7 @@ done:
+   }
+   free (fpath);
++  g_free (bname);
+   return fc;
+ }
+@@ -979,12 +981,16 @@ configfs_parse_uvc_videodev (int fd, con
+   char *function = NULL;
+   char rpath[PATH_MAX];
+   char *res;
++  gchar *bname;
+   res = realpath (video, rpath);
+   if (!res)
+     return NULL;
+-  function = video_find_config_name (basename (rpath));
++  bname = g_path_get_basename (rpath);
++  function = video_find_config_name (bname);
++  g_free (bname);
++
+   if (!function)
+     return NULL;
index dbd504e87dc41248a3d27840e277b099b54ea427..ccb1a544562fb1eec5932ebb32dd57ee98399c19 100644 (file)
@@ -9,6 +9,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad
            file://0001-fix-maybe-uninitialized-warnings-when-compiling-with.patch \
            file://0002-avoid-including-sys-poll.h-directly.patch \
            file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \
+           file://0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch \
            "
 SRC_URI[sha256sum] = "e90f26c7dc9c76f4aa599b758cfd6d8c10d6a0b9cb265ba2c3c9bdf3888558f8"