personality: add support for WantDefaultStatic setting

pull/199/head
Ariadne Conill 2019-10-19 00:56:17 -05:00
parent 40fe48355b
commit 48dc665ae3
4 changed files with 21 additions and 1 deletions

View File

@ -1040,7 +1040,7 @@ main(int argc, char *argv[])
if ((want_flags & PKG_IGNORE_CONFLICTS) == PKG_IGNORE_CONFLICTS || getenv("PKG_CONFIG_IGNORE_CONFLICTS") != NULL) if ((want_flags & PKG_IGNORE_CONFLICTS) == PKG_IGNORE_CONFLICTS || getenv("PKG_CONFIG_IGNORE_CONFLICTS") != NULL)
want_client_flags |= PKGCONF_PKG_PKGF_SKIP_CONFLICTS; want_client_flags |= PKGCONF_PKG_PKGF_SKIP_CONFLICTS;
if ((want_flags & PKG_STATIC) == PKG_STATIC) if ((want_flags & PKG_STATIC) == PKG_STATIC || personality->want_default_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) if ((want_flags & PKG_SHARED) == PKG_SHARED)

View File

@ -202,6 +202,8 @@ struct pkgconf_cross_personality_ {
pkgconf_list_t filter_includedirs; pkgconf_list_t filter_includedirs;
char *sysroot_dir; char *sysroot_dir;
bool want_default_static;
}; };
/* client.c */ /* client.c */

View File

@ -119,6 +119,16 @@ typedef struct {
const ptrdiff_t offset; const ptrdiff_t offset;
} personality_keyword_pair_t; } personality_keyword_pair_t;
static void
personality_bool_func(pkgconf_cross_personality_t *p, const char *keyword, const size_t lineno, const ptrdiff_t offset, char *value)
{
(void) keyword;
(void) lineno;
bool *dest = (bool *)((char *) p + offset);
*dest = strcasecmp(value, "true") || strcasecmp(value, "yes") || *value == '1';
}
static void static void
personality_copy_func(pkgconf_cross_personality_t *p, const char *keyword, const size_t lineno, const ptrdiff_t offset, char *value) personality_copy_func(pkgconf_cross_personality_t *p, const char *keyword, const size_t lineno, const ptrdiff_t offset, char *value)
{ {
@ -146,6 +156,7 @@ static const personality_keyword_pair_t personality_keyword_pairs[] = {
{"SystemIncludePaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_includedirs)}, {"SystemIncludePaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_includedirs)},
{"SystemLibraryPaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_libdirs)}, {"SystemLibraryPaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_libdirs)},
{"Triplet", personality_copy_func, offsetof(pkgconf_cross_personality_t, name)}, {"Triplet", personality_copy_func, offsetof(pkgconf_cross_personality_t, name)},
{"WantDefaultStatic", personality_bool_func, offsetof(pkgconf_cross_personality_t, want_default_static)},
}; };
static int static int

View File

@ -49,6 +49,10 @@ The input text must be in a format that is suitable for passing to a POSIX
shell without any shell expansions after variable substitution has been done. shell without any shell expansions after variable substitution has been done.
Elements are delimited with a colon. Elements are delimited with a colon.
.\" .\"
.It Boolean
The property will be set to true if the value is one of: true, yes or 1.
Otherwise it will be set to false.
.\"
.El .El
.Ss PROPERTY KEYWORDS .Ss PROPERTY KEYWORDS
.Bl -tag -width indent .Bl -tag -width indent
@ -72,6 +76,9 @@ include files.
A list of directories that are included by default in the search path for A list of directories that are included by default in the search path for
libraries. libraries.
(mandatory; fragment list) (mandatory; fragment list)
.It WantDefaultStatic
If true, pkgconf will default to operating in static linking mode.
(optional; boolean; default is false)
.\" .\"
.El .El
.Sh EXAMPLES .Sh EXAMPLES