main: implement support for printing fragment lists

pull/15/head
William Pitcock 2012-05-03 19:36:47 +00:00
parent 588a671125
commit b0521ec9d8
1 changed files with 27 additions and 3 deletions

30
main.c
View File

@ -55,13 +55,27 @@ static char *required_pkgconfig_version = NULL;
static char *required_module_version = NULL; static char *required_module_version = NULL;
static char *want_variable = NULL; static char *want_variable = NULL;
static void
print_fragment(pkg_fragment_t *frag)
{
if (frag->type)
printf("-%c%s ", frag->type, frag->data);
else
printf("%s ", frag->data);
}
static void static void
print_cflags(pkg_t *pkg, void *unused) print_cflags(pkg_t *pkg, void *unused)
{ {
(void) unused; (void) unused;
if (pkg->cflags != NULL) if (pkg->cflags != NULL)
printf("%s ", pkg->cflags); {
pkg_fragment_t *frag;
foreach_list_entry(pkg->cflags, frag)
print_fragment(frag);
}
} }
static void static void
@ -70,10 +84,20 @@ print_libs(pkg_t *pkg, void *unused)
(void) unused; (void) unused;
if (pkg->libs != NULL) if (pkg->libs != NULL)
printf("%s ", pkg->libs); {
pkg_fragment_t *frag;
foreach_list_entry(pkg->libs, frag)
print_fragment(frag);
}
if (want_static && pkg->libs_private != NULL) if (want_static && pkg->libs_private != NULL)
printf("%s ", pkg->libs_private); {
pkg_fragment_t *frag;
foreach_list_entry(pkg->libs_private, frag)
print_fragment(frag);
}
} }
static void static void