From e9324ee4bc9179d3be29bac4a9873f6915b5d469 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 9 May 2018 22:21:45 -0500 Subject: [PATCH] cli: implement --dump-personality --- cli/main.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/cli/main.c b/cli/main.c index 3a3c6c2..afe9c72 100644 --- a/cli/main.c +++ b/cli/main.c @@ -66,6 +66,7 @@ #define PKG_EXISTS (((uint64_t) 1) << 40) #define PKG_MSVC_SYNTAX (((uint64_t) 1) << 41) #define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42) +#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43) static pkgconf_client_t pkg_client; static const pkgconf_fragment_render_ops_t *want_render_ops = NULL; @@ -637,6 +638,9 @@ usage(void) printf(" --relocate=path relocates a path and exits (mostly for testsuite)\n"); printf(" --dont-relocate-paths disables path relocation support\n"); + printf("\ncross-compilation personality support:\n\n"); + printf(" --dump-personality dumps details concerning selected personality\n"); + printf("\nchecking specific pkg-config database entries:\n\n"); printf(" --atleast-version require a specific version of a module\n"); @@ -696,6 +700,42 @@ relocate_path(const char *path) printf("%s\n", buf); } +static void +dump_personality(const pkgconf_cross_personality_t *p) +{ + pkgconf_node_t *n; + + printf("Triplet: %s\n", p->name); + + if (p->sysroot_dir) + printf("SysrootDir: %s\n", p->sysroot_dir); + + printf("DefaultSearchPaths: "); + PKGCONF_FOREACH_LIST_ENTRY(p->dir_list.head, n) + { + pkgconf_path_t *pn = n->data; + printf("%s ", pn->path); + } + + printf("\n"); + printf("SystemIncludePaths: "); + PKGCONF_FOREACH_LIST_ENTRY(p->filter_includedirs.head, n) + { + pkgconf_path_t *pn = n->data; + printf("%s ", pn->path); + } + + printf("\n"); + printf("SystemLibraryPaths: "); + PKGCONF_FOREACH_LIST_ENTRY(p->filter_libdirs.head, n) + { + pkgconf_path_t *pn = n->data; + printf("%s ", pn->path); + } + + printf("\n"); +} + int main(int argc, char *argv[]) { @@ -781,6 +821,7 @@ main(int argc, char *argv[]) { "msvc-syntax", no_argument, &want_flags, PKG_MSVC_SYNTAX }, { "fragment-filter", required_argument, NULL, 50 }, { "internal-cflags", no_argument, &want_flags, PKG_INTERNAL_CFLAGS }, + { "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY }, { NULL, 0, NULL, 0 } }; @@ -845,6 +886,12 @@ main(int argc, char *argv[]) } } + if ((want_flags & PKG_DUMP_PERSONALITY) == PKG_DUMP_PERSONALITY) + { + dump_personality(personality); + return EXIT_SUCCESS; + } + if ((want_flags & PKG_MSVC_SYNTAX) == PKG_MSVC_SYNTAX) want_render_ops = msvc_renderer_get();