forked from ariadne/pkgconf
main: implement support for PKG_CONFIG_SYSROOT_DIR (issue #5)
parent
9885643e45
commit
2aaa1ce0df
26
main.c
26
main.c
|
@ -64,11 +64,11 @@ static char *required_exact_module_version = NULL;
|
||||||
static char *required_max_module_version = NULL;
|
static char *required_max_module_version = NULL;
|
||||||
static char *required_module_version = NULL;
|
static char *required_module_version = NULL;
|
||||||
static char *want_variable = NULL;
|
static char *want_variable = NULL;
|
||||||
|
static char *sysroot_dir = NULL;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
fragment_has_system_dir(pkg_fragment_t *frag)
|
fragment_has_system_dir(pkg_fragment_t *frag)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (frag->type)
|
switch (frag->type)
|
||||||
{
|
{
|
||||||
case 'L':
|
case 'L':
|
||||||
|
@ -84,6 +84,23 @@ fragment_has_system_dir(pkg_fragment_t *frag)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
print_sysroot_dir(pkg_fragment_t *frag)
|
||||||
|
{
|
||||||
|
if (sysroot_dir == NULL)
|
||||||
|
return "";
|
||||||
|
else switch (frag->type)
|
||||||
|
{
|
||||||
|
case 'L':
|
||||||
|
case 'I':
|
||||||
|
return sysroot_dir;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_fragment(pkg_fragment_t *frag)
|
print_fragment(pkg_fragment_t *frag)
|
||||||
{
|
{
|
||||||
|
@ -91,7 +108,7 @@ print_fragment(pkg_fragment_t *frag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (frag->type)
|
if (frag->type)
|
||||||
printf("-%c%s ", frag->type, frag->data);
|
printf("-%c%s%s ", frag->type, print_sysroot_dir(frag), frag->data);
|
||||||
else
|
else
|
||||||
printf("%s ", frag->data);
|
printf("%s ", frag->data);
|
||||||
}
|
}
|
||||||
|
@ -580,6 +597,11 @@ main(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
pkg_tuple_add_global("pc_top_builddir", "$(top_builddir)");
|
pkg_tuple_add_global("pc_top_builddir", "$(top_builddir)");
|
||||||
|
|
||||||
|
if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL)
|
||||||
|
pkg_tuple_add_global("pc_sysrootdir", sysroot_dir);
|
||||||
|
else
|
||||||
|
pkg_tuple_add_global("pc_sysrootdir", "/");
|
||||||
|
|
||||||
if (required_pkgconfig_version != NULL)
|
if (required_pkgconfig_version != NULL)
|
||||||
{
|
{
|
||||||
if (pkg_compare_version(PKG_PKGCONFIG_VERSION_EQUIV, required_pkgconfig_version) >= 0)
|
if (pkg_compare_version(PKG_PKGCONFIG_VERSION_EQUIV, required_pkgconfig_version) >= 0)
|
||||||
|
|
Loading…
Reference in New Issue