cli: main: add --shared option

master
Ariadne Conill 2019-10-19 00:45:49 -05:00
parent f1ce393632
commit 40fe48355b
2 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,7 @@
#define PKG_MSVC_SYNTAX (((uint64_t) 1) << 41) #define PKG_MSVC_SYNTAX (((uint64_t) 1) << 41)
#define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42) #define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42)
#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43) #define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43)
#define PKG_SHARED (((uint64_t) 1) << 44)
static pkgconf_client_t pkg_client; static pkgconf_client_t pkg_client;
static const pkgconf_fragment_render_ops_t *want_render_ops = NULL; static const pkgconf_fragment_render_ops_t *want_render_ops = NULL;
@ -664,6 +665,7 @@ usage(void)
printf(" --maximum-traverse-depth maximum allowed depth for dependency graph\n"); printf(" --maximum-traverse-depth maximum allowed depth for dependency graph\n");
printf(" --static be more aggressive when computing dependency graph\n"); printf(" --static be more aggressive when computing dependency graph\n");
printf(" (for static linking)\n"); printf(" (for static linking)\n");
printf(" --shared use a simplified dependency graph (usually default)\n");
printf(" --pure optimize a static dependency graph as if it were a normal\n"); printf(" --pure optimize a static dependency graph as if it were a normal\n");
printf(" dependency graph\n"); printf(" dependency graph\n");
printf(" --env-only look only for package entries in PKG_CONFIG_PATH\n"); printf(" --env-only look only for package entries in PKG_CONFIG_PATH\n");
@ -827,6 +829,7 @@ main(int argc, char *argv[])
{ "short-errors", no_argument, &want_flags, PKG_SHORT_ERRORS, }, { "short-errors", no_argument, &want_flags, PKG_SHORT_ERRORS, },
{ "maximum-traverse-depth", required_argument, NULL, 11, }, { "maximum-traverse-depth", required_argument, NULL, 11, },
{ "static", no_argument, &want_flags, PKG_STATIC, }, { "static", no_argument, &want_flags, PKG_STATIC, },
{ "shared", no_argument, &want_flags, PKG_SHARED, },
{ "pure", no_argument, &want_flags, PKG_PURE, }, { "pure", no_argument, &want_flags, PKG_PURE, },
{ "print-requires", no_argument, &want_flags, PKG_REQUIRES, }, { "print-requires", no_argument, &want_flags, PKG_REQUIRES, },
{ "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, }, { "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, },
@ -1040,6 +1043,9 @@ main(int argc, char *argv[])
if ((want_flags & PKG_STATIC) == PKG_STATIC) if ((want_flags & PKG_STATIC) == PKG_STATIC)
want_client_flags |= (PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS); want_client_flags |= (PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS);
if ((want_flags & PKG_SHARED) == PKG_SHARED)
want_client_flags &= ~(PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS);
/* if --static and --pure are both specified, then disable merge-back. /* if --static and --pure are both specified, then disable merge-back.
* this allows for a --static which searches private modules, but has the same fragment behaviour as if * this allows for a --static which searches private modules, but has the same fragment behaviour as if
* --static were disabled. see <https://github.com/pkgconf/pkgconf/issues/83> for rationale. * --static were disabled. see <https://github.com/pkgconf/pkgconf/issues/83> for rationale.

View File

@ -58,6 +58,8 @@ dependencies of modules added to the resolver's solution.
.It Fl -static .It Fl -static
Compute a deeper dependency graph and use compiler/linker flags intended for Compute a deeper dependency graph and use compiler/linker flags intended for
static linking. static linking.
.It Fl -shared
Compute a simple dependency graph that is only suitable for shared linking.
.It Fl -pure .It Fl -pure
Treats the computed dependency graph as if it were pure. Treats the computed dependency graph as if it were pure.
This is mainly intended for use with the This is mainly intended for use with the