History

build: handle library dependencies in configure

Instead of setting FFLIBS in each library Makefile configure exports FFLIBS-$library in config.mak.

Janne Grunau committed 12 years ago

Commit 44951171 parent 9aa45928 files · +41 −26Browse files

Unified · Split

8 files
  1. common.mak +1 −1
  2. configure +40 −15
  3. libavcodec/Makefile +0 −1
  4. libavdevice/Makefile +0 −1
  5. libavfilter/Makefile +0 −5
  6. libavformat/Makefile +0 −1
  7. libavresample/Makefile +0 −1
  8. libswscale/Makefile +0 −1
common.mak+1−1
@@ -8,7 +8,7 @@ all: all-yes · 7 unmodified lines
88 include $(SRC_PATH)/arch.mak
99
1010 OBJS += $(OBJS-yes)
11−FFLIBS := $(FFLIBS-yes) $(FFLIBS)
11+FFLIBS := $(FFLIBS-$(NAME)) $(FFLIBS-yes) $(FFLIBS)
1212 TESTPROGS += $(TESTPROGS-yes)
1313
1414 LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
configure+40−15
@@ -655,6 +655,15 @@ prepend(){ · 654 unmodified lines
655655 eval "$var=\"$* \$$var\""
656656 }
657657
658+unique(){
659+ var=$1
660+ uniq_list=""
661+ for tok in $(eval echo \$$var); do
662+ uniq_list="$(filter_out $tok $uniq_list) $tok"
663+ done
664+ eval "$var=\"${uniq_list}\""
665+}
666+
658667 add_cppflags(){
659668 append CPPFLAGS "$@"
660669 }
@@ -2110,11 +2119,11 @@ metadata_example_deps="avformat avutil" · 1449 unmodified lines
21102119 output_example_deps="avcodec avformat avutil swscale"
21112120 transcode_aac_example_deps="avcodec avformat avresample"
21122121
2113−# libraries
2122+# libraries, in linking order
21142123 avcodec_deps="avutil"
2115−avdevice_deps="avutil avcodec avformat"
2124+avdevice_deps="avformat avcodec avutil"
21162125 avfilter_deps="avutil"
2117−avformat_deps="avutil avcodec"
2126+avformat_deps="avcodec avutil"
21182127 avresample_deps="avutil"
21192128 swscale_deps="avutil"
21202129
@@ -4373,6 +4382,20 @@ for thread in $THREADS_LIST; do · 2252 unmodified lines
43734382 fi
43744383 done
43754384
4385+# conditional library dependencies, in linking order
4386+enabled movie_filter && prepend avfilter_deps "avformat avcodec"
4387+enabled resample_filter && prepend avfilter_deps "avresample"
4388+enabled scale_filter && prepend avfilter_deps "swscale"
4389+
4390+expand_deps(){
4391+ lib_deps=${1}_deps
4392+ eval "deps=\$$lib_deps"
4393+ append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
4394+ unique $lib_deps
4395+}
4396+
4397+map 'expand_deps $v' $LIBRARY_LIST
4398+
43764399 echo "install prefix $prefix"
43774400 echo "source path $source_path"
43784401 echo "C compiler $cc"
@@ -4578,6 +4601,8 @@ get_version(){ · 199 unmodified lines
45784601
45794602 map 'get_version $v' $LIBRARY_LIST
45804603
4604+map 'eval echo "FFLIBS-${v}=\$${v}_deps" >> config.mak' $LIBRARY_LIST
4605+
45814606 print_program_libs(){
45824607 eval "program_libs=\$${1}_libs"
45834608 eval echo "LIBS-${1}=${program_libs}" >> config.mak
@@ -4639,13 +4664,18 @@ test -n "$WARNINGS" && printf "\n$WARNINGS" · 55 unmodified lines
46394664
46404665 # build pkg-config files
46414666
4667+lib_version(){
4668+ eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
4669+}
4670+
46424671 pkgconfig_generate(){
46434672 name=$1
46444673 shortname=${name#lib}${build_suffix}
46454674 comment=$2
46464675 version=$3
46474676 libs=$4
4648− requires=$5
4677+ requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
4678+ requires=${requires%, }
46494679 enabled ${name#lib} || return 0
46504680 mkdir -p $name
46514681 cat <<EOF > $name/$name.pc
@@ -4680,15 +4710,10 @@ Cflags: -I\${includedir} · 28 unmodified lines
46804710 EOF
46814711 }
46824712
4683−lavfi_libs="libavutil = $LIBAVUTIL_VERSION"
4684−enabled movie_filter && prepend lavfi_libs "libavformat >= $LIBAVFORMAT_VERSION, libavcodec >= $LIBAVCODEC_VERSION,"
4685−enabled resample_filter && prepend lavfi_libs "libavresample >= $LIBAVRESAMPLE_VERSION,"
4686−enabled scale_filter && prepend lavfi_libs "libswscale >= $LIBSWSCALE_VERSION,"
4687−
46884713 pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
4689−pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
4690−pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
4691−pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
4692−pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
4693−pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
4694−pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
4714+pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
4715+pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
4716+pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
4717+pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
4718+pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
4719+pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"
libavcodec/Makefile+0−1
@@ -1,5 +1,4 @@
11 NAME = avcodec
2−FFLIBS = avutil
32
43 HEADERS = avcodec.h \
54 avfft.h \
libavdevice/Makefile+0−1
@@ -1,5 +1,4 @@
11 NAME = avdevice
2−FFLIBS = avformat avcodec avutil
32
43 HEADERS = avdevice.h \
54 version.h \
libavfilter/Makefile+0−5
@@ -1,9 +1,4 @@
11 NAME = avfilter
2−FFLIBS = avutil
3−FFLIBS-$(CONFIG_ASYNCTS_FILTER) += avresample
4−FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
5−FFLIBS-$(CONFIG_RESAMPLE_FILTER) += avresample
6−FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
72
83 HEADERS = avfilter.h \
94 avfiltergraph.h \
libavformat/Makefile+0−1
@@ -1,5 +1,4 @@
11 NAME = avformat
2−FFLIBS = avcodec avutil
32
43 HEADERS = avformat.h \
54 avio.h \
libavresample/Makefile+0−1
@@ -1,5 +1,4 @@
11 NAME = avresample
2−FFLIBS = avutil
32
43 HEADERS = avresample.h \
54 version.h \
libswscale/Makefile+0−1
@@ -1,5 +1,4 @@
11 NAME = swscale
2−FFLIBS = avutil
32
43 HEADERS = swscale.h \
54 version.h \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t