diff --git a/pkg.c b/pkg.c index afd2a75..2b48f30 100644 --- a/pkg.c +++ b/pkg.c @@ -669,3 +669,28 @@ pkg_cflags(pkg_t *root, int maxdepth, unsigned int flags) return head; } +static void +pkg_libs_collect(pkg_t *pkg, void *data, unsigned int flags) +{ + pkg_fragment_t **list = data; + pkg_fragment_t *frag; + + PKG_FOREACH_LIST_ENTRY(pkg->libs, frag) + *list = pkg_fragment_copy(*list, frag); + + if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS) + { + PKG_FOREACH_LIST_ENTRY(pkg->libs_private, frag) + *list = pkg_fragment_copy(*list, frag); + } +} + +pkg_fragment_t * +pkg_libs(pkg_t *root, int maxdepth, unsigned int flags) +{ + pkg_fragment_t *head = NULL; + + pkg_traverse(root, pkg_libs_collect, &head, maxdepth, flags); + + return head; +} diff --git a/pkg.h b/pkg.h index 820dc36..ce228c5 100644 --- a/pkg.h +++ b/pkg.h @@ -133,6 +133,7 @@ int pkg_compare_version(const char *a, const char *b); pkg_t *pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags); const char *pkg_get_comparator(pkg_dependency_t *pkgdep); pkg_fragment_t *pkg_cflags(pkg_t *root, int maxdepth, unsigned int flags); +pkg_fragment_t *pkg_libs(pkg_t *root, int maxdepth, unsigned int flags); /* parse.c */ pkg_t *pkg_new_from_file(const char *path, FILE *f);