2002-09-06 Havoc Pennington <hp@redhat.com>

Author: hp
Date: 2002-09-06 20:00:08 GMT
2002-09-06  Havoc Pennington  <hp@redhat.com>

	* parse.c, pkg.c: handle other_libs other_cflags same
	as -l/-L/-I flags, so we pull in from dependent packages.
	Closes #85244, #90706, #89851
This commit is contained in:
Arch Librarian 2005-07-14 13:05:17 +00:00
parent e3b14fd5e8
commit fcb804effe
5 changed files with 42 additions and 73 deletions

View file

@ -1,3 +1,9 @@
2002-09-06 Havoc Pennington <hp@redhat.com>
* parse.c, pkg.c: handle other_libs other_cflags same
as -l/-L/-I flags, so we pull in from dependent packages.
Closes #85244, #90706, #89851
2002-03-27 Havoc Pennington <hp@redhat.com>
* pkg.c (verify_package): fix a typo

5
README
View file

@ -1,7 +1,10 @@
pkg-config is a script to make putting together all the build
flags when compiling/linking a lot easier.
to use it, do something like the following in your configure.in
Report bugs at http://bugzilla.gnome.org (pkg-config is in no way
gnome-specific but gnome.org was a convenient bug tracker).
To use pkg-config, do something like the following in your configure.in
PKG_CHECK_MODULES(GNOME, gtk > 1.2.8 gnomeui >= 1.2.0)
AC_SUBST(GNOME_CFLAGS)

28
parse.c
View file

@ -587,7 +587,6 @@ parse_libs (Package *pkg, const char *str, const char *path)
/* Strip out -l and -L flags, put them in a separate list. */
char *trimmed;
GString *other;
char **argv = NULL;
int argc;
int result;
@ -620,8 +619,6 @@ parse_libs (Package *pkg, const char *str, const char *path)
exit (1);
}
other = g_string_new ("");
i = 0;
while (i < argc)
@ -675,9 +672,9 @@ parse_libs (Package *pkg, const char *str, const char *path)
}
else
{
g_string_append_c (other, ' ');
g_string_append (other, arg);
g_string_append_c (other, ' ');
if (*arg != '\0')
pkg->other_libs = g_slist_prepend (pkg->other_libs,
g_strdup (arg));
}
g_free (arg);
@ -688,12 +685,9 @@ parse_libs (Package *pkg, const char *str, const char *path)
g_free (argv);
g_free (trimmed);
pkg->other_libs = other->str;
g_string_free (other, FALSE);
pkg->l_libs = g_slist_reverse (pkg->l_libs);
pkg->L_libs = g_slist_reverse (pkg->L_libs);
pkg->other_libs = g_slist_reverse (pkg->other_libs);
}
static void
@ -702,7 +696,6 @@ parse_cflags (Package *pkg, const char *str, const char *path)
/* Strip out -I flags, put them in a separate list. */
char *trimmed;
GString *other;
char **argv = NULL;
int argc;
int result;
@ -726,8 +719,6 @@ parse_cflags (Package *pkg, const char *str, const char *path)
exit (1);
}
other = g_string_new ("");
i = 0;
while (i < argc)
@ -761,9 +752,9 @@ parse_cflags (Package *pkg, const char *str, const char *path)
}
else
{
if (other->len > 0)
g_string_append (other, " ");
g_string_append (other, arg);
if (*arg != '\0')
pkg->other_cflags = g_slist_prepend (pkg->other_cflags,
g_strdup (arg));
}
g_free (arg);
@ -774,11 +765,8 @@ parse_cflags (Package *pkg, const char *str, const char *path)
g_free (argv);
g_free (trimmed);
pkg->other_cflags = other->str;
g_string_free (other, FALSE);
pkg->I_cflags = g_slist_reverse (pkg->I_cflags);
pkg->other_cflags = g_slist_reverse (pkg->other_cflags);
}
static void

72
pkg.c
View file

@ -438,12 +438,24 @@ get_L_libs (Package *pkg)
return pkg->L_libs;
}
static GSList*
get_other_libs (Package *pkg)
{
return pkg->other_libs;
}
static GSList *
get_I_cflags (Package *pkg)
{
return pkg->I_cflags;
}
static GSList *
get_other_cflags (Package *pkg)
{
return pkg->other_cflags;
}
static GSList *
get_conflicts (Package *pkg)
{
@ -917,36 +929,16 @@ packages_get_L_libs (GSList *pkgs)
char *
package_get_other_libs (Package *pkg)
{
return g_strdup (pkg->other_libs);
if (pkg->other_libs_merged == NULL)
pkg->other_libs_merged = get_merged (pkg, get_other_libs, TRUE);
return pkg->other_libs_merged;
}
char *
packages_get_other_libs (GSList *pkgs)
{
GSList *tmp;
GString *str;
char *retval;
str = g_string_new ("");
tmp = pkgs;
while (tmp != NULL)
{
Package *pkg = tmp->data;
if (pkg->other_libs)
{
g_string_append (str, pkg->other_libs);
g_string_append (str, " ");
}
tmp = g_slist_next (tmp);
}
retval = str->str;
g_string_free (str, FALSE);
return retval;
return get_multi_merged (pkgs, get_other_libs, TRUE);
}
char *
@ -1004,36 +996,16 @@ packages_get_I_cflags (GSList *pkgs)
char *
package_get_other_cflags (Package *pkg)
{
return g_strdup (pkg->other_cflags);
if (pkg->other_cflags_merged == NULL)
pkg->other_cflags_merged = get_merged (pkg, get_other_cflags, TRUE);
return pkg->other_cflags_merged;
}
char *
packages_get_other_cflags (GSList *pkgs)
{
GSList *tmp;
GString *str;
char *retval;
str = g_string_new ("");
tmp = pkgs;
while (tmp != NULL)
{
Package *pkg = tmp->data;
if (pkg->other_cflags)
{
g_string_append (str, pkg->other_cflags);
g_string_append (str, " ");
}
tmp = g_slist_next (tmp);
}
retval = str->str;
g_string_free (str, FALSE);
return retval;
return get_multi_merged (pkgs, get_other_cflags, TRUE);
}
char *

4
pkg.h
View file

@ -60,11 +60,11 @@ struct _Package
char *l_libs_merged;
GSList *L_libs;
char *L_libs_merged;
char *other_libs;
GSList *other_libs;
char *other_libs_merged;
GSList *I_cflags;
char *I_cflags_merged;
char *other_cflags;
GSList *other_cflags;
char *other_cflags_merged;
GHashTable *vars;
GHashTable *required_versions; /* hash from name to RequiredVersion */