buildroot/package/ffmpeg/0003-libavutil-Fix-mips-build.patch
Bernd Kuhls baf5a1f0da package/ffmpeg: bump version to 6.1.2
Rebased patch 0003.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-08-05 22:32:13 +02:00

76 lines
2.3 KiB
Diff

From e9d97f9d29ce57d7a5a62607c2a08e091a06de6e Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Date: Sun, 6 Jun 2021 08:54:53 +0200
Subject: [PATCH] libavutil: Fix mips build
Check for sys/auxv.h because not all toolchains contain this header.
Fixes https://trac.ffmpeg.org/ticket/9138
Patch sent upstream:
http://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281272.html
[Bernd: rebased for version 6.1.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Dario: make the patch to be applied with fuzz factor 0]
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
configure | 2 ++
libavutil/mips/cpu.c | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index a89cfa6d959d..6ec00df75312 100755
--- a/configure
+++ b/configure
@@ -2227,6 +2227,7 @@ HEADERS_LIST="
OpenGL_gl3_h
poll_h
pthread_np_h
+ sys_auxv_h
sys_param_h
sys_resource_h
sys_select_h
@@ -6472,6 +6473,7 @@ check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepa
check_func_headers VideoToolbox/VideoToolbox.h VTPixelRotationSessionCreate -framework VideoToolbox
check_headers windows.h
check_headers asm/types.h
+check_headers sys/auxv.h
# it seems there are versions of clang in some distros that try to use the
# gcc headers, which explodes for stdatomic
diff --git a/libavutil/mips/cpu.c b/libavutil/mips/cpu.c
index 59619d54dee3..19196de50b59 100644
--- a/libavutil/mips/cpu.c
+++ b/libavutil/mips/cpu.c
@@ -19,7 +19,7 @@
#include "libavutil/cpu.h"
#include "libavutil/cpu_internal.h"
#include "config.h"
-#if defined __linux__ || defined __ANDROID__
+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -28,7 +28,7 @@
#include "libavutil/avstring.h"
#endif
-#if defined __linux__ || defined __ANDROID__
+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H
#define HWCAP_LOONGSON_CPUCFG (1 << 14)
@@ -105,7 +105,7 @@ static int cpu_flags_cpuinfo(void)
int ff_get_cpu_flags_mips(void)
{
-#if defined __linux__ || defined __ANDROID__
+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H
if (cpucfg_available())
return cpu_flags_cpucfg();
else
--
2.34.1