From e7323695df2b28ee745fafd0e75d8a5daf1dc1cf Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Thu, 14 Jul 2005 13:04:19 +0000 Subject: 2001-07-11 Havoc Pennington Author: hp Date: 2001-07-10 22:51:39 GMT 2001-07-11 Havoc Pennington * parse.c (parse_cflags): fix failure to put space between cflags, reported by Chema (parse_line): allow spelling Cflags as CFlags, pointed out by Tim (get_compat_package): support legacy script gnome-vfs-config for package name "libgnomevfs" --- ChangeLog | 8 ++++++++ configure.in | 2 +- main.c | 15 ++++++++++++++- parse.c | 37 +++++++++++++++++++++++++++++++++++-- pkg.c | 12 ++++++------ pkg.h | 2 ++ 6 files changed, 66 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 284a3c6..8174d7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-07-11 Havoc Pennington + + * parse.c (parse_cflags): fix failure to put space between cflags, + reported by Chema + (parse_line): allow spelling Cflags as CFlags, pointed out by Tim + (get_compat_package): support legacy script gnome-vfs-config for + package name "libgnomevfs" + 2001-06-18 Havoc Pennington * pkg.m4: print the error, not the name of the variable containing diff --git a/configure.in b/configure.in index de029bf..e7b93e6 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_INIT(pkg-config.1) AC_CONFIG_SUBDIRS(glib-1.2.8) -AM_INIT_AUTOMAKE(pkgconfig, 0.7.0) +AM_INIT_AUTOMAKE(pkgconfig, 0.8.0) AM_MAINTAINER_MODE diff --git a/main.c b/main.c index ba872fd..9ff1b42 100644 --- a/main.c +++ b/main.c @@ -71,6 +71,8 @@ popt_callback (poptContext con, const struct poptOption * opt, const char * arg, void * data) { + debug_spew ("Option --%s seen\n", opt->longName); + if (opt->val == DEFINE_VARIABLE) { char *varname; @@ -214,6 +216,7 @@ main (int argc, char **argv) want_debug_spew = TRUE; want_verbose_errors = TRUE; want_silence_errors = FALSE; + debug_spew ("PKG_CONFIG_DEBUG_SPEW variable enabling debug spew\n"); } search_path = getenv ("PKG_CONFIG_PATH"); @@ -284,6 +287,8 @@ main (int argc, char **argv) want_I_cflags || want_list) { + debug_spew ("Error printing enabled by default due to use of --version, --libs, --cflags, --libs-only-l, --libs-only-L, --cflags-only-I, or --list. Value of --silence-errors: %d\n", want_silence_errors); + if (want_silence_errors && getenv ("PKG_CONFIG_DEBUG_SPEW") == NULL) want_verbose_errors = FALSE; else @@ -291,8 +296,16 @@ main (int argc, char **argv) } else { + debug_spew ("Error printing disabled by default, value of --print-errors: %d\n", + want_verbose_errors); + /* Leave want_verbose_errors unchanged, reflecting --print-errors */ - } + } + + if (want_verbose_errors) + debug_spew ("Error printing enabled\n"); + else + debug_spew ("Error printing disabled\n"); if (want_my_version) { diff --git a/parse.c b/parse.c index 87afbd4..c769359 100644 --- a/parse.c +++ b/parse.c @@ -742,6 +742,8 @@ parse_cflags (Package *pkg, const char *str, const char *path) } else { + if (other->len > 0) + g_string_append (other, " "); g_string_append (other, arg); } @@ -805,7 +807,8 @@ parse_line (Package *pkg, const char *untrimmed, const char *path) parse_requires (pkg, p, path); else if (strcmp (tag, "Libs") == 0) parse_libs (pkg, p, path); - else if (strcmp (tag, "Cflags") == 0) + else if (strcmp (tag, "Cflags") == 0 || + strcmp (tag, "CFlags") == 0) parse_cflags (pkg, p, path); else if (strcmp (tag, "Conflicts") == 0) parse_conflicts (pkg, p, path); @@ -949,7 +952,10 @@ get_compat_package (const char *name) { Package *pkg; - debug_spew ("Looking for '%s' using old-style -config scripts\n", name); + if (name_ends_in_uninstalled (name)) + debug_spew ("Suspiciously looking for compat package for -uninstalled: %s\n", name); + + debug_spew ("Looking for '%s' using legacy -config scripts\n", name); pkg = g_new0 (Package, 1); @@ -1005,6 +1011,33 @@ get_compat_package (const char *name) parse_cflags (pkg, output, "gtk-config"); g_free (output); + return pkg; + } + else if (strcmp (name, "libgnomevfs") == 0) + { + char *output; + + debug_spew ("Calling gnome-vfs-config\n"); + + pkg->version = backticks ("gnome-vfs-config --version"); + if (pkg->version == NULL) + { + g_free (pkg); + return NULL; + } + + pkg->name = g_strdup ("GNOME VFS"); + pkg->key = g_strdup ("libgnomevfs"); + pkg->description = g_strdup ("GNOME Virtual File System"); + + output = backticks ("gnome-vfs-config --libs"); + parse_libs (pkg, output, "gnome-vfs-config"); + g_free (output); + + output = backticks ("gnome-vfs-config --cflags"); + parse_cflags (pkg, output, "gnome-vfs-config"); + g_free (output); + return pkg; } else if (strcmp (name, "imlib") == 0) diff --git a/pkg.c b/pkg.c index 7226f75..57c692c 100644 --- a/pkg.c +++ b/pkg.c @@ -52,10 +52,10 @@ ends_in_dotpc (const char *str) } /* strlen ("uninstalled") */ -#define UNINSTALLED_LEN 11 +#define UNINSTALLED_LEN 11 -static gboolean -ends_in_uninstalled (const char *str) +gboolean +name_ends_in_uninstalled (const char *str) { int len = strlen (str); @@ -183,7 +183,7 @@ internal_get_package (const char *name, gboolean warn, gboolean check_compat) { /* See if we should auto-prefer the uninstalled version */ if (!disable_uninstalled && - !ends_in_uninstalled (name)) + !name_ends_in_uninstalled (name)) { char *un; @@ -201,7 +201,6 @@ internal_get_package (const char *name, gboolean warn, gboolean check_compat) } location = g_hash_table_lookup (locations, name); - debug_spew ("Reading '%s' from file '%s'\n", name, location); } if (location == NULL && check_compat) @@ -227,7 +226,8 @@ internal_get_package (const char *name, gboolean warn, gboolean check_compat) return NULL; } - + + debug_spew ("Reading '%s' from file '%s'\n", name, location); pkg = parse_package_file (location); if (pkg == NULL) diff --git a/pkg.h b/pkg.h index 59e711b..7cc7aaa 100644 --- a/pkg.h +++ b/pkg.h @@ -84,6 +84,8 @@ void define_global_variable (const char *varname, void debug_spew (const char *format, ...); void verbose_error (const char *format, ...); +gboolean name_ends_in_uninstalled (const char *str); + /* If TRUE, do not automatically prefer uninstalled versions */ extern gboolean disable_uninstalled; -- cgit v1.2.1