This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 4ba56d8ab7 build: Use Make builtin for .objs response files when 
possible
4ba56d8ab7 is described below

commit 4ba56d8ab76308adb4c184ffb203933e3a28e1b3
Author:     crueter <[email protected]>
AuthorDate: Mon May 25 01:19:29 2026 -0400
Commit:     Martin Storsjö <[email protected]>
CommitDate: Wed Jun 24 08:27:10 2026 +0000

    build: Use Make builtin for .objs response files when possible
    
    Since 9e857e1f8aeeb655adb9d09bf53add26a27092e2, library.mak generates a
    response file containing the list of input object files. This was done
    to avoid hitting the 8192 character command line limit on Windows
    shells.
    
    However, that particular solution still relies on emitting a
    very long `echo` command that gets delegated to a subshell. This means
    that, for example, running `make` within problematic shells like Git
    Bash could still hit the command line length limit when this `echo` step
    is ran. Other MSYS2 shells are not affected, meaning the previous
    workaround only helped when running in an MSYS2 environment, but broke
    when using Git Bash, e.g. for MSVC. This primarily affected `libavcodec`
    due to the sheer volume of files contained within.
    
    To avoid this problem, this commit changes the object emission step to
    use GNU make's `file` builtin to write the list of object files. `file`
    itself was introduced in GNU Make 4.0, but FFmpeg still supports old
    versions--notably Apple's ancient Make 3.81--so for older make versions
    that don't support this, the old echo subshell is used. This tradeoff
    should be fine since it's trivial to grab a new-enough Make on Windows,
    and other platforms that may be stuck with ancient Make versions
    shouldn't have nearly as restrictive command line limits.
    
    Signed-off-by: crueter <[email protected]>
---
 ffbuild/library.mak | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ffbuild/library.mak b/ffbuild/library.mak
index 5ab7eb4615..93b3b2e5a7 100644
--- a/ffbuild/library.mak
+++ b/ffbuild/library.mak
@@ -14,6 +14,15 @@ INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
 all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)  $(SUBDIR)lib$(FULLNAME).pc
 all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
 
+# Make <4.0 does not support the built-in file function;
+# versions that do support it should use it, as it's
+# faster and isn't bound by command line length limits.
+ifeq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION))))
+HAVE_BUILTIN_FILE := yes
+else
+HAVE_BUILTIN_FILE := no
+endif
+
 LIBOBJS := $(OBJS) $(SHLIBOBJS) $(STLIBOBJS) $(SUBDIR)%.h.o $(TESTOBJS)
 $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i):   CPPFLAGS += -DHAVE_AV_CONFIG_H
 
@@ -36,7 +45,11 @@ endif
 $(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS)
        $(RM) $@
 ifeq ($(RESPONSE_FILES),yes)
+ifeq ($(HAVE_BUILTIN_FILE),yes)
+       $(file >[email protected],$^)
+else
        $(Q)echo $^ > [email protected]
+endif
        $(AR) $(ARFLAGS) $(AR_O) @[email protected]
 else
        $(AR) $(ARFLAGS) $(AR_O) $^
@@ -75,7 +88,12 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
 $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SUBDIR)lib$(NAME).ver
        $(SLIB_CREATE_DEF_CMD)
 ifeq ($(RESPONSE_FILES),yes)
+ifeq ($(HAVE_BUILTIN_FILE),yes)
+       $$(file >[email protected],$$(filter %.o,$$^))
+else
        $(Q)echo $$(filter %.o,$$^) > [email protected]
+endif
+
        $$(call LINK,$$(call $(NAME)LINK_SO_ARGS) $$(LD_O) @[email protected] $$(call 
$(NAME)LINK_EXTRA))
 else
        $$(call LINK,$$(call $(NAME)LINK_SO_ARGS) $$(LD_O) $$(filter %.o,$$^) 
$$(call $(NAME)LINK_EXTRA))

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to