diff --git a/cli/main.c b/cli/main.c index 7b1ea84..563ec8f 100644 --- a/cli/main.c +++ b/cli/main.c @@ -1040,7 +1040,7 @@ main(int argc, char *argv[]) if ((want_flags & PKG_IGNORE_CONFLICTS) == PKG_IGNORE_CONFLICTS || getenv("PKG_CONFIG_IGNORE_CONFLICTS") != NULL) 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); if ((want_flags & PKG_SHARED) == PKG_SHARED) diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index d139c50..2c0a561 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -202,6 +202,8 @@ struct pkgconf_cross_personality_ { pkgconf_list_t filter_includedirs; char *sysroot_dir; + + bool want_default_static; }; /* client.c */ diff --git a/libpkgconf/personality.c b/libpkgconf/personality.c index f3c56f4..f5ca367 100644 --- a/libpkgconf/personality.c +++ b/libpkgconf/personality.c @@ -119,6 +119,16 @@ typedef struct { const ptrdiff_t offset; } 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 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)}, {"SystemLibraryPaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_libdirs)}, {"Triplet", personality_copy_func, offsetof(pkgconf_cross_personality_t, name)}, + {"WantDefaultStatic", personality_bool_func, offsetof(pkgconf_cross_personality_t, want_default_static)}, }; static int diff --git a/man/pkgconf-personality.5 b/man/pkgconf-personality.5 index ea7ad59..7941d9e 100644 --- a/man/pkgconf-personality.5 +++ b/man/pkgconf-personality.5 @@ -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. 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 .Ss PROPERTY KEYWORDS .Bl -tag -width indent @@ -72,6 +76,9 @@ include files. A list of directories that are included by default in the search path for libraries. (mandatory; fragment list) +.It WantDefaultStatic +If true, pkgconf will default to operating in static linking mode. +(optional; boolean; default is false) .\" .El .Sh EXAMPLES