[FFmpeg-devel] [PATCH 2/2] configure: add option to select use of response files
Gyan Doshi
ffmpeg at gyani.pro
Fri Mar 21 12:40:45 EET 2025
---
configure | 27 ++++++++++++++++++++-------
ffbuild/library.mak | 4 ++--
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/configure b/configure
index 14f7bcde0e..863b9adf22 100755
--- a/configure
+++ b/configure
@@ -427,6 +427,8 @@ Toolchain options:
--enable-thumb compile for Thumb instruction set
--enable-lto[=arg] use link-time optimization
--env="ENV=override" override the environment variables
+ --response-files=ARG Pass list of objects to linker in a file to avoid command line length limits
+ Valid values are: yes, no, auto(default)
Advanced options (experts only):
--malloc-prefix=PREFIX prefix malloc and related names with PREFIX
@@ -4142,6 +4144,7 @@ objformat="elf32"
x86asmexe_default="nasm"
windres_default="windres"
striptype="direct"
+ar_objs_default="auto"
# OS
target_os_default=$(tolower $(uname -s))
@@ -4438,6 +4441,10 @@ for opt do
--enable-lto*)
lto=-f${opt#--enable-}
;;
+ --response-files=*)
+ ar_objs=$optval
+ is_in $ar_objs "yes no auto" || die "Invalid value for response-files: $optval; Valid values are: yes, no, or auto"
+ ;;
--enable-*=*|--disable-*=*)
eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
@@ -5187,7 +5194,7 @@ test -n "$cc_type" && enable $cc_type ||
: ${dep_cc_default:=$cc}
: ${ld_default:=$cc}
: ${host_ld_default:=$host_cc}
-set_default ar as objcc dep_cc ld ln_s host_ld windres
+set_default ar as objcc dep_cc ld ln_s host_ld windres ar_objs
probe_cc as "$as"
asflags_filter=$_flags_filter
@@ -7753,12 +7760,18 @@ case $ld_type in
;;
esac
-{
-ar_out=${FFTMPDIR}/test$LIBSUF
-respfile="@/dev/null"
-out_arg="$(echo $ar_o | sed "s;\$@;$ar_out;g")"
-test_cmd $ar $arflags $out_arg $respfile && ar_objs="true" || ar_objs=""
-}
+if [ "$ar_objs" != "no" ]; then
+ ar_out=${FFTMPDIR}/test$LIBSUF
+ respfile="@/dev/null"
+ out_arg="$(echo $ar_o | sed "s;\$@;$ar_out;g")"
+ if test_cmd $ar $arflags $out_arg $respfile; then
+ ar_objs="yes"
+ elif [ "$ar_objs" = "auto" ]; then
+ ar_objs="no"
+ else
+ die "Response files are not available with this toolchain. Exiting"
+ fi
+fi
enable frame_thread_encoder
diff --git a/ffbuild/library.mak b/ffbuild/library.mak
index 15302852ec..50a4cf74f2 100644
--- a/ffbuild/library.mak
+++ b/ffbuild/library.mak
@@ -35,7 +35,7 @@ OBJS += $(SHLIBOBJS)
endif
$(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS)
$(RM) $@
-ifeq ($(AR_OBJS),true)
+ifeq ($(AR_OBJS),yes)
-$(RM) $@.objs
$(Q)$(foreach ARG,$^,echo -n "$(ARG) " >> $@.objs;)
$(AR) $(ARFLAGS) $(AR_O) @$@.objs
@@ -73,7 +73,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
$(SLIB_CREATE_DEF_CMD)
-ifeq ($(AR_OBJS),true)
+ifeq ($(AR_OBJS),yes)
-$(RM) $$@.objs
$(Q)$(eval LDARGS=$$(filter %.o,$$^))
$(Q)$(foreach ARG,$$(LDARGS),echo -n "$(ARG) " >> $$@.objs;)
--
2.46.1
More information about the ffmpeg-devel
mailing list