diff -rN -u old-pkg-config-0.21/main.c new-pkg-config-0.21/main.c --- old-pkg-config-0.21/main.c 2006-08-16 19:54:56.000000000 +0200 +++ new-pkg-config-0.21/main.c 2006-10-30 23:45:21.000000000 +0100 @@ -500,6 +500,12 @@ goto nextiter; } + if (!pkgconfig_version_test(req)) + { + failed = TRUE; + verbose_error("%s requires version %s of pkgconfig, but version is " VERSION "\n",req->name,req->min_pkgconfig); + goto nextiter; + } packages = g_slist_prepend (packages, req); diff -rN -u old-pkg-config-0.21/parse.c new-pkg-config-0.21/parse.c --- old-pkg-config-0.21/parse.c 2006-10-30 23:28:31.000000000 +0100 +++ new-pkg-config-0.21/parse.c 2006-10-30 23:48:48.000000000 +0100 @@ -248,6 +248,18 @@ } static void +parse_pkgconfig_version (Package *pkg, const char *str, const char *path) +{ + if (pkg->min_pkgconfig) + { + verbose_error ("pkgconfig_min_version field occurs twice in '%s'\n", path); + + exit (1); + } + pkg->min_pkgconfig = trim_and_sub (pkg, str, path); +} + +static void parse_description (Package *pkg, const char *str, const char *path) { if (pkg->description) @@ -966,6 +978,8 @@ parse_conflicts (pkg, p, path); else if (strcmp (tag, "URL") == 0) parse_url (pkg, p, path); + else if (strcmp (tag, "pkgconfig_min_version") == 0) + parse_pkgconfig_version (pkg, p, path); else { /* we don't error out on unknown keywords because they may diff -rN -u old-pkg-config-0.21/pkg.c new-pkg-config-0.21/pkg.c --- old-pkg-config-0.21/pkg.c 2006-08-16 21:01:04.000000000 +0200 +++ new-pkg-config-0.21/pkg.c 2006-10-30 23:47:05.000000000 +0100 @@ -812,6 +812,11 @@ exit (1); } } + if (!pkgconfig_version_test(req)) + { + verbose_error("%s requires version %s of pkgconfig, but version is " VERSION "\n",req->name,req->min_pkgconfig); + exit(1); + } iter = g_slist_next (iter); } @@ -1387,6 +1392,14 @@ return rpmvercmp (a, b); } + +gboolean pkgconfig_version_test(Package *pkg) +{ + if (pkg->min_pkgconfig == NULL) + return TRUE; + return version_test(GREATER_THAN_EQUAL, VERSION, pkg->min_pkgconfig); +} + gboolean version_test (ComparisonType comparison, const char *a, diff -rN -u old-pkg-config-0.21/pkg.h new-pkg-config-0.21/pkg.h --- old-pkg-config-0.21/pkg.h 2006-08-16 19:05:30.000000000 +0200 +++ new-pkg-config-0.21/pkg.h 2006-10-30 23:33:47.000000000 +0100 @@ -75,6 +75,7 @@ int path_position; /* used to order packages by position in path of their .pc file, lower number means earlier in path */ int libs_num; /* Number of times the "Libs" header has been seen */ int libs_private_num; /* Number of times the "Libs.private" header has been seen */ + char *min_pkgconfig; /* minimum version of pkg-config */ }; Package *get_package (const char *name); @@ -101,6 +102,7 @@ void add_search_dirs (const char *path, const char *separator); void package_init (void); int compare_versions (const char * a, const char *b); +gboolean pkgconfig_version_test(Package *pkg); gboolean version_test (ComparisonType comparison, const char *a, const char *b);