diff options
author | NIIBE Yutaka <[email protected]> | 2018-08-30 02:16:41 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2018-08-30 02:16:41 +0000 |
commit | ed6f96f26c2b018b73cc3d440d07d1cc50007e10 (patch) | |
tree | d3583e103c738e04a70778716dd39641e27e2189 | |
parent | Add note for the compatibility. (diff) | |
download | libgpg-error-ed6f96f26c2b018b73cc3d440d07d1cc50007e10.tar.gz libgpg-error-ed6f96f26c2b018b73cc3d440d07d1cc50007e10.zip |
New func read_config_from_stdin and cleanup_vars_attrs.
-rw-r--r-- | src/gpg-error-config-main.sh | 16 | ||||
-rw-r--r-- | src/pkgconf-funcs.sh | 23 |
2 files changed, 23 insertions, 16 deletions
diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh index 637db7d..37eb193 100644 --- a/src/gpg-error-config-main.sh +++ b/src/gpg-error-config-main.sh @@ -5,13 +5,6 @@ else myname="gpgrt-config" fi -if find_file_in_path ${myname%-config}.pc $PKG_CONFIG_PATH; then - CONFIG_FILE=$RESULT -else - echo "Can't find ${myname%-config}.pc" 1>&2 - exit 1 -fi - usage() { cat <<EOF @@ -39,7 +32,7 @@ else shift fi -read_config_file < "$CONFIG_FILE" +read_config_file ${myname%-config} $PKG_CONFIG_PATH opt_cflags=no opt_libs=no @@ -110,11 +103,6 @@ if [ opt_libs = yes ]; then fi fi -# -# Clean up -# -# eval unset $VAR_list VAR_list -# eval unset $ATTR_list ATTR_list -# +# cleanup_vars_attrs echo $output diff --git a/src/pkgconf-funcs.sh b/src/pkgconf-funcs.sh index fd144c8..38dccf0 100644 --- a/src/pkgconf-funcs.sh +++ b/src/pkgconf-funcs.sh @@ -65,7 +65,7 @@ substitute_vars () { } # -# Read a config file +# Read a config from stdin # # Variables: # For VAR=VALUE, value is stored in the shell variable VAR_*. @@ -73,7 +73,7 @@ substitute_vars () { # Attributes: # For KEY: VALUE, value is stored in the shell variable ATTR_*. # -read_config_file () { +read_config_from_stdin () { local line local varname local value @@ -116,4 +116,23 @@ find_file_in_path () { RESULT="" return 1 } + +read_config_file () { + local config_file + local RESULT + + if find_file_in_path $1.pc $2; then + config_file=$RESULT + else + echo "Can't find $1.pc" 1>&2 + exit 1 + fi + read_config_from_stdin < $config_file +} + +cleanup_vars_attrs () { + eval unset $VAR_list VAR_list + eval unset $ATTR_list ATTR_list +} + #### end of pkgconf-funcs |