- update to 0.8.4 which include all the changes added in 0.8.3_1 + some code

cleanups
This commit is contained in:
Baptiste Daroussin 2012-07-29 22:26:20 +00:00
parent db838cc82a
commit a8c3f84f55
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=301697
6 changed files with 3 additions and 267 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= pkgconf
PORTVERSION= 0.8.3
PORTREVISION= 1
PORTVERSION= 0.8.4
CATEGORIES= devel
MASTER_SITES= http://nenolod.net/~nenolod/distfiles/

View File

@ -1,2 +1,2 @@
SHA256 (pkgconf-0.8.3.tar.bz2) = befb1b11a4845514248c69fd6dc3e991603fbd1acbbcb6db76bd5e30c657b8b1
SIZE (pkgconf-0.8.3.tar.bz2) = 80112
SHA256 (pkgconf-0.8.4.tar.bz2) = 4255cc032691b32a1e5c36e58290e93dc4e0104620b27cfd2bc92b00677f2df3
SIZE (pkgconf-0.8.4.tar.bz2) = 80885

View File

@ -1,132 +0,0 @@
--- ./main.c.orig 2012-07-26 04:13:43.000000000 +0200
+++ ./main.c 2012-07-29 11:31:53.000000000 +0200
@@ -26,28 +26,18 @@
static unsigned int global_traverse_flags = PKGF_NONE;
-static int want_help = 0;
-static int want_version = 0;
static int want_cflags = 0;
static int want_libs = 0;
static int want_modversion = 0;
-static int want_static = 0;
static int want_requires = 0;
static int want_requires_private = 0;
static int want_variables = 0;
static int want_digraph = 0;
-static int want_env_only = 0;
static int want_uninstalled = 0;
-static int want_no_uninstalled = 0;
static int want_keep_system_cflags = 0;
static int want_keep_system_libs = 0;
-static int want_ignore_conflicts = 0;
static int maximum_traverse_depth = -1;
-static char *required_pkgconfig_version = NULL;
-static char *required_exact_module_version = NULL;
-static char *required_max_module_version = NULL;
-static char *required_module_version = NULL;
static char *want_variable = NULL;
static char *sysroot_dir = NULL;
@@ -101,6 +91,15 @@
}
static void
+print_list_entry(const pkg_t *entry)
+{
+ if (entry->uninstalled)
+ return;
+
+ printf("%-30s %s - %s\n", entry->id, entry->realname, entry->description);
+}
+
+static void
print_cflags(pkg_fragment_t *list)
{
pkg_fragment_t *frag;
@@ -414,6 +413,12 @@
static void
version(void)
{
+ printf("%s\n", PKG_PKGCONFIG_VERSION_EQUIV);
+}
+
+static void
+about(void)
+{
printf("%s %s%s\n", PACKAGE_NAME, PACKAGE_VERSION, HAVE_STRICT_MODE ? " [strict]" : " [pkg-config compatible]");
printf("Copyright (c) 2011 - 2012 pkgconf authors (see AUTHORS in documentation directory).\n\n");
printf("Permission to use, copy, modify, and/or distribute this software for any\n");
@@ -438,6 +443,7 @@
printf(" with a specified pkg-config version\n");
printf(" --errors-to-stdout print all errors on stdout instead of stderr\n");
printf(" --silence-errors explicitly be silent about errors\n");
+ printf(" --list-all list all known packages\n");
printf("\nchecking specific pkg-config database entries:\n\n");
@@ -482,6 +488,11 @@
pkg_queue_t *pkgq = NULL;
pkg_queue_t *pkgq_head = NULL;
char *builddir;
+ char *required_pkgconfig_version = NULL;
+ char *required_exact_module_version = NULL;
+ char *required_max_module_version = NULL;
+ char *required_module_version = NULL;
+ int want_env_only = 0;
int want_errors_on_stdout = 0;
int want_silence_errors = 0;
int want_libs_L = 0;
@@ -489,9 +500,17 @@
int want_libs_other = 0;
int want_cflags_I = 0;
int want_cflags_other = 0;
+ int want_list = 0;
+ int want_about = 0;
+ int want_help = 0;
+ int want_version = 0;
+ int want_ignore_conflicts = 0;
+ int want_static = 0;
+ int want_no_uninstalled = 0;
struct pkg_option options[] = {
{ "version", no_argument, &want_version, 1, },
+ { "about", no_argument, &want_about, 1, },
{ "atleast-version", required_argument, NULL, 2, },
{ "atleast-pkgconfig-version", required_argument, NULL, 3, },
{ "libs", no_argument, &want_libs, 4, },
@@ -524,6 +543,7 @@
{ "ignore-conflicts", no_argument, &want_ignore_conflicts, 30, },
{ "errors-to-stdout", no_argument, &want_errors_on_stdout, 31, },
{ "silence-errors", no_argument, &want_silence_errors, 32, },
+ { "list-all", no_argument, &want_list, 33, },
{ NULL, 0, NULL, 0 }
};
@@ -573,6 +593,12 @@
else if (want_cflags_other)
want_cflags = want_cflags_other;
+ if (want_about)
+ {
+ about();
+ return EXIT_SUCCESS;
+ }
+
if (want_version)
{
version();
@@ -627,6 +653,12 @@
return EXIT_FAILURE;
}
+ if (want_list)
+ {
+ pkg_scan_all(print_list_entry);
+ return EXIT_SUCCESS;
+ }
+
if (required_module_version != NULL)
{
pkg_t *pkg;

View File

@ -1,101 +0,0 @@
--- ./pkg.c.orig 2012-07-29 11:35:32.856917000 +0200
+++ ./pkg.c 2012-07-29 11:31:53.000000000 +0200
@@ -142,11 +142,18 @@
{
pkg_t *pkg;
char readbuf[PKG_BUFSIZE];
+ char *idptr;
pkg = calloc(sizeof(pkg_t), 1);
pkg->filename = strdup(filename);
pkg->vars = pkg_tuple_add(pkg->vars, "pcfiledir", pkg_get_parent_dir(pkg));
+ /* make module id */
+ pkg->id = strdup(basename(pkg->filename));
+ idptr = strrchr(pkg->id, '.');
+ if (idptr)
+ *idptr = '\0';
+
while (pkg_fgetline(readbuf, PKG_BUFSIZE, f) != NULL)
{
char op, *p, *key = NULL, *value = NULL;
@@ -274,6 +281,79 @@
return pkg;
}
+static void
+pkg_scan_dir(const char *path, pkg_iteration_func_t func)
+{
+ DIR *dir;
+ struct dirent *dirent;
+
+ dir = opendir(path);
+ if (dir == NULL)
+ return;
+
+ for (dirent = readdir(dir); dirent != NULL; dirent = readdir(dir))
+ {
+ static char filebuf[PKG_BUFSIZE];
+ pkg_t *pkg;
+ FILE *f;
+ struct stat st;
+
+ strlcpy(filebuf, path, sizeof filebuf);
+ strlcat(filebuf, "/", sizeof filebuf);
+ strlcat(filebuf, dirent->d_name, sizeof filebuf);
+
+ stat(filebuf, &st);
+ if (!(S_ISREG(st.st_mode)))
+ continue;
+
+ f = fopen(filebuf, "r");
+ if (f == NULL)
+ continue;
+
+ pkg = pkg_new_from_file(filebuf, f);
+ if (pkg != NULL)
+ {
+ func(pkg);
+ pkg_free(pkg);
+ }
+ }
+
+ closedir(dir);
+}
+
+void
+pkg_scan(const char *search_path, pkg_iteration_func_t func)
+{
+ char **path = NULL;
+ size_t count = 0, iter = 0;
+
+ /* PKG_CONFIG_PATH has to take precedence */
+ if (search_path == NULL)
+ return;
+
+ count = path_split(search_path, &path);
+
+ for (iter = 0; iter < count; iter++)
+ pkg_scan_dir(path[iter], func);
+
+ path_free(path, count);
+}
+
+void
+pkg_scan_all(pkg_iteration_func_t func)
+{
+ char *path;
+
+ path = getenv("PKG_CONFIG_PATH");
+ if (path)
+ {
+ pkg_scan(path, func);
+ return;
+ }
+
+ pkg_scan(get_pkgconfig_path(), func);
+}
+
#ifdef _WIN32
pkg_t *
pkg_find_in_registry_key(HKEY hkey, const char *name, unsigned int flags)

View File

@ -1,17 +0,0 @@
--- ./pkg.h.orig 2012-07-26 04:13:43.000000000 +0200
+++ ./pkg.h 2012-07-29 11:31:53.000000000 +0200
@@ -114,11 +114,14 @@
#define PKG_ERRF_PACKAGE_VER_MISMATCH 0x2
#define PKG_ERRF_PACKAGE_CONFLICT 0x4
+typedef void (*pkg_iteration_func_t)(const pkg_t *pkg);
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags);
/* pkg.c */
void pkg_free(pkg_t *pkg);
pkg_t *pkg_find(const char *name, unsigned int flags);
+void pkg_scan(const char *search_path, pkg_iteration_func_t func);
+void pkg_scan_all(pkg_iteration_func_t func);
unsigned int pkg_traverse(pkg_t *root, pkg_traverse_func_t func, void *data, int maxdepth, unsigned int flags);
unsigned int pkg_verify_graph(pkg_t *root, int depth, unsigned int flags);
int pkg_compare_version(const char *a, const char *b);

View File

@ -1,13 +0,0 @@
--- ./stdinc.h.orig 2012-07-26 04:13:43.000000000 +0200
+++ ./stdinc.h 2012-07-29 11:31:53.000000000 +0200
@@ -23,6 +23,10 @@
#include <stdbool.h>
#include <string.h>
#include <libgen.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN