diff options
author | Tollef Fog Heen <tfheen@qurzaw> | 2009-06-30 03:47:01 +0200 |
---|---|---|
committer | Tollef Fog Heen <tfheen@qurzaw> | 2009-06-30 03:47:01 +0200 |
commit | 39663612a6d0edc07f194eb02d697256c70f27eb (patch) | |
tree | 9b6f3181b508b711f686ed5d80a9670019fef3d0 /parse.c | |
parent | 9b49307caed60772474f54eb6b2cc8af22132293 (diff) | |
download | pkg-config-39663612a6d0edc07f194eb02d697256c70f27eb.tar.gz |
2009-06-12 Tor Lillqvist <tml@iki.fi>
* parse.c: On Win32, if the value of a a variable other than the
"prefix" one starts with the non-overridden value of "prefix",
then replace that prefix, too, with the run-time one.
To avoid shadowing warnings, rename a 'p' variable to 'q'.
* pkg-config.1: Corresponding update.
* main.c
* pkg.h: Move the Win32 redefinition of PKG_CONFIG_PC_PATH from
main.c to pkg.h as it now is needed in pkg.c, too.
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -901,6 +901,8 @@ parse_url (Package *pkg, const char *str, const char *path) } #ifdef G_OS_WIN32 +static char *orig_prefix = NULL; + static int pathnamecmp (const char *a, const char *b) @@ -1031,8 +1033,10 @@ parse_line (Package *pkg, const char *untrimmed, const char *path, { /* It ends in lib\pkgconfig or share\pkgconfig. Good. */ - gchar *p; + gchar *q; + orig_prefix = g_strdup (p); + prefix = g_strdup (prefix); if (strlen (prefix) > lib_pkgconfig_len && pathnamecmp (prefix + prefix_len - lib_pkgconfig_len, lib_pkgconfig) == 0) @@ -1044,12 +1048,12 @@ parse_line (Package *pkg, const char *untrimmed, const char *path, * poptParseArgvString() will eat them when ${prefix} * has been expanded in parse_libs(). */ - p = prefix; - while (*p) + q = prefix; + while (*q) { - if (*p == '\\') - *p = '/'; - p++; + if (*q == '\\') + *q = '/'; + q++; } varname = g_strdup (tag); debug_spew (" Variable declaration, '%s' overridden with '%s'\n", @@ -1058,6 +1062,16 @@ parse_line (Package *pkg, const char *untrimmed, const char *path, goto cleanup; } } + else if (!dont_define_prefix && + orig_prefix != NULL && + strncmp (p, orig_prefix, strlen (orig_prefix)) == 0 && + G_IS_DIR_SEPARATOR (p[strlen (orig_prefix)])) + { + char *oldstr = str; + + p = str = g_strconcat (g_hash_table_lookup (pkg->vars, prefix_variable), p + strlen (orig_prefix), NULL); + g_free (oldstr); + } #endif if (g_hash_table_lookup (pkg->vars, tag)) |