Add --libs-only-L --libs-only-l and --libs-only-other
They are exclusive in freedesktop implementation keep the same order of priority
This commit is contained in:
parent
4a5b7b44e9
commit
44d46c582f
|
@ -47,6 +47,9 @@ typedef struct _PkgConfigPrefs
|
||||||
int cflags;
|
int cflags;
|
||||||
int exists;
|
int exists;
|
||||||
int libs;
|
int libs;
|
||||||
|
int libs_only_L;
|
||||||
|
int libs_only_l;
|
||||||
|
int libs_only_other;
|
||||||
int modversion;
|
int modversion;
|
||||||
int _static;
|
int _static;
|
||||||
int version;
|
int version;
|
||||||
|
@ -248,6 +251,7 @@ static int _pkgconfig_parse_directive(PkgConfig * pc, char const * directive,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char * p;
|
char * p;
|
||||||
|
char * walk;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s(\"%s\", \"%s\")\n", __func__, directive,
|
fprintf(stderr, "DEBUG: %s(\"%s\", \"%s\")\n", __func__, directive,
|
||||||
|
@ -264,8 +268,29 @@ static int _pkgconfig_parse_directive(PkgConfig * pc, char const * directive,
|
||||||
printf("%s\n", p);
|
printf("%s\n", p);
|
||||||
else if(strcmp(directive, "Cflags") == 0 && pc->prefs.cflags)
|
else if(strcmp(directive, "Cflags") == 0 && pc->prefs.cflags)
|
||||||
printf(" %s", p);
|
printf(" %s", p);
|
||||||
else if(strcmp(directive, "Libs") == 0 && pc->prefs.libs)
|
else if(strcmp(directive, "Libs") == 0 && pc->prefs.libs) {
|
||||||
|
if(pc->prefs.libs_only_l) {
|
||||||
|
while((walk = strrchr(p, ' ')) != NULL) {
|
||||||
|
if (walk[1] == '-' && walk[2] == 'l')
|
||||||
|
printf(" %s", walk);
|
||||||
|
walk[0] = '\0';
|
||||||
|
}
|
||||||
|
} else if(pc->prefs.libs_only_L) {
|
||||||
|
while((walk = strrchr(p, ' ')) != NULL) {
|
||||||
|
if (walk[1] == '-' && walk[2] == 'L')
|
||||||
|
printf(" %s", walk);
|
||||||
|
walk[0] = '\0';
|
||||||
|
}
|
||||||
|
} else if(pc->prefs.libs_only_other) {
|
||||||
|
while((walk = strrchr(p, ' ')) != NULL) {
|
||||||
|
if (walk[1] == '-' && ( walk[2] != 'L'
|
||||||
|
&& walk[2] != 'l'))
|
||||||
|
printf(" %s", walk);
|
||||||
|
walk[0] = '\0';
|
||||||
|
}
|
||||||
|
} else
|
||||||
printf(" %s", p);
|
printf(" %s", p);
|
||||||
|
}
|
||||||
/* FIXME implement the rest */
|
/* FIXME implement the rest */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
else
|
else
|
||||||
|
@ -510,8 +535,12 @@ static int _usage(int brief)
|
||||||
else
|
else
|
||||||
fputs("Usage: pkg-config [OPTIONS...] [PACKAGES...]\n"
|
fputs("Usage: pkg-config [OPTIONS...] [PACKAGES...]\n"
|
||||||
" --libs Output all linker flags\n"
|
" --libs Output all linker flags\n"
|
||||||
|
" --libs_only_L Ouput -L flags\n"
|
||||||
|
" --libs_only_l Ouput -l flags\n"
|
||||||
|
" --libs_only_other other libs (e.g. -pthread)\n"
|
||||||
" --static Output linker flags for static linking\n"
|
" --static Output linker flags for static linking\n"
|
||||||
" --version Output version of pkg-config\n"
|
" --version Output version of pkg-config\n"
|
||||||
|
" --modversion Output version for package\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Help options:\n"
|
"Help options:\n"
|
||||||
" -?, --help Show this help message\n"
|
" -?, --help Show this help message\n"
|
||||||
|
@ -525,6 +554,9 @@ static int _main_option(PkgConfigPrefs * prefs, char const * option);
|
||||||
static int _main_option_cflags(PkgConfigPrefs * prefs);
|
static int _main_option_cflags(PkgConfigPrefs * prefs);
|
||||||
static int _main_option_exists(PkgConfigPrefs * prefs);
|
static int _main_option_exists(PkgConfigPrefs * prefs);
|
||||||
static int _main_option_libs(PkgConfigPrefs * prefs);
|
static int _main_option_libs(PkgConfigPrefs * prefs);
|
||||||
|
static int _main_option_libs_only_l(PkgConfigPrefs * prefs);
|
||||||
|
static int _main_option_libs_only_L(PkgConfigPrefs * prefs);
|
||||||
|
static int _main_option_libs_only_other(PkgConfigPrefs * prefs);
|
||||||
static int _main_option_static(PkgConfigPrefs * prefs);
|
static int _main_option_static(PkgConfigPrefs * prefs);
|
||||||
static int _main_option_usage(PkgConfigPrefs * prefs);
|
static int _main_option_usage(PkgConfigPrefs * prefs);
|
||||||
static int _main_option_version(PkgConfigPrefs * prefs);
|
static int _main_option_version(PkgConfigPrefs * prefs);
|
||||||
|
@ -537,6 +569,9 @@ static struct
|
||||||
{ "cflags", _main_option_cflags },
|
{ "cflags", _main_option_cflags },
|
||||||
{ "exists", _main_option_exists },
|
{ "exists", _main_option_exists },
|
||||||
{ "libs", _main_option_libs },
|
{ "libs", _main_option_libs },
|
||||||
|
{ "libs-only-l", _main_option_libs_only_l },
|
||||||
|
{ "libs-only-L", _main_option_libs_only_L },
|
||||||
|
{ "libs-only-other", _main_option_libs_only_other },
|
||||||
{ "modversion", _main_option_modversion },
|
{ "modversion", _main_option_modversion },
|
||||||
{ "static", _main_option_static },
|
{ "static", _main_option_static },
|
||||||
{ "usage", _main_option_usage },
|
{ "usage", _main_option_usage },
|
||||||
|
@ -605,6 +640,24 @@ static int _main_option_libs(PkgConfigPrefs * prefs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _main_option_libs_only_L(PkgConfigPrefs * prefs)
|
||||||
|
{
|
||||||
|
prefs->libs_only_L = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int _main_option_libs_only_l(PkgConfigPrefs * prefs)
|
||||||
|
{
|
||||||
|
prefs->libs_only_l = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int _main_option_libs_only_other(PkgConfigPrefs * prefs)
|
||||||
|
{
|
||||||
|
prefs->libs_only_other = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int _main_option_static(PkgConfigPrefs * prefs)
|
static int _main_option_static(PkgConfigPrefs * prefs)
|
||||||
{
|
{
|
||||||
prefs->_static = 1;
|
prefs->_static = 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user