forked from ariadne/pkgconf
Merge pull request #50 from tonytheodore/master
Feature Request: Add Cflags.private fragmentfeature/tap-sh
commit
da179fd8cf
25
pkg.c
25
pkg.c
|
@ -248,6 +248,8 @@ pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
|
||||||
pkg->version = pkg_tuple_parse(&pkg->vars, value);
|
pkg->version = pkg_tuple_parse(&pkg->vars, value);
|
||||||
else if (!strcasecmp(key, "CFLAGS"))
|
else if (!strcasecmp(key, "CFLAGS"))
|
||||||
pkg_fragment_parse(&pkg->cflags, &pkg->vars, value);
|
pkg_fragment_parse(&pkg->cflags, &pkg->vars, value);
|
||||||
|
else if (!strcasecmp(key, "CFLAGS.private"))
|
||||||
|
pkg_fragment_parse(&pkg->cflags_private, &pkg->vars, value);
|
||||||
else if (!strcasecmp(key, "LIBS"))
|
else if (!strcasecmp(key, "LIBS"))
|
||||||
pkg_fragment_parse(&pkg->libs, &pkg->vars, value);
|
pkg_fragment_parse(&pkg->libs, &pkg->vars, value);
|
||||||
else if (!strcasecmp(key, "LIBS.private"))
|
else if (!strcasecmp(key, "LIBS.private"))
|
||||||
|
@ -295,6 +297,7 @@ pkg_free(pkg_t *pkg)
|
||||||
pkg_dependency_free(&pkg->conflicts);
|
pkg_dependency_free(&pkg->conflicts);
|
||||||
|
|
||||||
pkg_fragment_free(&pkg->cflags);
|
pkg_fragment_free(&pkg->cflags);
|
||||||
|
pkg_fragment_free(&pkg->cflags_private);
|
||||||
pkg_fragment_free(&pkg->libs);
|
pkg_fragment_free(&pkg->libs);
|
||||||
pkg_fragment_free(&pkg->libs_private);
|
pkg_fragment_free(&pkg->libs_private);
|
||||||
|
|
||||||
|
@ -1000,6 +1003,21 @@ pkg_cflags_collect(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pkg_cflags_private_collect(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
|
{
|
||||||
|
pkg_list_t *list = data;
|
||||||
|
pkg_node_t *node;
|
||||||
|
(void) flags;
|
||||||
|
|
||||||
|
PKG_FOREACH_LIST_ENTRY(pkg->cflags_private.head, node)
|
||||||
|
{
|
||||||
|
pkg_fragment_t *frag = node->data;
|
||||||
|
|
||||||
|
pkg_fragment_copy(list, frag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pkg_cflags(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags)
|
pkg_cflags(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
@ -1009,6 +1027,13 @@ pkg_cflags(pkg_t *root, pkg_list_t *list, int maxdepth, unsigned int flags)
|
||||||
if (eflag != PKG_ERRF_OK)
|
if (eflag != PKG_ERRF_OK)
|
||||||
pkg_fragment_free(list);
|
pkg_fragment_free(list);
|
||||||
|
|
||||||
|
if (flags & PKGF_MERGE_PRIVATE_FRAGMENTS)
|
||||||
|
{
|
||||||
|
eflag = pkg_traverse(root, pkg_cflags_private_collect, list, maxdepth, flags);
|
||||||
|
if (eflag != PKG_ERRF_OK)
|
||||||
|
pkg_fragment_free(list);
|
||||||
|
}
|
||||||
|
|
||||||
return eflag;
|
return eflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
pkg.h
1
pkg.h
|
@ -95,6 +95,7 @@ struct pkg_ {
|
||||||
pkg_list_t libs;
|
pkg_list_t libs;
|
||||||
pkg_list_t libs_private;
|
pkg_list_t libs_private;
|
||||||
pkg_list_t cflags;
|
pkg_list_t cflags;
|
||||||
|
pkg_list_t cflags_private;
|
||||||
|
|
||||||
pkg_list_t requires;
|
pkg_list_t requires;
|
||||||
pkg_list_t requires_private;
|
pkg_list_t requires_private;
|
||||||
|
|
|
@ -8,3 +8,4 @@ Description: A testing pkg-config file
|
||||||
Version: 1.2.3
|
Version: 1.2.3
|
||||||
Libs: -L${libdir} -lfoo
|
Libs: -L${libdir} -lfoo
|
||||||
Cflags: -fPIC -I${includedir}/foo
|
Cflags: -fPIC -I${includedir}/foo
|
||||||
|
Cflags.private: -DFOO_STATIC
|
||||||
|
|
|
@ -114,6 +114,8 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs baz" \
|
||||||
'-lfoo' '-lbaz' '-lzee'
|
'-lfoo' '-lbaz' '-lzee'
|
||||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs argv-parse-2" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs argv-parse-2" \
|
||||||
'-pthread '
|
'-pthread '
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --cflags baz" \
|
||||||
|
'-fPIC' '-I/usr/include/foo' '-DFOO_STATIC'
|
||||||
|
|
||||||
# 4) tests for parser bugs
|
# 4) tests for parser bugs
|
||||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs dos-lineendings" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs dos-lineendings" \
|
||||||
|
|
Loading…
Reference in New Issue