diff options
author | NIIBE Yutaka <[email protected]> | 2018-08-30 06:27:54 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2018-08-30 06:27:54 +0000 |
commit | 53d2eb399601bdea6cdfe3a5e90203585ddf9e4a (patch) | |
tree | ed740a08ee4ea68b5c9ce680a43a865e930c3509 | |
parent | Support invocation with module names. (diff) | |
download | libgpg-error-53d2eb399601bdea6cdfe3a5e90203585ddf9e4a.tar.gz libgpg-error-53d2eb399601bdea6cdfe3a5e90203585ddf9e4a.zip |
Fixes src/gpg-error-config-main.sh and src/pkgconf-funcs.sh.
-rw-r--r-- | src/gpg-error-config-main.sh | 70 | ||||
-rw-r--r-- | src/pkgconf-funcs.sh | 12 |
2 files changed, 48 insertions, 34 deletions
diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index 0a0dd0f..1ead597 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -37,27 +37,28 @@ output_attr="" opt_cflags=no opt_libs=no output="" +delimiter=" " while test $# -gt 0; do case $1 in --prefix) # In future, use --variable=prefix instead. output_var=prefix - break ;; --exec-prefix) # In future, use --variable=exec_prefix instead. output_var=exec_prefix - break ;; --version) # In future, use --modversion instead. output_attr=Version - break + delimiter=" +" ;; --modversion) output_attr=Version - break + delimiter=" +" ;; --cflags) opt_cflags=yes @@ -67,12 +68,10 @@ while test $# -gt 0; do ;; --variable=*) output_var=${1#*=} - break ;; --host) # In future, use --variable=host instead. output_var=host - break ;; --help) usage 0 @@ -84,22 +83,27 @@ while test $# -gt 0; do shift done -if [ -z "$modules" ]; then - modules=${myname%-config} -fi - -if [ myname = "gpg-error-config" -a -z "$modules" ]; then +if [ $myname = "gpg-error-config" -a -z "$modules" ]; then read_config_file ${myname%-config} $PKG_CONFIG_PATH - cflags="$(get_attr Cflags)" - libs="$(get_attr Libs)" + if [ -n "$output_var" ]; then + output="$output${output:+ }$(get_var $output_var)" + elif [ -n "$output_attr" ]; then + output="$output${output:+ }$(get_attr $output_attr)" + else + cflags="$(get_attr Cflags)" + libs="$(get_attr Libs)" - mtcflags="$(get_var mtcflags)" - mtlibs="$(get_var mtlibs)" + mtcflags="$(get_var mtcflags)" + mtlibs="$(get_var mtlibs)" + fi requires="$(get_attr Requires)" cleanup_vars_attrs pkg_list=$(all_required_config_files $requires) else + if [ -z "$modules" ]; then + modules=${myname%-config} + fi cflags="" libs="" pkg_list=$(all_required_config_files $modules) @@ -107,24 +111,32 @@ fi for p in $pkg_list; do read_config_file $p $PKG_CONFIG_PATH - cflags="$cflags $(get_attr Cflags)" - libs="$libs $(get_attr Libs)" + if [ -n "$output_var" ]; then + output="$output${output:+$delimiter}$(get_var $output_var)" + elif [ -n "$output_attr" ]; then + output="$output${output:+$delimiter}$(get_attr $output_attr)" + else + cflags="$cflags${cflags:+ }$(get_attr Cflags)" + libs="$libs${libs:+ }$(get_attr Libs)" + fi cleanup_vars_attrs done -if [ $opt_cflags = yes ]; then - output="$output $(list_only_once $cflags)" - # Backward compatibility to old gpg-error-config - if [ $mt = yes ]; then - output="$output $mtcflags" +if [ -z "$output_var" -a -z "$output_attr" ]; then + if [ $opt_cflags = yes ]; then + output="$output $(list_only_once $cflags)" + # Backward compatibility to old gpg-error-config + if [ $mt = yes ]; then + output="$output $mtcflags" + fi fi -fi -if [ $opt_libs = yes ]; then - output="$output $(list_only_once_for_libs $libs)" - # Backward compatibility to old gpg-error-config - if [ $mt = yes ]; then - output="$output $mtlibs" + if [ $opt_libs = yes ]; then + output="$output $(list_only_once_for_libs $libs)" + # Backward compatibility to old gpg-error-config + if [ $mt = yes ]; then + output="$output $mtlibs" + fi fi fi -echo $output +echo "$output" diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index 04dabc1..7073f81 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -137,6 +137,7 @@ cleanup_vars_attrs () { not_listed_yet () { local m=$1 + local arg shift for arg; do @@ -153,7 +154,7 @@ list_only_once () { local arg for arg; do - if not_listed_yet $arg "$result"; then + if not_listed_yet $arg $result; then result="$result $arg" fi done @@ -163,7 +164,7 @@ list_only_once () { list_only_once_for_libs () { local result="" - loca rev_list="" + local rev_list="" local arg # Scan the list and eliminate duplicates for non-"-lxxx" @@ -175,7 +176,7 @@ list_only_once_for_libs () { rev_list="$arg $rev_list" ;; *) - if not_listed_yet $arg "$rev_list"; then + if not_listed_yet $arg $rev_list; then rev_list="$arg $rev_list" fi ;; @@ -186,7 +187,7 @@ list_only_once_for_libs () { for arg in $rev_list; do case "$arg" in -l*) - if not_listed_yet $arg "$result"; then + if not_listed_yet $arg $result; then result="$arg $result" fi ;; @@ -206,11 +207,12 @@ list_only_once_for_libs () { # XXX: version requirement (version comparison) is not yet supported # all_required_config_files () { - local list="$1" + local list local all_list local new_list local p + list="$@" all_list="$list" while [ -n "$list" ]; do |