Re: [libav-devel] [PATCH 15/15] [RFC] configure: more fine-grained link-time dependency settings
On Thu, Nov 24, 2016 at 07:38:11PM +0100, Janne Grunau wrote: > On 2016-11-24 17:24:01 +0100, Diego Biurrun wrote: > > --- > > > > This works as advertised. > > > > Issues: > > > > - Maybe keeping _extralibs as suffix is better than _lbs, dunno. > > - Possibly I should investigate Janne's idea of using the function > > name as variable name instead of adding a library name parameter > > to things like check_lib(). > > - The case statement in check_deps that adds the flags to the right > > component is ugly. I don't have a better idea yet, but I was also > > busy getting the rest of the patch to work at all. > > Janne? > > > > --- a/configure > > +++ b/configure > > @@ -650,8 +650,31 @@ check_deps(){ > > > > for cfg in $allopts; do > > enabled $cfg || continue > > -eval dep_extralibs="\$${cfg}_extralibs" > > -test -n "$dep_extralibs" && add_extralibs $dep_extralibs > > +eval dep_lbs="\$${cfg}_lbs" > > +for lib in $dep_lbs; do > > +eval append dep_libs "\$${lib}" > > +done > > +if test -n "$dep_libs"; then > > +case $cfg in > > +*coder|*parser|*bsf|*hwaccel) > > +add_extralibs_lib avcodec $dep_libs ;; > > +*muxer|*protocol) > > +add_extralibs_lib avformat $dep_libs ;; > > +*filter) > > +add_extralibs_lib avfilter $dep_libs ;; > > +*indev|*outdev) > > +add_extralibs_lib avdevice $dep_libs ;; > > +avutil) > > +add_extralibs_lib avutil $dep_libs ;; > > +avconv) > > +add_extralibs_lib avconv $dep_libs ;; > > +avplay) > > +add_extralibs_lib avplay $dep_libs ;; > > +avprobe) > > +add_extralibs_lib avprobe $dep_libs ;; > > +esac > > +unset dep_libs > > +fi > > Since we already have nice separated lists for all this it's probably > nicer to add the extralibs separately after check_deps() > > set_component_extralibs(){ > linkunit=$1 > shift 1 > for cfg in $@; do > enabled $cfg || continue > eval dep_lbs="\$${cfg}_lbs" > for lib in $dep_lbs; do > eval append dep_libs "\$${lib}" > done > if test -n "$dep_libs"; then > add_extralibs_lib $linkunit $dep_libs > fi > done > } > > set_component_extralibs avcodec $BSF_LIST $DECODER_LIST ... > > proof of concept, see disable_components() how to get all component > lists for a given library and integrate it into the loop below > > for linkunit in $LIBRARY_LIST $PROGRAM_LIST; do > set_component_extralibs $linkunit $linkunit > done I owe you a few beers or a box of chocolate :) Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 15/15] [RFC] configure: more fine-grained link-time dependency settings
On 2016-11-24 17:24:01 +0100, Diego Biurrun wrote: > --- > > This works as advertised. > > Issues: > > - Maybe keeping _extralibs as suffix is better than _lbs, dunno. > - Possibly I should investigate Janne's idea of using the function > name as variable name instead of adding a library name parameter > to things like check_lib(). > - The case statement in check_deps that adds the flags to the right > component is ugly. I don't have a better idea yet, but I was also > busy getting the rest of the patch to work at all. > Janne? > > configure | 305 > -- > 1 file changed, 237 insertions(+), 68 deletions(-) > > diff --git a/configure b/configure > index 27fb6ea..233bad4 100755 > --- a/configure > +++ b/configure > @@ -650,8 +650,31 @@ check_deps(){ > > for cfg in $allopts; do > enabled $cfg || continue > -eval dep_extralibs="\$${cfg}_extralibs" > -test -n "$dep_extralibs" && add_extralibs $dep_extralibs > +eval dep_lbs="\$${cfg}_lbs" > +for lib in $dep_lbs; do > +eval append dep_libs "\$${lib}" > +done > +if test -n "$dep_libs"; then > +case $cfg in > +*coder|*parser|*bsf|*hwaccel) > +add_extralibs_lib avcodec $dep_libs ;; > +*muxer|*protocol) > +add_extralibs_lib avformat $dep_libs ;; > +*filter) > +add_extralibs_lib avfilter $dep_libs ;; > +*indev|*outdev) > +add_extralibs_lib avdevice $dep_libs ;; > +avutil) > +add_extralibs_lib avutil $dep_libs ;; > +avconv) > +add_extralibs_lib avconv $dep_libs ;; > +avplay) > +add_extralibs_lib avplay $dep_libs ;; > +avprobe) > +add_extralibs_lib avprobe $dep_libs ;; > +esac > +unset dep_libs > +fi Since we already have nice separated lists for all this it's probably nicer to add the extralibs separately after check_deps() set_component_extralibs(){ linkunit=$1 shift 1 for cfg in $@; do enabled $cfg || continue eval dep_lbs="\$${cfg}_lbs" for lib in $dep_lbs; do eval append dep_libs "\$${lib}" done if test -n "$dep_libs"; then add_extralibs_lib $linkunit $dep_libs fi done } set_component_extralibs avcodec $BSF_LIST $DECODER_LIST ... proof of concept, see disable_components() how to get all component lists for a given library and integrate it into the loop below for linkunit in $LIBRARY_LIST $PROGRAM_LIST; do set_component_extralibs $linkunit $linkunit done Janne ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 15/15] [RFC] configure: more fine-grained link-time dependency settings
--- This works as advertised. Issues: - Maybe keeping _extralibs as suffix is better than _lbs, dunno. - Possibly I should investigate Janne's idea of using the function name as variable name instead of adding a library name parameter to things like check_lib(). - The case statement in check_deps that adds the flags to the right component is ugly. I don't have a better idea yet, but I was also busy getting the rest of the patch to work at all. Janne? configure | 305 -- 1 file changed, 237 insertions(+), 68 deletions(-) diff --git a/configure b/configure index 27fb6ea..233bad4 100755 --- a/configure +++ b/configure @@ -650,8 +650,31 @@ check_deps(){ for cfg in $allopts; do enabled $cfg || continue -eval dep_extralibs="\$${cfg}_extralibs" -test -n "$dep_extralibs" && add_extralibs $dep_extralibs +eval dep_lbs="\$${cfg}_lbs" +for lib in $dep_lbs; do +eval append dep_libs "\$${lib}" +done +if test -n "$dep_libs"; then +case $cfg in +*coder|*parser|*bsf|*hwaccel) +add_extralibs_lib avcodec $dep_libs ;; +*muxer|*protocol) +add_extralibs_lib avformat $dep_libs ;; +*filter) +add_extralibs_lib avfilter $dep_libs ;; +*indev|*outdev) +add_extralibs_lib avdevice $dep_libs ;; +avutil) +add_extralibs_lib avutil $dep_libs ;; +avconv) +add_extralibs_lib avconv $dep_libs ;; +avplay) +add_extralibs_lib avplay $dep_libs ;; +avprobe) +add_extralibs_lib avprobe $dep_libs ;; +esac +unset dep_libs +fi done } @@ -741,6 +764,13 @@ add_extralibs(){ prepend extralibs $($ldflags_filter "$@") } +add_extralibs_lib(){ +lib=$1 +shift +prepend extralibs_${lib} $($ldflags_filter "$@") +unique extralibs_${lib} +} + add_host_cppflags(){ append host_cppflags "$@" } @@ -1003,10 +1033,11 @@ EOF check_lib(){ log check_lib "$@" -headers="$1" -funcs="$2" -shift 2 -check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@" +name="$1" +headers="$2" +func="$3" +shift 3 +check_func_headers "$headers" "$func" "$@" && eval ${name}_lbs="\$@" } check_pkg_config(){ @@ -1102,10 +1133,11 @@ check_compile_assert(){ require(){ log require "$@" name_version="$1" +name="${1%% *}" headers="$2" func="$3" shift 3 -check_lib "$headers" $func "$@" || die "ERROR: $name_version not found" +check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found" } require_pkg_config(){ @@ -1955,6 +1987,7 @@ comfortnoise_encoder_select="lpc" cook_decoder_select="audiodsp mdct sinewin" cscd_decoder_select="lzo" cscd_decoder_suggest="zlib" +cscd_decoder_lbs="zlib_lbs" dca_decoder_select="fmtconvert mdct" dds_decoder_select="texturedsp" dnxhd_decoder_select="blockdsp idctdsp" @@ -1962,6 +1995,7 @@ dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixbloc dvvideo_decoder_select="dvprofile idctdsp" dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp" dxa_decoder_deps="zlib" +dxa_decoder_lbs="zlib_lbs" dxv_decoder_select="lzf texturedsp" eac3_decoder_select="ac3_decoder" eac3_encoder_select="ac3_encoder" @@ -1969,6 +2003,7 @@ eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo" eatgq_decoder_select="aandcttables idctdsp" eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp" exr_decoder_deps="zlib" +exr_decoder_lbs="zlib_lbs" ffv1_decoder_select="golomb rangecoder" ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" @@ -1977,13 +2012,17 @@ fic_decoder_select="golomb" flac_decoder_select="flacdsp golomb" flac_encoder_select="bswapdsp flacdsp golomb lpc" flashsv_decoder_deps="zlib" +flashsv_decoder_lbs="zlib_lbs" flashsv_encoder_deps="zlib" +flashsv_encoder_lbs="zlib_lbs" flashsv2_decoder_deps="zlib" +flashsv2_decoder_lbs="zlib_lbs" flv_decoder_select="h263_decoder" flv_encoder_select="h263_encoder" fourxm_decoder_select="blockdsp bswapdsp" fraps_decoder_select="bswapdsp huffman" g2m_decoder_deps="zlib" +g2m_decoder_lbs="zlib_lbs" g2m_decoder_select="blockdsp idctdsp jpegtables" h261_decoder_select="mpeg_er mpegvideo" h261_encoder_select="aandcttables mpegvideoenc" @@ -1995,6 +2034,7 @@ h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel h264_decoder_suggest="error_resilience" hap_decoder_select="snappy texturedsp" hap_encoder_deps="libsnappy" +hap_encoder_lbs="libsnappy_lbs" hap_encoder_select="texturedspenc" hevc_decoder_select="bswapdsp cabac golomb videodsp" huffyuv_decoder_select="bswapdsp huffyuvdsp" @@