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
8include $(SRC_PATH)/arch.mak8include $(SRC_PATH)/arch.mak
9 9
10OBJS += $(OBJS-yes)10OBJS += $(OBJS-yes)
11FFLIBS := $(FFLIBS-yes) $(FFLIBS)11FFLIBS := $(FFLIBS-$(NAME)) $(FFLIBS-yes) $(FFLIBS)
12TESTPROGS += $(TESTPROGS-yes)12TESTPROGS += $(TESTPROGS-yes)
13 13
14LDLIBS = $(FFLIBS:%=%$(BUILDSUF))14LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
configure+40−15
@@ -655,6 +655,15 @@ prepend(){ · 654 unmodified lines
655 eval "$var=\"$* \$$var\""655 eval "$var=\"$* \$$var\""
656}656}
657 657
658unique(){
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
658add_cppflags(){667add_cppflags(){
659 append CPPFLAGS "$@"668 append CPPFLAGS "$@"
660}669}
@@ -2110,11 +2119,11 @@ metadata_example_deps="avformat avutil" · 1449 unmodified lines
2110output_example_deps="avcodec avformat avutil swscale"2119output_example_deps="avcodec avformat avutil swscale"
2111transcode_aac_example_deps="avcodec avformat avresample"2120transcode_aac_example_deps="avcodec avformat avresample"
2112 2121
2113# libraries2122# libraries, in linking order
2114avcodec_deps="avutil"2123avcodec_deps="avutil"
2115avdevice_deps="avutil avcodec avformat"2124avdevice_deps="avformat avcodec avutil"
2116avfilter_deps="avutil"2125avfilter_deps="avutil"
2117avformat_deps="avutil avcodec"2126avformat_deps="avcodec avutil"
2118avresample_deps="avutil"2127avresample_deps="avutil"
2119swscale_deps="avutil"2128swscale_deps="avutil"
2120 2129
@@ -4373,6 +4382,20 @@ for thread in $THREADS_LIST; do · 2252 unmodified lines
4373 fi4382 fi
4374done4383done
4375 4384
4385# conditional library dependencies, in linking order
4386enabled movie_filter && prepend avfilter_deps "avformat avcodec"
4387enabled resample_filter && prepend avfilter_deps "avresample"
4388enabled scale_filter && prepend avfilter_deps "swscale"
4389
4390expand_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
4397map 'expand_deps $v' $LIBRARY_LIST
4398
4376echo "install prefix $prefix"4399echo "install prefix $prefix"
4377echo "source path $source_path"4400echo "source path $source_path"
4378echo "C compiler $cc"4401echo "C compiler $cc"
@@ -4578,6 +4601,8 @@ get_version(){ · 199 unmodified lines
4578 4601
4579map 'get_version $v' $LIBRARY_LIST4602map 'get_version $v' $LIBRARY_LIST
4580 4603
4604map 'eval echo "FFLIBS-${v}=\$${v}_deps" >> config.mak' $LIBRARY_LIST
4605
4581print_program_libs(){4606print_program_libs(){
4582 eval "program_libs=\$${1}_libs"4607 eval "program_libs=\$${1}_libs"
4583 eval echo "LIBS-${1}=${program_libs}" >> config.mak4608 eval echo "LIBS-${1}=${program_libs}" >> config.mak
@@ -4639,13 +4664,18 @@ test -n "$WARNINGS" && printf "\n$WARNINGS" · 55 unmodified lines
4639 4664
4640# build pkg-config files4665# build pkg-config files
4641 4666
4667lib_version(){
4668 eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
4669}
4670
4642pkgconfig_generate(){4671pkgconfig_generate(){
4643 name=$14672 name=$1
4644 shortname=${name#lib}${build_suffix}4673 shortname=${name#lib}${build_suffix}
4645 comment=$24674 comment=$2
4646 version=$34675 version=$3
4647 libs=$44676 libs=$4
4648 requires=$54677 requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
4678 requires=${requires%, }
4649 enabled ${name#lib} || return 04679 enabled ${name#lib} || return 0
4650 mkdir -p $name4680 mkdir -p $name
4651 cat <<EOF > $name/$name.pc4681 cat <<EOF > $name/$name.pc
@@ -4680,15 +4710,10 @@ Cflags: -I\${includedir} · 28 unmodified lines
4680EOF4710EOF
4681}4711}
4682 4712
4683lavfi_libs="libavutil = $LIBAVUTIL_VERSION"
4684enabled movie_filter && prepend lavfi_libs "libavformat >= $LIBAVFORMAT_VERSION, libavcodec >= $LIBAVCODEC_VERSION,"
4685enabled resample_filter && prepend lavfi_libs "libavresample >= $LIBAVRESAMPLE_VERSION,"
4686enabled scale_filter && prepend lavfi_libs "libswscale >= $LIBSWSCALE_VERSION,"
4687
4688pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"4713pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
4689pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"4714pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
4690pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"4715pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
4691pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"4716pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
4692pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"4717pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
4693pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"4718pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
4694pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"4719pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"
libavcodec/Makefile+0−1
@@ -1,5 +1,4 @@
1NAME = avcodec1NAME = avcodec
2FFLIBS = avutil
3 2
4HEADERS = avcodec.h \3HEADERS = avcodec.h \
5 avfft.h \4 avfft.h \
libavdevice/Makefile+0−1
@@ -1,5 +1,4 @@
1NAME = avdevice1NAME = avdevice
2FFLIBS = avformat avcodec avutil
3 2
4HEADERS = avdevice.h \3HEADERS = avdevice.h \
5 version.h \4 version.h \
libavfilter/Makefile+0−5
@@ -1,9 +1,4 @@
1NAME = avfilter1NAME = avfilter
2FFLIBS = avutil
3FFLIBS-$(CONFIG_ASYNCTS_FILTER) += avresample
4FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
5FFLIBS-$(CONFIG_RESAMPLE_FILTER) += avresample
6FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
7 2
8HEADERS = avfilter.h \3HEADERS = avfilter.h \
9 avfiltergraph.h \4 avfiltergraph.h \
libavformat/Makefile+0−1
@@ -1,5 +1,4 @@
1NAME = avformat1NAME = avformat
2FFLIBS = avcodec avutil
3 2
4HEADERS = avformat.h \3HEADERS = avformat.h \
5 avio.h \4 avio.h \
libavresample/Makefile+0−1
@@ -1,5 +1,4 @@
1NAME = avresample1NAME = avresample
2FFLIBS = avutil
3 2
4HEADERS = avresample.h \3HEADERS = avresample.h \
5 version.h \4 version.h \
libswscale/Makefile+0−1
@@ -1,5 +1,4 @@
1NAME = swscale1NAME = swscale
2FFLIBS = avutil
3 2
4HEADERS = swscale.h \3HEADERS = swscale.h \
5 version.h \4 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