mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-02-04 04:50:32 +01:00
2002-02-01 Havoc Pennington <hp@redhat.com>
Author: hp
Date: 2002-02-01 22:24:24 GMT
2002-02-01 Havoc Pennington <hp@redhat.com>
Throughout: cast chars to guchar before passing to isspace, etc.,
noted by Morten Welinder
* pkg.c (verify_package): actually strip system -I/-L out of the
cflags/libs, unless you set an environment variable asking to
leave them in.
This commit is contained in:
parent
0f8e43f49a
commit
d192f98006
5 changed files with 91 additions and 34 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2002-02-01 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
Throughout: cast chars to guchar before passing to isspace, etc.,
|
||||
noted by Morten Welinder
|
||||
|
||||
* pkg.c (verify_package): actually strip system -I/-L out of the
|
||||
cflags/libs, unless you set an environment variable asking to
|
||||
leave them in.
|
||||
|
||||
2002-02-01 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* pkg.m4: fix shell portability issue, reported by Morten Welinder
|
||||
|
|
|
|||
2
main.c
2
main.c
|
|
@ -88,7 +88,7 @@ popt_callback (poptContext con,
|
|||
tmp = g_strdup (arg);
|
||||
|
||||
varname = tmp;
|
||||
while (*varname && isspace (*varname))
|
||||
while (*varname && isspace ((guchar)*varname))
|
||||
++varname;
|
||||
|
||||
varval = varname;
|
||||
|
|
|
|||
50
parse.c
50
parse.c
|
|
@ -124,11 +124,11 @@ trim_string (const char *str)
|
|||
|
||||
g_return_val_if_fail (str != NULL, NULL);
|
||||
|
||||
while (*str && isspace (*str))
|
||||
while (*str && isspace ((guchar)*str))
|
||||
str++;
|
||||
|
||||
len = strlen (str);
|
||||
while (len > 0 && isspace (str[len-1]))
|
||||
while (len > 0 && isspace ((guchar)str[len-1]))
|
||||
len--;
|
||||
|
||||
return g_strndup (str, len);
|
||||
|
|
@ -242,7 +242,7 @@ parse_description (Package *pkg, const char *str, const char *path)
|
|||
}
|
||||
|
||||
|
||||
#define MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c)))
|
||||
#define MODULE_SEPARATOR(c) ((c) == ',' || isspace ((guchar)(c)))
|
||||
#define OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
||||
|
||||
/* A module list is a list of modules with optional version specification,
|
||||
|
|
@ -292,11 +292,11 @@ split_module_list (const char *str, const char *path)
|
|||
break;
|
||||
|
||||
case IN_MODULE_NAME:
|
||||
if (isspace (*p))
|
||||
if (isspace ((guchar)*p))
|
||||
{
|
||||
/* Need to look ahead to determine next state */
|
||||
const char *s = p;
|
||||
while (*s && isspace (*s))
|
||||
while (*s && isspace ((guchar)*s))
|
||||
++s;
|
||||
|
||||
if (*s == '\0')
|
||||
|
|
@ -316,7 +316,7 @@ split_module_list (const char *str, const char *path)
|
|||
/* We know an operator is coming up here due to lookahead from
|
||||
* IN_MODULE_NAME
|
||||
*/
|
||||
if (isspace (*p))
|
||||
if (isspace ((guchar)*p))
|
||||
; /* no change */
|
||||
else if (OPERATOR_CHAR (*p))
|
||||
state = IN_OPERATOR;
|
||||
|
|
@ -330,7 +330,7 @@ split_module_list (const char *str, const char *path)
|
|||
break;
|
||||
|
||||
case AFTER_OPERATOR:
|
||||
if (!isspace (*p))
|
||||
if (!isspace ((guchar)*p))
|
||||
state = IN_MODULE_VERSION;
|
||||
break;
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ parse_module_list (Package *pkg, const char *str, const char *path)
|
|||
|
||||
start = p;
|
||||
|
||||
while (*p && !isspace (*p))
|
||||
while (*p && !isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
while (*p && MODULE_SEPARATOR (*p))
|
||||
|
|
@ -427,10 +427,10 @@ parse_module_list (Package *pkg, const char *str, const char *path)
|
|||
|
||||
start = p;
|
||||
|
||||
while (*p && !isspace (*p))
|
||||
while (*p && !isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
{
|
||||
*p = '\0';
|
||||
++p;
|
||||
|
|
@ -620,11 +620,11 @@ parse_libs (Package *pkg, const char *str, const char *path)
|
|||
char *libname;
|
||||
|
||||
p += 2;
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
start = p;
|
||||
while (*p && !isspace (*p))
|
||||
while (*p && !isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
libname = g_strndup (start, p - start);
|
||||
|
|
@ -640,11 +640,11 @@ parse_libs (Package *pkg, const char *str, const char *path)
|
|||
char *libname;
|
||||
|
||||
p += 2;
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
start = p;
|
||||
while (*p && !isspace (*p))
|
||||
while (*p && !isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
libname = g_strndup (start, p - start);
|
||||
|
|
@ -726,11 +726,11 @@ parse_cflags (Package *pkg, const char *str, const char *path)
|
|||
char *libname;
|
||||
|
||||
p += 2;
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
start = p;
|
||||
while (*p && !isspace (*p))
|
||||
while (*p && !isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
libname = g_strndup (start, p - start);
|
||||
|
|
@ -787,14 +787,14 @@ parse_line (Package *pkg, const char *untrimmed, const char *path)
|
|||
|
||||
tag = g_strndup (str, p - str);
|
||||
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
if (*p == ':')
|
||||
{
|
||||
/* keyword */
|
||||
++p;
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
if (strcmp (tag, "Name") == 0)
|
||||
|
|
@ -827,7 +827,7 @@ parse_line (Package *pkg, const char *untrimmed, const char *path)
|
|||
char *varval;
|
||||
|
||||
++p;
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
if (pkg->vars == NULL)
|
||||
|
|
@ -1139,7 +1139,7 @@ get_compat_package (const char *name)
|
|||
|
||||
p = output;
|
||||
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
if (*p == '\0')
|
||||
|
|
@ -1151,7 +1151,7 @@ get_compat_package (const char *name)
|
|||
}
|
||||
|
||||
/* only heuristic; find a number or . */
|
||||
while (*p && ! (isdigit (*p) || *p == '.'))
|
||||
while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
|
||||
++p;
|
||||
|
||||
pkg->version = g_strdup (p);
|
||||
|
|
@ -1189,7 +1189,7 @@ get_compat_package (const char *name)
|
|||
|
||||
p = output;
|
||||
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
if (*p == '\0')
|
||||
|
|
@ -1201,7 +1201,7 @@ get_compat_package (const char *name)
|
|||
}
|
||||
|
||||
/* only heuristic; find a number or . */
|
||||
while (*p && ! (isdigit (*p) || *p == '.'))
|
||||
while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
|
||||
++p;
|
||||
|
||||
pkg->version = g_strdup (p);
|
||||
|
|
@ -1274,7 +1274,7 @@ get_compat_package (const char *name)
|
|||
*/
|
||||
p = output;
|
||||
|
||||
while (*p && isspace (*p))
|
||||
while (*p && isspace ((guchar)*p))
|
||||
++p;
|
||||
|
||||
if (*p == '\0')
|
||||
|
|
@ -1286,7 +1286,7 @@ get_compat_package (const char *name)
|
|||
}
|
||||
|
||||
/* only heuristic; find a number or . */
|
||||
while (*p && ! (isdigit (*p) || *p == '.'))
|
||||
while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
|
||||
++p;
|
||||
|
||||
pkg->version = g_strdup (p);
|
||||
|
|
|
|||
|
|
@ -222,6 +222,14 @@ Normally if you request the package "foo" and the package
|
|||
uninstalled packages. If this environment variable is set, it
|
||||
disables said behavior.
|
||||
|
||||
.TP
|
||||
.I "PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"
|
||||
Don't strip -I/usr/include out of cflags.
|
||||
|
||||
.TP
|
||||
.I "PKG_CONFIG_ALLOW_SYSTEM_LIBS"
|
||||
Don't strip -L/usr/lib out of libs
|
||||
|
||||
.SH WINDOWS SPECIALITIES
|
||||
If a .pc file is found in a directory that matches the usual
|
||||
conventions (i.e., ends with \\lib\\pkgconfig), the prefix for that
|
||||
|
|
|
|||
56
pkg.c
56
pkg.c
|
|
@ -557,7 +557,8 @@ verify_package (Package *pkg)
|
|||
GSList *iter;
|
||||
GSList *requires_iter;
|
||||
GSList *conflicts_iter;
|
||||
|
||||
int count;
|
||||
|
||||
/* Be sure we have the required fields */
|
||||
|
||||
if (pkg->key == NULL)
|
||||
|
|
@ -662,6 +663,7 @@ verify_package (Package *pkg)
|
|||
g_slist_free (requires);
|
||||
g_slist_free (conflicts);
|
||||
|
||||
count = 0;
|
||||
iter = pkg->I_cflags;
|
||||
while (iter != NULL)
|
||||
{
|
||||
|
|
@ -673,10 +675,48 @@ verify_package (Package *pkg)
|
|||
{
|
||||
verbose_error ("Package %s has -I/usr/include in Cflags; this may cause problems and is not recommended\n",
|
||||
pkg->name);
|
||||
if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") == NULL)
|
||||
{
|
||||
iter->data = NULL;
|
||||
++count;
|
||||
debug_spew ("Removing -I/usr/include from cflags for %s\n", pkg->key);
|
||||
}
|
||||
}
|
||||
|
||||
iter = iter->next;
|
||||
}
|
||||
|
||||
while (count)
|
||||
{
|
||||
pkg->I_cflags = g_slist_remove (pkg->I_cflags, NULL);
|
||||
--count;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
iter = pkg->L_libs;
|
||||
while (iter != NULL)
|
||||
{
|
||||
if (strcmp (iter->data, "-L/usr/lib") == 0 ||
|
||||
strcmp (iter->data, "-L /usr/lib") == 0)
|
||||
{
|
||||
verbose_error ("Package %s has -L/usr/lib in Libs; this may cause problems and is not recommended\n",
|
||||
pkg->name);
|
||||
if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_LIBS") == NULL)
|
||||
{
|
||||
iter->data = NULL;
|
||||
++count;
|
||||
debug_spew ("Removing -I/usr/lib from libs for %s\n", pkg->key);
|
||||
}
|
||||
}
|
||||
|
||||
iter = iter->next;
|
||||
}
|
||||
|
||||
while (count)
|
||||
{
|
||||
pkg->L_libs = g_slist_remove (pkg->L_libs, NULL);
|
||||
--count;
|
||||
}
|
||||
}
|
||||
|
||||
static char*
|
||||
|
|
@ -1054,8 +1094,8 @@ static int rpmvercmp(const char * a, const char * b) {
|
|||
|
||||
/* loop through each version segment of str1 and str2 and compare them */
|
||||
while (*one && *two) {
|
||||
while (*one && !isalnum(*one)) one++;
|
||||
while (*two && !isalnum(*two)) two++;
|
||||
while (*one && !isalnum((guchar)*one)) one++;
|
||||
while (*two && !isalnum((guchar)*two)) two++;
|
||||
|
||||
str1 = one;
|
||||
str2 = two;
|
||||
|
|
@ -1063,13 +1103,13 @@ static int rpmvercmp(const char * a, const char * b) {
|
|||
/* grab first completely alpha or completely numeric segment */
|
||||
/* leave one and two pointing to the start of the alpha or numeric */
|
||||
/* segment and walk str1 and str2 to end of segment */
|
||||
if (isdigit(*str1)) {
|
||||
while (*str1 && isdigit(*str1)) str1++;
|
||||
while (*str2 && isdigit(*str2)) str2++;
|
||||
if (isdigit((guchar)*str1)) {
|
||||
while (*str1 && isdigit((guchar)*str1)) str1++;
|
||||
while (*str2 && isdigit((guchar)*str2)) str2++;
|
||||
isnum = 1;
|
||||
} else {
|
||||
while (*str1 && isalpha(*str1)) str1++;
|
||||
while (*str2 && isalpha(*str2)) str2++;
|
||||
while (*str1 && isalpha((guchar)*str1)) str1++;
|
||||
while (*str2 && isalpha((guchar)*str2)) str2++;
|
||||
isnum = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue