diff mbox series

ffmpeg: Fix build on musl linux systems

Message ID 20240902212022.2119138-1-raj.khem@gmail.com
State Accepted, archived
Commit a81fa08cada35a1b1163a56b80fa72110dcf1e7f
Headers show
Series ffmpeg: Fix build on musl linux systems | expand

Commit Message

Khem Raj Sept. 2, 2024, 9:20 p.m. UTC
Improved detection of ioctl API makes it easier to use the right
implementation rather than bunch of ifdef condition checks.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...figure-improve-check-for-POSIX-ioctl.patch | 48 +++++++++++++++++++
 .../recipes-multimedia/ffmpeg/ffmpeg_7.0.2.bb |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/0001-configure-improve-check-for-POSIX-ioctl.patch
diff mbox series

Patch

diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-configure-improve-check-for-POSIX-ioctl.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-configure-improve-check-for-POSIX-ioctl.patch
new file mode 100644
index 00000000000..b7c8cb21356
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-configure-improve-check-for-POSIX-ioctl.patch
@@ -0,0 +1,48 @@ 
+From 82b5617b8197246cf5b2af98a28f2aa37b8c8aa1 Mon Sep 17 00:00:00 2001
+From: Ramiro Polla <ramiro.polla@gmail.com>
+Date: Thu, 29 Aug 2024 15:40:00 +0200
+Subject: [PATCH] configure: improve check for POSIX ioctl
+
+Instead of relying on system #ifdefs which may or may not be correct,
+detect the POSIX ioctl signature at configure time.
+
+Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/00b64fca55a3a009c9d0e391c85f4fd3291e5d12]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure          | 2 ++
+ libavdevice/v4l2.c | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 8642513..d70b0bb 100755
+--- a/configure
++++ b/configure
+@@ -2517,6 +2517,7 @@ HAVE_LIST="
+     opencl_videotoolbox
+     perl
+     pod2man
++    posix_ioctl
+     texi2html
+     xmllint
+     zlib_gzip
+@@ -7131,6 +7132,7 @@ perl -v            > /dev/null 2>&1 && enable perl      || disable perl
+ pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
+ rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
+ xmllint --version  > /dev/null 2>&1 && enable xmllint   || disable xmllint
++test_code cc sys/ioctl.h "int ioctl(int, int, ...)" && enable posix_ioctl
+ 
+ # check V4L2 codecs available in the API
+ if enabled v4l2_m2m; then
+diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
+index 50ac47e..ee01711 100644
+--- a/libavdevice/v4l2.c
++++ b/libavdevice/v4l2.c
+@@ -107,7 +107,7 @@ struct video_data {
+     int (*open_f)(const char *file, int oflag, ...);
+     int (*close_f)(int fd);
+     int (*dup_f)(int fd);
+-#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-like */
++#if HAVE_POSIX_IOCTL
+     int (*ioctl_f)(int fd, int request, ...);
+ #else
+     int (*ioctl_f)(int fd, unsigned long int request, ...);
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_7.0.2.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_7.0.2.bb
index 1dbb7e04efb..9e60b5cd23e 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_7.0.2.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_7.0.2.bb
@@ -25,6 +25,7 @@  LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 SRC_URI = " \
     https://www.ffmpeg.org/releases/${BP}.tar.xz \
     file://0001-libavcodec-arm-mlpdsp_armv5te-fix-label-format-to-wo.patch \
+    file://0001-configure-improve-check-for-POSIX-ioctl.patch \
 "
 
 SRC_URI[sha256sum] = "8646515b638a3ad303e23af6a3587734447cb8fc0a0c064ecdb8e95c4fd8b389"