mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-24 17:12:34 +02:00
build: handle library dependencies in configure
Instead of setting FFLIBS in each library Makefile configure exports FFLIBS-$library in config.mak.
This commit is contained in:
parent
9aa4592076
commit
449511740f
@ -8,7 +8,7 @@ all: all-yes
|
|||||||
include $(SRC_PATH)/arch.mak
|
include $(SRC_PATH)/arch.mak
|
||||||
|
|
||||||
OBJS += $(OBJS-yes)
|
OBJS += $(OBJS-yes)
|
||||||
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
FFLIBS := $(FFLIBS-$(NAME)) $(FFLIBS-yes) $(FFLIBS)
|
||||||
TESTPROGS += $(TESTPROGS-yes)
|
TESTPROGS += $(TESTPROGS-yes)
|
||||||
|
|
||||||
LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
|
LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
|
||||||
|
55
configure
vendored
55
configure
vendored
@ -655,6 +655,15 @@ prepend(){
|
|||||||
eval "$var=\"$* \$$var\""
|
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(){
|
add_cppflags(){
|
||||||
append CPPFLAGS "$@"
|
append CPPFLAGS "$@"
|
||||||
}
|
}
|
||||||
@ -2110,11 +2119,11 @@ metadata_example_deps="avformat avutil"
|
|||||||
output_example_deps="avcodec avformat avutil swscale"
|
output_example_deps="avcodec avformat avutil swscale"
|
||||||
transcode_aac_example_deps="avcodec avformat avresample"
|
transcode_aac_example_deps="avcodec avformat avresample"
|
||||||
|
|
||||||
# libraries
|
# libraries, in linking order
|
||||||
avcodec_deps="avutil"
|
avcodec_deps="avutil"
|
||||||
avdevice_deps="avutil avcodec avformat"
|
avdevice_deps="avformat avcodec avutil"
|
||||||
avfilter_deps="avutil"
|
avfilter_deps="avutil"
|
||||||
avformat_deps="avutil avcodec"
|
avformat_deps="avcodec avutil"
|
||||||
avresample_deps="avutil"
|
avresample_deps="avutil"
|
||||||
swscale_deps="avutil"
|
swscale_deps="avutil"
|
||||||
|
|
||||||
@ -4373,6 +4382,20 @@ for thread in $THREADS_LIST; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# conditional library dependencies, in linking order
|
||||||
|
enabled movie_filter && prepend avfilter_deps "avformat avcodec"
|
||||||
|
enabled resample_filter && prepend avfilter_deps "avresample"
|
||||||
|
enabled scale_filter && prepend avfilter_deps "swscale"
|
||||||
|
|
||||||
|
expand_deps(){
|
||||||
|
lib_deps=${1}_deps
|
||||||
|
eval "deps=\$$lib_deps"
|
||||||
|
append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
|
||||||
|
unique $lib_deps
|
||||||
|
}
|
||||||
|
|
||||||
|
map 'expand_deps $v' $LIBRARY_LIST
|
||||||
|
|
||||||
echo "install prefix $prefix"
|
echo "install prefix $prefix"
|
||||||
echo "source path $source_path"
|
echo "source path $source_path"
|
||||||
echo "C compiler $cc"
|
echo "C compiler $cc"
|
||||||
@ -4578,6 +4601,8 @@ get_version(){
|
|||||||
|
|
||||||
map 'get_version $v' $LIBRARY_LIST
|
map 'get_version $v' $LIBRARY_LIST
|
||||||
|
|
||||||
|
map 'eval echo "FFLIBS-${v}=\$${v}_deps" >> config.mak' $LIBRARY_LIST
|
||||||
|
|
||||||
print_program_libs(){
|
print_program_libs(){
|
||||||
eval "program_libs=\$${1}_libs"
|
eval "program_libs=\$${1}_libs"
|
||||||
eval echo "LIBS-${1}=${program_libs}" >> config.mak
|
eval echo "LIBS-${1}=${program_libs}" >> config.mak
|
||||||
@ -4639,13 +4664,18 @@ test -n "$WARNINGS" && printf "\n$WARNINGS"
|
|||||||
|
|
||||||
# build pkg-config files
|
# build pkg-config files
|
||||||
|
|
||||||
|
lib_version(){
|
||||||
|
eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
|
||||||
|
}
|
||||||
|
|
||||||
pkgconfig_generate(){
|
pkgconfig_generate(){
|
||||||
name=$1
|
name=$1
|
||||||
shortname=${name#lib}${build_suffix}
|
shortname=${name#lib}${build_suffix}
|
||||||
comment=$2
|
comment=$2
|
||||||
version=$3
|
version=$3
|
||||||
libs=$4
|
libs=$4
|
||||||
requires=$5
|
requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
|
||||||
|
requires=${requires%, }
|
||||||
enabled ${name#lib} || return 0
|
enabled ${name#lib} || return 0
|
||||||
mkdir -p $name
|
mkdir -p $name
|
||||||
cat <<EOF > $name/$name.pc
|
cat <<EOF > $name/$name.pc
|
||||||
@ -4680,15 +4710,10 @@ Cflags: -I\${includedir}
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
lavfi_libs="libavutil = $LIBAVUTIL_VERSION"
|
|
||||||
enabled movie_filter && prepend lavfi_libs "libavformat >= $LIBAVFORMAT_VERSION, libavcodec >= $LIBAVCODEC_VERSION,"
|
|
||||||
enabled resample_filter && prepend lavfi_libs "libavresample >= $LIBAVRESAMPLE_VERSION,"
|
|
||||||
enabled scale_filter && prepend lavfi_libs "libswscale >= $LIBSWSCALE_VERSION,"
|
|
||||||
|
|
||||||
pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
|
pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
|
||||||
pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
|
pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
|
||||||
pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
|
pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
|
||||||
pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
|
pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
|
||||||
pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
|
pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
|
||||||
pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
|
pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
|
||||||
pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
|
pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
NAME = avcodec
|
NAME = avcodec
|
||||||
FFLIBS = avutil
|
|
||||||
|
|
||||||
HEADERS = avcodec.h \
|
HEADERS = avcodec.h \
|
||||||
avfft.h \
|
avfft.h \
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
NAME = avdevice
|
NAME = avdevice
|
||||||
FFLIBS = avformat avcodec avutil
|
|
||||||
|
|
||||||
HEADERS = avdevice.h \
|
HEADERS = avdevice.h \
|
||||||
version.h \
|
version.h \
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
NAME = avfilter
|
NAME = avfilter
|
||||||
FFLIBS = avutil
|
|
||||||
FFLIBS-$(CONFIG_ASYNCTS_FILTER) += avresample
|
|
||||||
FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
|
|
||||||
FFLIBS-$(CONFIG_RESAMPLE_FILTER) += avresample
|
|
||||||
FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
|
|
||||||
|
|
||||||
HEADERS = avfilter.h \
|
HEADERS = avfilter.h \
|
||||||
avfiltergraph.h \
|
avfiltergraph.h \
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
NAME = avformat
|
NAME = avformat
|
||||||
FFLIBS = avcodec avutil
|
|
||||||
|
|
||||||
HEADERS = avformat.h \
|
HEADERS = avformat.h \
|
||||||
avio.h \
|
avio.h \
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
NAME = avresample
|
NAME = avresample
|
||||||
FFLIBS = avutil
|
|
||||||
|
|
||||||
HEADERS = avresample.h \
|
HEADERS = avresample.h \
|
||||||
version.h \
|
version.h \
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
NAME = swscale
|
NAME = swscale
|
||||||
FFLIBS = avutil
|
|
||||||
|
|
||||||
HEADERS = swscale.h \
|
HEADERS = swscale.h \
|
||||||
version.h \
|
version.h \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user