diff options
author | NIIBE Yutaka <[email protected]> | 2018-08-30 04:20:42 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2018-08-30 04:20:42 +0000 |
commit | 5cbc696fec8ba1e8452e8ad8518636e962caf3bc (patch) | |
tree | 87014dc9a87280863397904d5ca805cfdc007207 | |
parent | PKG_CONFIG_PATH change. (diff) | |
download | libgpg-error-5cbc696fec8ba1e8452e8ad8518636e962caf3bc.tar.gz libgpg-error-5cbc696fec8ba1e8452e8ad8518636e962caf3bc.zip |
Handle module dependency (Requires field).
-rw-r--r-- | src/gpg-error-config-main.sh | 31 | ||||
-rw-r--r-- | src/pkgconf-funcs.sh | 53 |
2 files changed, 76 insertions, 8 deletions
diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index 37eb193..d7b9c56 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -88,21 +88,36 @@ while test $# -gt 0; do shift done -if [ opt_cflags = yes ]; then - output="$output $(get_attr Cflags)" +cflags="$(get_attr Cflags)" +libs="$(get_attr Libs)" + +mtcflags="$(get_var mtcflags)" +mtlibs="$(get_var mtlibs)" + +requires="$(get_attr Requires)" +cleanup_vars_attrs +pkg_list=$(all_required_config_files $requires) + +for p in $pkg_list; do + read_config_file $p $PKG_CONFIG_PATH + cflags="$cflags $(get_attr Cflags)" + libs="$libs $(get_attr Libs)" + cleanup_vars_attrs +done + +if [ $opt_cflags = yes ]; then + output="$output $cflags" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then - output="$output $(get_var mtcflags)" + output="$output $mtcflags" fi fi -if [ opt_libs = yes ]; then - output="$output $(get_attr Libs)" +if [ $opt_libs = yes ]; then + output="$output $libs" # Backward compatibility to old gpg-error-config if [ $mt = yes ]; then - output="$output $(get_var mtlibs)" + output="$output $mtlibs" fi fi -# cleanup_vars_attrs - echo $output diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index 38dccf0..a51a8c3 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -135,4 +135,57 @@ cleanup_vars_attrs () { eval unset $ATTR_list ATTR_list } +not_listed_yet () { + local m=$1 + shift + + for arg; do + if [ $m = $arg ]; then + return 1 + fi + done + + return 0 +} + +list_only_once () { + local result="" + local arg + + for arg; do + if not_listed_yet $arg "$result"; then + result="$result $arg" + fi + done + + echo $result +} + +# +# Recursively solve package dependencies +# +# XXX: version requirement (version comparison) is not yet supported +# +all_required_config_files () { + local list="$1" + local all_list + local new_list + local p + + all_list="$list" + + while [ -n "$list" ]; do + new_list="" + for p in $list; do + read_config_file $p $PKG_CONFIG_PATH + new_list="$new_list $(get_attr Requires)" + cleanup_vars_attrs + done + all_list="$all_list $new_list" + list="$new_list" + done + + echo $(list_only_once $all_list) +} + #### end of pkgconf-funcs |