diff --git a/common.mak b/common.mak index cdad4f37b571924e30f3dc869e804cf922f80ebd..eaa6b4711718b76e2ad0f04166fdd0beff56ca03 100644 --- a/common.mak +++ b/common.mak @@ -93,7 +93,7 @@ include $(SRC_PATH)/arch.mak OBJS += $(OBJS-yes) SLIBOBJS += $(SLIBOBJS-yes) -FFLIBS := $(FFLIBS-yes) $(FFLIBS) +FFLIBS := $(FFLIBS-$(NAME)) $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) LDLIBS = $(FFLIBS:%=%$(BUILDSUF)) diff --git a/configure b/configure index b2a764e7b6013b98c202f3a7d1f02d38846d8daf..dc7a49f5cee844b31ad353068e9ce34f4580a9c5 100755 --- a/configure +++ b/configure @@ -726,6 +726,15 @@ prepend(){ eval "$var=\"$* \$$var\"" } +unique(){ + var=$1 + uniq_list="" + for tok in $(eval echo \$$var); do + uniq_list="$(filter_out $tok $uniq_list) $tok" + done + eval "$var=\"${uniq_list}\"" +} + add_cppflags(){ append CPPFLAGS "$@" } @@ -2537,11 +2546,11 @@ scaling_video_example_deps="avutil swscale" transcode_aac_example_deps="avcodec avformat swresample" transcoding_example_deps="avfilter avcodec avformat avutil" -# libraries +# libraries, in linking order avcodec_deps="avutil" -avdevice_deps="avutil avcodec avformat" +avdevice_deps="avformat avcodec avutil" avfilter_deps="avutil" -avformat_deps="avutil avcodec" +avformat_deps="avcodec avutil" avresample_deps="avutil" postproc_deps="avutil gpl" swscale_deps="avutil" @@ -5104,6 +5113,42 @@ for thread in $THREADS_LIST; do fi done +# conditional library dependencies, in linking order +enabled aconvert_filter && prepend avfilter_deps "swresample" +enabled amovie_filter && prepend avfilter_deps "avformat avcodec" +enabled aresample_filter && prepend avfilter_deps "swresample" +enabled asyncts_filter && prepend avfilter_deps "avresample" +enabled atempo_filter && prepend avfilter_deps "avcodec" +enabled decimate_filter && prepend avfilter_deps "avcodec" +enabled deshake_filter && prepend avfilter_deps "avcodec" +enabled elbg_filter && prepend avfilter_deps "avcodec" +enabled mcdeint_filter && prepend avfilter_deps "avcodec" +enabled movie_filter && prepend avfilter_deps "avformat avcodec" +enabled mp_filter && prepend avfilter_deps "avcodec" +enabled pan_filter && prepend avfilter_deps "swresample" +enabled pp_filter && prepend avfilter_deps "postproc" +enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale" +enabled resample_filter && prepend avfilter_deps "avresample" +enabled sab_filter && prepend avfilter_deps "swscale" +enabled scale_filter && prepend avfilter_deps "swscale" +enabled showspectrum_filter && prepend avfilter_deps "avcodec" +enabled smartblur_filter && prepend avfilter_deps "swscale" +enabled subtitles_filter && prepend avfilter_deps "avformat avcodec" + +enabled lavfi_indev && prepend avdevice_deps "avfilter" + +expand_deps(){ + lib_deps=${1}_deps + eval "deps=\$$lib_deps" + append $lib_deps $(map 'eval echo \$${v}_deps' $deps) + unique $lib_deps +} + +#we have to remove gpl from the deps here as some code assumes all lib deps are libs +postproc_deps="$(filter_out 'gpl' $postproc_deps)" + +map 'expand_deps $v' $LIBRARY_LIST + echo "install prefix $prefix" echo "source path $source_path" echo "C compiler $cc" @@ -5345,6 +5390,8 @@ get_version(){ map 'get_version $v' $LIBRARY_LIST +map 'eval echo "FFLIBS-${v}=\$${v}_deps" >> config.mak' $LIBRARY_LIST + print_program_libs(){ eval "program_libs=\$${1}_libs" eval echo "LIBS-${1}=${program_libs}" >> config.mak @@ -5421,13 +5468,18 @@ fi # build pkg-config files +lib_version(){ + eval printf "\"lib${1}${build_suffix} >= \$LIB$(toupper ${1})_VERSION, \"" +} + pkgconfig_generate(){ name=$1 shortname=${name#lib}${build_suffix} comment=$2 version=$3 libs=$4 - requires=$5 + requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps)) + requires=${requires%, } enabled ${name#lib} || return 0 mkdir -p $name cat < $name/$name${build_suffix}.pc @@ -5466,24 +5518,12 @@ Cflags: -I\${includedir} EOF } -lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION" -enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION," -enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION," -enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION," -enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION," -enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION," -enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION," -lavfi_libs=${lavfi_libs%, } - -lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION" -enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION," - pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM" -pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION" -pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION" -pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs" -pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs" -pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION" -pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION" -pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION" -pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION" +pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" +pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" +pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" +pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" +pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" +pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" +pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" +pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 463e1a92c16e0cbd94850f83c68d0d1bdbf7b5ee..34544de882774fe7180633c965b6c2784303af1d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1,7 +1,6 @@ include $(SUBDIR)../config.mak NAME = avcodec -FFLIBS = avutil HEADERS = avcodec.h \ avfft.h \ diff --git a/libavdevice/Makefile b/libavdevice/Makefile index d4e691121f29d1d914b5528dda3e840e90ee9e66..767df19aa7c813ab109efc2dae94c679de85b57f 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -1,8 +1,6 @@ include $(SUBDIR)../config.mak NAME = avdevice -FFLIBS = avformat avcodec avutil -FFLIBS-$(CONFIG_LAVFI_INDEV) += avfilter HEADERS = avdevice.h \ version.h \ diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 65786cf0c1082bb0cafbfe2aecbaef288c6bf44a..d61b69eebe5aaea209184b5810647b443a681cf8 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -1,27 +1,6 @@ include $(SUBDIR)../config.mak NAME = avfilter -FFLIBS = avutil -FFLIBS-$(CONFIG_ACONVERT_FILTER) += swresample -FFLIBS-$(CONFIG_AMOVIE_FILTER) += avformat avcodec -FFLIBS-$(CONFIG_ARESAMPLE_FILTER) += swresample -FFLIBS-$(CONFIG_ASYNCTS_FILTER) += avresample -FFLIBS-$(CONFIG_ATEMPO_FILTER) += avcodec -FFLIBS-$(CONFIG_DECIMATE_FILTER) += avcodec -FFLIBS-$(CONFIG_DESHAKE_FILTER) += avcodec -FFLIBS-$(CONFIG_ELBG_FILTER) += avcodec -FFLIBS-$(CONFIG_MCDEINT_FILTER) += avcodec -FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec -FFLIBS-$(CONFIG_MP_FILTER) += avcodec -FFLIBS-$(CONFIG_PAN_FILTER) += swresample -FFLIBS-$(CONFIG_PP_FILTER) += postproc -FFLIBS-$(CONFIG_REMOVELOGO_FILTER) += avformat avcodec swscale -FFLIBS-$(CONFIG_RESAMPLE_FILTER) += avresample -FFLIBS-$(CONFIG_SAB_FILTER) += swscale -FFLIBS-$(CONFIG_SCALE_FILTER) += swscale -FFLIBS-$(CONFIG_SHOWSPECTRUM_FILTER) += avcodec -FFLIBS-$(CONFIG_SMARTBLUR_FILTER) += swscale -FFLIBS-$(CONFIG_SUBTITLES_FILTER) += avformat avcodec EBUR128LIBS-$(CONFIG_SWRESAMPLE) = swresample FFLIBS-$(CONFIG_EBUR128_FILTER) += $(EBUR128LIBS-yes) diff --git a/libavformat/Makefile b/libavformat/Makefile index 457a69f9142b69b50a5a6aa84d24daf310ecc8be..00358e771b9c851f5be423cd813bd68340cf4008 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -1,7 +1,6 @@ include $(SUBDIR)../config.mak NAME = avformat -FFLIBS = avcodec avutil HEADERS = avformat.h \ avio.h \ diff --git a/libavresample/Makefile b/libavresample/Makefile index bca23a9844b43f90dd0d0b70193d910e5b0f8d8a..7d857a0e368779c755d098e54c7fd7c481373785 100644 --- a/libavresample/Makefile +++ b/libavresample/Makefile @@ -1,5 +1,4 @@ NAME = avresample -FFLIBS = avutil HEADERS = avresample.h \ version.h \ diff --git a/libswscale/Makefile b/libswscale/Makefile index ca6e27d1f03e128a8c6afaf1a272b7b867652a76..e96837f06489bf72e8d3cfa9c619b872f1df97dd 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -1,7 +1,6 @@ include $(SUBDIR)../config.mak NAME = swscale -FFLIBS = avutil HEADERS = swscale.h \ version.h \