From dce0339076516b4cda3427ce0398472f89b6347a Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sun, 23 Mar 2008 20:00:00 +0100 Subject: 2008-02-19 Tor Lillqvist * main.c: Remove the possibility to have a default PKG_CONFIG_PATH in the Registry. It is much more flexible to just use environment variables. In general the Registry is not used in the ports of GTK+ or GNOME libraries and software to Windows. * parse.c (parse_line): On Windows, handle also .pc files found in a share/pkgconfig folder when automatically redefining a prefix variable for the package. * pkg-config.1: Corresponding changes. 2008-02-18 Tor Lillqvist * main.c: Fix some bitrot: On Windows, don't use the compile-time PKG_CONFIG_PC_PATH, but deduce a default one at run-time based on the location of the executable. This was originally what pkg-config did on Windows, but it had bit-rotted. --- parse.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 9d996d4..ca0de2a 100644 --- a/parse.c +++ b/parse.c @@ -1011,18 +1011,25 @@ parse_line (Package *pkg, const char *untrimmed, const char *path, gboolean igno gchar *prefix = pkg->pcfiledir; const int prefix_len = strlen (prefix); const char *const lib_pkgconfig = "\\lib\\pkgconfig"; + const char *const share_pkgconfig = "\\share\\pkgconfig"; const int lib_pkgconfig_len = strlen (lib_pkgconfig); + const int share_pkgconfig_len = strlen (share_pkgconfig); - if (strlen (prefix) > lib_pkgconfig_len && - pathnamecmp (prefix + prefix_len - lib_pkgconfig_len, - lib_pkgconfig) == 0) + if ((strlen (prefix) > lib_pkgconfig_len && + pathnamecmp (prefix + prefix_len - lib_pkgconfig_len, lib_pkgconfig) == 0) || + (strlen (prefix) > share_pkgconfig_len && + pathnamecmp (prefix + prefix_len - share_pkgconfig_len, share_pkgconfig) == 0)) { - /* It ends in lib\pkgconfig. Good. */ + /* It ends in lib\pkgconfig or share\pkgconfig. Good. */ gchar *p; prefix = g_strdup (prefix); - prefix[prefix_len - lib_pkgconfig_len] = '\0'; + if (strlen (prefix) > lib_pkgconfig_len && + pathnamecmp (prefix + prefix_len - lib_pkgconfig_len, lib_pkgconfig) == 0) + prefix[prefix_len - lib_pkgconfig_len] = '\0'; + else + prefix[prefix_len - share_pkgconfig_len] = '\0'; /* Turn backslashes into slashes or * poptParseArgvString() will eat them when ${prefix} -- cgit v1.2.1