diff --git a/srcpkgs/gst-plugins-good1/patches/musl-ioctl.patch b/srcpkgs/gst-plugins-good1/patches/musl-ioctl.patch new file mode 100644 index 00000000000..9d842baf70e --- /dev/null +++ b/srcpkgs/gst-plugins-good1/patches/musl-ioctl.patch @@ -0,0 +1,62 @@ +From dd1fc2b7931f5789815e17dda2ef7c31b9fba563 Mon Sep 17 00:00:00 2001 +From: Alyssa Ross +Date: Tue, 11 Mar 2025 16:36:58 +0100 +Subject: [PATCH] v4l2object: fix type mismatch when ioctl takes int + +v4l2object->ioctl can either be set to v4l2_ioctl() or ioctl(). +v4l2_ioctl() always takes the request number as unsigned long int, but ioctl() +may take (at least) unsigned long int, int, or unsigned, depending on libc. +This means that there isn't one function pointer type that can be used for +v4l2object->ioctl that will always be able to accomodate being set to either of +v4l2_ioctl() and ioctl(). It's therefore necessary to wrap one of them so that +both options can have the same type. This fixes an assignment from incompatible +pointer type error when building for musl. + +Part-of: +--- + .../gst-plugins-good/sys/v4l2/gstv4l2object.c | 21 +++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +index 288ff74477d7..5b7f45512459 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -528,6 +528,23 @@ v4l2_mmap_wrapper (gpointer start, gsize length, gint prot, gint flags, gint fd, + #define v4l2_mmap v4l2_mmap_wrapper + + #endif /* SIZEOF_OFF_T < 8 */ ++ ++#if defined(__linux__) && !defined(__GLIBC__) ++/* v4l2_ioctl always takes request as unsigned long int, not ioctl_req_t */ ++static gint ++v4l2_ioctl_wrapper (gint fd, ioctl_req_t request, ...) ++{ ++ void *arg; ++ va_list ap; ++ ++ va_start (ap, request); ++ arg = va_arg (ap, void *); ++ va_end (ap); ++ ++ return v4l2_ioctl (fd, request, arg); ++} ++#endif /* defined(__linux__) && !defined(__GLIBC__) */ ++ + #endif /* HAVE_LIBV4L2 */ + + GstV4l2Object * +@@ -578,7 +595,11 @@ gst_v4l2_object_new (GstElement * element, + v4l2object->fd_open = v4l2_fd_open; + v4l2object->close = v4l2_close; + v4l2object->dup = v4l2_dup; ++#ifdef __GLIBC__ + v4l2object->ioctl = v4l2_ioctl; ++#else ++ v4l2object->ioctl = v4l2_ioctl_wrapper; ++#endif + v4l2object->read = v4l2_read; + v4l2object->mmap = v4l2_mmap; + v4l2object->munmap = v4l2_munmap; +-- +GitLab +