=== modified file 'ChangeLog' --- ChangeLog 2007-12-18 23:03:00 +0000 +++ ChangeLog 2007-12-18 23:40:46 +0000 @@ -1,5 +1,31 @@ 2007-12-18 Dan Nicholson + * pkg.c: New global ignore_requires_private to allow the + Requires.private to be ignored. + (enable_requires, disable_requires): Helper functions for the + ignore_requires variable. + (enable_requires_private, disable_requires_private): Helper + functions for the ignore_requires_private variable. + + * pkg.h: Prototypes for the requires helper functions. + + * parse.c (parse_line): New ignore_requires_private boolean + parameter. Control parsing of Requires with ignore_requires + parameter and Requires.private with ignore_requires_private + parameter. + (parse_package_file): New ignore_requires_private boolean + to be passed to parse_line(). + + * parse.h: Adjust prototype of parse_package_file(). + + * main.c: Only enable Requires field when cflags or libs are + requested. Only enable Requires.private field when cflags or + static libs are requested. This allow `pkg-config --exists' to + return successfully when a Required .pc file is missing. Fixes + Freedesktop #4738. + +2007-12-18 Dan Nicholson + * check/check-requires-private: The Requires.private test had incorrect results for Cflags, causing failures in `make check'. pkg-config always pulls in the Cflags from Requires.private === modified file 'main.c' --- main.c 2006-08-16 17:57:14 +0000 +++ main.c 2007-12-18 23:40:46 +0000 @@ -420,6 +420,27 @@ else disable_private_libs(); + /* Only process Requires field if cflags or libs wanted */ + if (want_libs || + want_cflags || + want_l_libs || + want_L_libs || + want_other_libs || + want_I_cflags || + want_other_cflags) + enable_requires(); + else + disable_requires(); + + /* Only process Requires.private if cflags or static libs wanted */ + if (want_cflags || + want_I_cflags || + want_other_cflags || + want_static_lib_list) + enable_requires_private(); + else + disable_requires_private(); + if (want_my_version) { printf ("%s\n", VERSION); === modified file 'parse.c' --- parse.c 2007-05-30 11:24:42 +0000 +++ parse.c 2007-12-18 23:40:46 +0000 @@ -913,7 +913,9 @@ #endif static void -parse_line (Package *pkg, const char *untrimmed, const char *path, gboolean ignore_requires, gboolean ignore_private_libs) +parse_line (Package *pkg, const char *untrimmed, const char *path, + gboolean ignore_requires, gboolean ignore_requires_private, + gboolean ignore_private_libs) { char *str; char *p; @@ -956,15 +958,12 @@ parse_description (pkg, p, path); else if (strcmp (tag, "Version") == 0) parse_version (pkg, p, path); - else if (strcmp (tag, "Requires.private") == 0) - parse_requires_private (pkg, p, path); - else if (strcmp (tag, "Requires") == 0) - { - if (ignore_requires == FALSE) - parse_requires (pkg, p, path); - else - goto cleanup; - } + else if ((strcmp (tag, "Requires.private") == 0) && + ignore_requires_private == FALSE) + parse_requires_private (pkg, p, path); + else if ((strcmp (tag, "Requires") == 0) && + ignore_requires == FALSE) + parse_requires (pkg, p, path); else if ((strcmp (tag, "Libs.private") == 0) && ignore_private_libs == FALSE) parse_libs_private (pkg, p, path); @@ -1067,7 +1066,9 @@ } Package* -parse_package_file (const char *path, gboolean ignore_requires, gboolean ignore_private_libs) +parse_package_file (const char *path, gboolean ignore_requires, + gboolean ignore_requires_private, + gboolean ignore_private_libs) { FILE *f; Package *pkg; @@ -1104,7 +1105,8 @@ { one_line = TRUE; - parse_line (pkg, str->str, path, ignore_requires, ignore_private_libs); + parse_line (pkg, str->str, path, ignore_requires, + ignore_requires_private, ignore_private_libs); g_string_truncate (str, 0); } === modified file 'parse.h' --- parse.h 2005-07-14 13:07:18 +0000 +++ parse.h 2007-12-18 23:40:46 +0000 @@ -23,6 +23,7 @@ #include "pkg.h" Package *parse_package_file (const char *path, gboolean ignore_requires, + gboolean ignore_requires_private, gboolean ignore_private_libs); Package *get_compat_package (const char *name); === modified file 'pkg.c' --- pkg.c 2007-06-18 21:19:27 +0000 +++ pkg.c 2007-12-18 23:40:46 +0000 @@ -55,6 +55,7 @@ gboolean disable_uninstalled = FALSE; gboolean ignore_requires = FALSE; +gboolean ignore_requires_private = FALSE; gboolean ignore_private_libs = TRUE; static Package pkg_config_package = { @@ -349,7 +350,8 @@ } debug_spew ("Reading '%s' from file '%s'\n", name, location); - pkg = parse_package_file (location, ignore_requires, ignore_private_libs); + pkg = parse_package_file (location, ignore_requires, ignore_requires_private, + ignore_private_libs); if (pkg == NULL) { @@ -1503,6 +1505,7 @@ int mlen = 0; ignore_requires = TRUE; + ignore_requires_private = TRUE; g_hash_table_foreach (locations, max_len_foreach, &mlen); g_hash_table_foreach (locations, packages_foreach, GINT_TO_POINTER (mlen + 1)); @@ -1519,3 +1522,27 @@ { ignore_private_libs = TRUE; } + +void +enable_requires(void) +{ + ignore_requires = FALSE; +} + +void +disable_requires(void) +{ + ignore_requires = TRUE; +} + +void +enable_requires_private(void) +{ + ignore_requires_private = FALSE; +} + +void +disable_requires_private(void) +{ + ignore_requires_private = TRUE; +} === modified file 'pkg.h' --- pkg.h 2005-10-16 17:31:41 +0000 +++ pkg.h 2007-12-18 23:40:46 +0000 @@ -120,6 +120,12 @@ void enable_private_libs(void); void disable_private_libs(void); +void enable_requires(void); +void disable_requires(void); + +void enable_requires_private(void); +void disable_requires_private(void); + /* If TRUE, do not automatically prefer uninstalled versions */ extern gboolean disable_uninstalled;