[MPlayer-dev-eng] [PATCH][RFC] configure: Invoke FFmpeg's configure
Alexander Strasser
eclipse7 at gmx.net
Mon Jan 8 23:14:24 EET 2018
This is not a finished patch. I want to gather opinions on
going this route to pave the way for further development.
One downside of this patch is that configure will be slower.
On my tests running configure took twice as long. Though I
think, if we take into account the frustration it saves for
users building MPlayer and the time it saves for developers,
it should be OK.
Here is a probably incomplete list of TODOs:
* pass on build tools related options
(like selected compiler, crosscompiling etc.)
* better merging of the additionally needed libs into extra_ldflags
* use libs autodetected by MPlayer's configure to enable features in FFmpeg
* remove some stuff that is no longer needed to be done in MPlayer's
configure (as long as it isn't too time consuming to do)
* show summarized results of FFmpeg's configure in MPlayer's configure output
* test more thoroughly
* test on more platforms
HOWEVER after completion of those points, this will still only be
a short to mid term solution. It should give us time to discuss and
find a long term direction and eventually implement that step
by step. That new discussion should be started in a dedicated mail
thread. I can do it after we have decided about this approach.
Here follows the promised data on how often we change configure:
* Starting from 2017-01-01 to 2017-01-07 there were 109 commits in total
* 78/109 commits (~71.6%) were *not* touching configure
* 31/109 commits (~28.4%) were touching configure
* 26/31 commits (~83.9%) related to FFmpeg's build system somehow
* 5/31 commits (~16,1%) not related to FFmpeg's build system somehow
Some of that 26 commits related to FFmpeg's build system are not
a direct response to a change in FFmpeg but probably wouldn't have
been needed if we would run FFmpeg's configure as is proposed in this
patch. I didn't closely look at all commit diffs, and there might be
some errors in how I processed or catagorized the data. I will post
the data in subsequent reply, so others can have a look and/or
investigate on their own.
I am eagerly waiting for your comments. Let's move forward tackling
the recurring problems with the build system.
Alexander
---
configure | 85 +++++++++------------------------------------------------------
1 file changed, 11 insertions(+), 74 deletions(-)
diff --git a/configure b/configure
index f62865248..4832c1a4b 100755
--- a/configure
+++ b/configure
@@ -8235,6 +8235,17 @@ else
fi
echores "$_dvdnav"
+if test "$ffmpeg_a" != "no" ; then
+ echocheck "Configuring internal FFmpeg"
+ res_internal_ffmpeg_configured="no"
+ if (cd ffmpeg && ./configure --enable-gpl >/dev/null 2>&1) then
+ res_internal_ffmpeg_configured="yes"
+ fi
+ ffmpeg_extra_libs="$(awk -F= '/^EXTRALIBS/ { if ($2 != "") s[$2] } END { for (extralibs in s) { all_libs = all_libs " " extralibs } ; print all_libs }' ffmpeg/ffbuild/config.mak)"
+ extra_ldflags="$extra_ldflags $ffmpeg_extra_libs"
+ echores "$res_internal_ffmpeg_configured"
+fi
+
extra_ldflags="$extra_ldflags $libm"
# DO NOT ADD ANY TESTS THAT USE LINKER FLAGS HERE (like cc_check).
@@ -9498,80 +9509,6 @@ cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h
############################################################################
-# Create FFmpeg config files only for internal ffmpeg
-if test "$ffmpeg_a" = yes; then
-
-# Create avconfig.h for FFmpeg.
-cat > "$TMPH" << EOF
-/* Generated by mpconfigure */
-#ifndef AVUTIL_AVCONFIG_H
-#define AVUTIL_AVCONFIG_H
-$def_av_bigendian
-$def_av_fast_unaligned
-#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
-#endif /* AVUTIL_AVCONFIG_H */
-EOF
-
-# Do not overwrite an unchanged avconfig.h to avoid superfluous rebuilds.
-cmp -s "$TMPH" ffmpeg/libavutil/avconfig.h || mv -f "$TMPH" ffmpeg/libavutil/avconfig.h
-
-
-if x86; then
-# Create a skeleton config.asm with just the ARCH_ and *CODER definitions for FFmpeg.
-> "$TMPS"
-echo "%define CONFIG_GPL 1" >> "$TMPS"
-echo "%define HAVE_ALIGNED_STACK 1" >> "$TMPS"
-echo "$(ff_config_enable "$arch_all" "$arch" "%" "ARCH")" >> "$TMPS"
-echo "$(ff_config_enable "$subarch_all" "$subarch" "%" "ARCH")" >> "$TMPS"
-echo "$(ff_config_enable "$cpuexts_all" "$cpuexts_external" "%" "HAVE" "_EXTERNAL")" >> "$TMPS"
-echo "$(ff_config_enable "$cpuexts_all" "$cpuexts" "%" "HAVE" "_INLINE")" >> "$TMPS"
-echo "$(ff_config_enable "$yasm_features_all" "$yasm_features" "%" "HAVE")" >> "$TMPS"
-echo "$(ff_config_enable "$libavdecoders_all" "$libavdecoders" "%" "CONFIG")" >> "$TMPS"
-echo "$(ff_config_enable "$libavencoders_all" "$libavencoders" "%" "CONFIG")" >> "$TMPS"
-
-cmp -s "$TMPS" ffmpeg/config.asm || mv -f "$TMPS" ffmpeg/config.asm
-fi
-
-
-# Create a config.mak for FFmpeg that includes MPlayer's config.mak.
-cat > ffmpeg/ffbuild/config.mak << EOF
-ifndef FFMPEG_CONFIG_MAK
-FFMPEG_CONFIG_MAK = 1
-include ../config.mak
-endif # FFMPEG_CONFIG_MAK
-EOF
-
-# TODO: temporary support for older ffmpeg
-cp ffmpeg/ffbuild/config.mak ffmpeg/config.mak
-
-cat > ffmpeg/config.h << EOF
-#include "../config.h"
-EOF
-touch ffmpeg/.config
-
-# generate the lists of enabled components for ffmpeg
-print_enabled_components(){
- file=$1
- struct_name=$2
- name=$3
- shift 3
- list=$(echo $* | tolower)
- echo "static const $struct_name *$name[] = {" > $TMPH
- for c in $list; do
- printf " &ff_%s,\n" $c >> $TMPH
- done
- echo " NULL };" >> $TMPH
- cmp -s $TMPH ffmpeg/$file && return
- cp $TMPH ffmpeg/$file
-}
-
-print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $libavbsfs
-print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $libavprotocols
-
-fi
-
-#############################################################################
-
cat << EOF
Config files successfully generated by ./configure $configuration !
--
More information about the MPlayer-dev-eng
mailing list