From 3735fc2cb1f8f03ba338c12ed6242c31ce34445b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 31 Mar 2025 21:40:49 +0200
Subject: [PATCH 12/12] avutil/Makefile: Only include half2float, float2half
 when needed

They are not needed for shared builds (and because --gc-sections
is not the default for shared builds, they were included by default
included in libavutil since bf22c4cc3e005c01f50e233b1582fd1d8051aed9).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavutil/Makefile | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 6fe92aa1c9..9ef118016b 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -139,12 +139,10 @@ OBJS = adler32.o                                                        \
        file.o                                                           \
        file_open.o                                                      \
        float_dsp.o                                                      \
-       float2half.o                                                     \
        float_scalarproduct.o                                            \
        film_grain_params.o                                              \
        fixed_dsp.o                                                      \
        frame.o                                                          \
-       half2float.o                                                     \
        hash.o                                                           \
        hdr_dynamic_metadata.o                                           \
        hdr_dynamic_vivid_metadata.o                                     \
@@ -221,6 +219,13 @@ OBJS-$(!CONFIG_VULKAN)                  += hwcontext_stub.o
 
 OBJS += $(COMPAT_OBJS:%=../compat/%)
 
+# Object files to satisfy dependencies of other libraries for static builds
+STLIBOBJS-$(CONFIG_EXR_DECODER)         += half2float.o float2half.o
+STLIBOBJS-$(CONFIG_EXR_ENCODER)         += float2half.o
+STLIBOBJS-$(CONFIG_PHM_DECODER)         += half2float.o
+STLIBOBJS-$(CONFIG_PHM_ENCODER)         += float2half.o
+STLIBOBJS-$(CONFIG_SWSCALE)             += half2float.o
+
 # Windows resource file
 SHLIBOBJS-$(HAVE_GNU_WINDRES)           += avutilres.o
 
-- 
2.45.2