Merge commit '449511740f06a4675b0066730fa45cdb764ffafc'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 13 May 2014 19:36:14 +0000 (21:36 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 13 May 2014 20:40:32 +0000 (22:40 +0200)
* commit '449511740f06a4675b0066730fa45cdb764ffafc':
  build: handle library dependencies in configure

Conflicts:
common.mak
configure
libavdevice/Makefile
libavfilter/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
common.mak
configure
libavcodec/Makefile
libavdevice/Makefile
libavfilter/Makefile
libavformat/Makefile
libavresample/Makefile
libswscale/Makefile

diff --cc common.mak
@@@ -92,8 -8,7 +92,8 @@@ endi
  include $(SRC_PATH)/arch.mak
  
  OBJS      += $(OBJS-yes)
- FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
 +SLIBOBJS  += $(SLIBOBJS-yes)
+ FFLIBS    := $(FFLIBS-$(NAME)) $(FFLIBS-yes) $(FFLIBS)
  TESTPROGS += $(TESTPROGS-yes)
  
  LDLIBS       = $(FFLIBS:%=%$(BUILDSUF))
diff --cc configure
+++ b/configure
@@@ -2483,67 -2106,25 +2492,67 @@@ frei0r_filter_deps="frei0r dlopen
  frei0r_filter_extralibs='$ldl'
  frei0r_src_filter_deps="frei0r dlopen"
  frei0r_src_filter_extralibs='$ldl'
 +geq_filter_deps="gpl"
 +histeq_filter_deps="gpl"
  hqdn3d_filter_deps="gpl"
  interlace_filter_deps="gpl"
 +kerndeint_filter_deps="gpl"
 +ladspa_filter_deps="ladspa dlopen"
 +mcdeint_filter_deps="avcodec gpl"
 +movie_filter_deps="avcodec avformat"
 +mp_filter_deps="gpl avcodec swscale inline_asm"
 +mpdecimate_filter_deps="gpl avcodec"
 +mptestsrc_filter_deps="gpl"
 +negate_filter_deps="lut_filter"
 +perspective_filter_deps="gpl"
  ocv_filter_deps="libopencv"
 +owdenoise_filter_deps="gpl"
 +pan_filter_deps="swresample"
 +phase_filter_deps="gpl"
 +pp_filter_deps="gpl postproc"
 +pullup_filter_deps="gpl"
 +removelogo_filter_deps="avcodec avformat swscale"
  resample_filter_deps="avresample"
 +sab_filter_deps="gpl swscale"
  scale_filter_deps="swscale"
 +smartblur_filter_deps="gpl swscale"
 +showspectrum_filter_deps="avcodec"
 +showspectrum_filter_select="rdft"
 +spp_filter_deps="gpl avcodec"
 +spp_filter_select="fft"
 +stereo3d_filter_deps="gpl"
 +subtitles_filter_deps="avformat avcodec libass"
 +super2xsai_filter_deps="gpl"
 +tinterlace_filter_deps="gpl"
 +vidstabdetect_filter_deps="libvidstab"
 +vidstabtransform_filter_deps="libvidstab"
 +pixfmts_super2xsai_test_deps="super2xsai_filter"
 +tinterlace_merge_test_deps="tinterlace_filter"
 +tinterlace_pad_test_deps="tinterlace_filter"
 +zmq_filter_deps="libzmq"
  
  # examples
 +avio_reading="avformat avcodec avutil"
  avcodec_example_deps="avcodec avutil"
 +demuxing_decoding_example_deps="avcodec avformat avutil"
  filter_audio_example_deps="avfilter avutil"
 +filtering_audio_example_deps="avfilter avcodec avformat avutil"
 +filtering_video_example_deps="avfilter avcodec avformat avutil"
  metadata_example_deps="avformat avutil"
 -output_example_deps="avcodec avformat avutil swscale"
 -transcode_aac_example_deps="avcodec avformat avresample"
 +muxing_example_deps="avcodec avformat avutil swscale"
 +remuxing_example_deps="avcodec avformat avutil"
 +resampling_audio_example_deps="avutil swresample"
 +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"
  
  # programs
@@@ -5104,6 -4382,20 +5113,42 @@@ for thread in $THREADS_LIST; d
      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"
  
  # build pkg-config files
  
 -    eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
+ 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 <<EOF > $name/$name.pc
 +    cat <<EOF > $name/$name${build_suffix}.pc
  prefix=$prefix
  exec_prefix=\${prefix}
  libdir=$libdir
@@@ -5466,24 -4710,10 +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     "Libav utility library"          "$LIBAVUTIL_VERSION"     "$LIBM"
 -pkgconfig_generate libavcodec    "Libav codec library"            "$LIBAVCODEC_VERSION"    "$extralibs"
 -pkgconfig_generate libavformat   "Libav container format library" "$LIBAVFORMAT_VERSION"   "$extralibs"
 -pkgconfig_generate libavdevice   "Libav device handling library"  "$LIBAVDEVICE_VERSION"   "$extralibs"
 -pkgconfig_generate libavfilter   "Libav video filtering library"  "$LIBAVFILTER_VERSION"   "$extralibs"
 -pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
 -pkgconfig_generate libswscale    "Libav image rescaling library"  "$LIBSWSCALE_VERSION"    "$LIBM"
 +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"
@@@ -1,7 -1,4 +1,6 @@@
 +include $(SUBDIR)../config.mak
 +
  NAME = avcodec
- FFLIBS = avutil
  
  HEADERS = avcodec.h                                                     \
            avfft.h                                                       \
@@@ -1,8 -1,4 +1,6 @@@
 +include $(SUBDIR)../config.mak
 +
  NAME    = avdevice
- FFLIBS  = avformat avcodec avutil
- FFLIBS-$(CONFIG_LAVFI_INDEV) += avfilter
  
  HEADERS = avdevice.h                                                    \
            version.h                                                     \
@@@ -1,33 -1,6 +1,12 @@@
 +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)
  
 -HEADERS = avfilter.h                                                    \
 +HEADERS = asrc_abuffer.h                                                \
 +          avcodec.h                                                     \
 +          avfilter.h                                                    \
            avfiltergraph.h                                               \
            buffersink.h                                                  \
            buffersrc.h                                                   \
@@@ -1,7 -1,4 +1,6 @@@
 +include $(SUBDIR)../config.mak
 +
  NAME = avformat
- FFLIBS = avcodec avutil
  
  HEADERS = avformat.h                                                    \
            avio.h                                                        \
Simple merge
@@@ -1,7 -1,4 +1,6 @@@
 +include $(SUBDIR)../config.mak
 +
  NAME = swscale
- FFLIBS = avutil
  
  HEADERS = swscale.h                                                     \
            version.h                                                     \