From 1bf5da3ba471c21de9a54263e1a319adbc68b82d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 5 May 2012 22:00:47 -0500 Subject: [PATCH] pkg: implement pkg-config.pc as a builtin --- pkg.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pkg.c b/pkg.c index 0ed3f43..c77f017 100644 --- a/pkg.c +++ b/pkg.c @@ -248,6 +248,12 @@ pkg_get_comparator(pkg_dependency_t *pkgdep) return "???"; } +static pkg_t pkg_config_virtual = { + .id = "pkg-config", + .realname = "pkg-config", + .version = PKG_PKGCONFIG_VERSION_EQUIV, +}; + /* * pkg_verify_dependency(pkgdep, flags) * @@ -257,18 +263,22 @@ pkg_get_comparator(pkg_dependency_t *pkgdep) pkg_t * pkg_verify_dependency(pkg_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags) { - pkg_t *pkg; + pkg_t *pkg = &pkg_config_virtual; if (eflags != NULL) *eflags = PKG_ERRF_OK; - pkg = pkg_find(pkgdep->package, flags); - if (pkg == NULL) + /* pkg-config package name is special cased. */ + if (strcasecmp(pkgdep->package, "pkg-config")) { - if (eflags != NULL) - *eflags |= PKG_ERRF_PACKAGE_NOT_FOUND; + pkg = pkg_find(pkgdep->package, flags); + if (pkg == NULL) + { + if (eflags != NULL) + *eflags |= PKG_ERRF_PACKAGE_NOT_FOUND; - return NULL; + return NULL; + } } pkg->id = strdup(pkgdep->package);