pkg: add support for compiling in more than one default pkg-config search path
Some packages install to /usr/share/pkgconfig instead of /usr/lib/pkgconfig.pull/15/head
parent
7f7ad67bb2
commit
83ba295077
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ SRCS = main.c parse.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fil
|
||||||
|
|
||||||
include buildsys.mk
|
include buildsys.mk
|
||||||
|
|
||||||
CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -DPKG_DEFAULT_PATH=\"${libdir}/pkgconfig\" -Wall -Wextra -Wformat=2 -std=gnu99 -D_FORTIFY_SOURCE=2
|
CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -DPKG_DEFAULT_PATH=\"${libdir}/pkgconfig:${datadir}/pkgconfig\" -Wall -Wextra -Wformat=2 -std=gnu99 -D_FORTIFY_SOURCE=2
|
||||||
|
|
||||||
install-extra:
|
install-extra:
|
||||||
mkdir -p $(DESTDIR)/$(datarootdir)/aclocal
|
mkdir -p $(DESTDIR)/$(datarootdir)/aclocal
|
||||||
|
|
13
pkg.c
13
pkg.c
|
@ -89,9 +89,20 @@ pkg_find(const char *name, unsigned int flags)
|
||||||
|
|
||||||
if (!(flags & PKGF_ENV_ONLY))
|
if (!(flags & PKGF_ENV_ONLY))
|
||||||
{
|
{
|
||||||
snprintf(locbuf, sizeof locbuf, "%s/%s" PKG_CONFIG_EXT, PKG_DEFAULT_PATH, name);
|
count = path_split(PKG_DEFAULT_PATH, &path);
|
||||||
|
|
||||||
|
while (iter < count)
|
||||||
|
{
|
||||||
|
snprintf(locbuf, sizeof locbuf, "%s/%s" PKG_CONFIG_EXT, path[iter], name);
|
||||||
|
free(path[iter]);
|
||||||
|
|
||||||
if ((f = fopen(locbuf, "r")) != NULL)
|
if ((f = fopen(locbuf, "r")) != NULL)
|
||||||
return parse_file(locbuf, f);
|
return parse_file(locbuf, f);
|
||||||
|
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue