pkg->requires = g_slist_reverse (pkg->requires);
}
+static void
+parse_requires_private (Package *pkg, const char *str, const char *path)
+{
+ GSList *parsed;
+ GSList *iter;
+ char *trimmed;
+
+ if (pkg->requires_private)
+ {
+ verbose_error ("Requires.private field occurs twice in '%s'\n", path);
+
+ exit (1);
+ }
+
+ trimmed = trim_and_sub (pkg, str, path);
+ parsed = parse_module_list (pkg, trimmed, path);
+ g_free (trimmed);
+
+ iter = parsed;
+ while (iter != NULL)
+ {
+ Package *req;
+ RequiredVersion *ver = iter->data;
+
+ req = get_package (ver->name);
+
+ if (req == NULL)
+ {
+ verbose_error ("Package '%s', required by '%s', not found\n",
+ ver->name, pkg->name ? pkg->name : path);
+
+ exit (1);
+ }
+
+ if (pkg->required_versions == NULL)
+ pkg->required_versions = g_hash_table_new (g_str_hash, g_str_equal);
+
+ g_hash_table_insert (pkg->required_versions, ver->name, ver);
+
+ pkg->requires_private = g_slist_prepend (pkg->requires_private, req);
+
+ iter = g_slist_next (iter);
+ }
+
+ g_slist_free (parsed);
+
+ pkg->requires_private = g_slist_reverse (pkg->requires_private);
+}
+
static void
parse_conflicts (Package *pkg, const char *str, const char *path)
{
parse_description (pkg, p, path);
else if (strcmp (tag, "Version") == 0)
parse_version (pkg, p, path);
+ else if (strcmp (tag, "Requires.private") == 0)
+ parse_requires_private (pkg, p, path);
else if (strcmp (tag, "Requires") == 0)
- {
+ {
if (ignore_requires == FALSE)
- parse_requires (pkg, p, path);
+ parse_requires (pkg, p, path);
else
goto cleanup;
}
path);
g_string_free (str, TRUE);
fclose(f);
+
+ /* make ->requires_private include a copy of the public requires too */
+ pkg->requires_private = g_slist_concat(pkg->requires_private,
+ g_slist_copy (pkg->requires));
+
return pkg;
}
return pkg->requires;
}
+static GSList *
+get_requires_private (Package *pkg)
+{
+ return pkg->requires_private;
+}
+
static int
pathposcmp (gconstpointer a, gconstpointer b)
{
static void
fill_list_single_package (Package *pkg, GetListFunc func,
- GSList **listp, gboolean in_path_order)
+ GSList **listp, gboolean in_path_order,
+ gboolean include_private)
{
/* First we get the list in natural/recursive order, then
* stable sort by path position
/* Get list of packages */
packages = NULL;
packages = g_slist_append (packages, pkg);
- recursive_fill_list (pkg, get_requires, &packages);
+ recursive_fill_list (pkg,
+ include_private ? get_requires_private : get_requires,
+ &packages);
if (in_path_order)
{
static void
fill_list (GSList *packages, GetListFunc func,
- GSList **listp, gboolean in_path_order)
+ GSList **listp, gboolean in_path_order, gboolean include_private)
{
GSList *tmp;
GSList *expanded;
while (tmp != NULL)
{
expanded = g_slist_append (expanded, tmp->data);
- recursive_fill_list (tmp->data, get_requires, &expanded);
+ recursive_fill_list (tmp->data,
+ include_private ? get_requires_private : get_requires,
+ &expanded);
tmp = tmp->next;
}
/* Make sure we have the right version for all requirements */
- iter = pkg->requires;
+ iter = pkg->requires_private;
while (iter != NULL)
{
* (inefficient algorithm, who cares)
*/
- recursive_fill_list (pkg, get_requires, &requires);
+ recursive_fill_list (pkg, get_requires_private, &requires);
recursive_fill_list (pkg, get_conflicts, &conflicts);
requires_iter = requires;
}
static char*
-get_merged (Package *pkg, GetListFunc func, gboolean in_path_order)
+get_merged (Package *pkg, GetListFunc func, gboolean in_path_order,
+ gboolean include_private)
{
GSList *list;
GSList *dups_list = NULL;
char *retval;
- fill_list_single_package (pkg, func, &dups_list, in_path_order);
+ fill_list_single_package (pkg, func, &dups_list, in_path_order,
+ include_private);
list = string_list_strip_duplicates (dups_list);
}
static char*
-get_merged_from_back (Package *pkg, GetListFunc func, gboolean in_path_order)
+get_merged_from_back (Package *pkg, GetListFunc func, gboolean in_path_order,
+ gboolean include_private)
{
GSList *list;
GSList *dups_list = NULL;
char *retval;
- fill_list_single_package (pkg, func, &dups_list, in_path_order);
+ fill_list_single_package (pkg, func, &dups_list, in_path_order,
+ include_private);
list = string_list_strip_duplicates_from_back (dups_list);
}
static char*
-get_multi_merged (GSList *pkgs, GetListFunc func, gboolean in_path_order)
+get_multi_merged (GSList *pkgs, GetListFunc func, gboolean in_path_order,
+ gboolean include_private)
{
GSList *tmp;
GSList *dups_list = NULL;
GSList *list;
char *retval;
- fill_list (pkgs, func, &dups_list, in_path_order);
+ fill_list (pkgs, func, &dups_list, in_path_order, include_private);
list = string_list_strip_duplicates (dups_list);
}
static char*
-get_multi_merged_from_back (GSList *pkgs, GetListFunc func, gboolean in_path_order)
+get_multi_merged_from_back (GSList *pkgs, GetListFunc func,
+ gboolean in_path_order, gboolean include_private)
{
GSList *tmp;
GSList *dups_list = NULL;
GSList *list;
char *retval;
- fill_list (pkgs, func, &dups_list, in_path_order);
+ fill_list (pkgs, func, &dups_list, in_path_order, include_private);
list = string_list_strip_duplicates_from_back (dups_list);
* order, so static linking works.
*/
if (pkg->l_libs_merged == NULL)
- pkg->l_libs_merged = get_merged_from_back (pkg, get_l_libs, FALSE);
+ pkg->l_libs_merged = get_merged_from_back (pkg, get_l_libs, FALSE,
+ !ignore_private_libs);
return pkg->l_libs_merged;
}
char *
packages_get_l_libs (GSList *pkgs)
{
- return get_multi_merged_from_back (pkgs, get_l_libs, FALSE);
+ return get_multi_merged_from_back (pkgs, get_l_libs, FALSE,
+ !ignore_private_libs);
}
char *
{
/* We want these in search path order so the -L flags don't override PKG_CONFIG_PATH */
if (pkg->L_libs_merged == NULL)
- pkg->L_libs_merged = get_merged (pkg, get_L_libs, TRUE);
+ pkg->L_libs_merged = get_merged (pkg, get_L_libs, TRUE,
+ !ignore_private_libs);
return pkg->L_libs_merged;
}
char *
packages_get_L_libs (GSList *pkgs)
{
- return get_multi_merged (pkgs, get_L_libs, TRUE);
+ return get_multi_merged (pkgs, get_L_libs, TRUE, !ignore_private_libs);
}
char *
package_get_other_libs (Package *pkg)
{
if (pkg->other_libs_merged == NULL)
- pkg->other_libs_merged = get_merged (pkg, get_other_libs, TRUE);
+ pkg->other_libs_merged = get_merged (pkg, get_other_libs, TRUE,
+ !ignore_private_libs);
return pkg->other_libs_merged;
}
char *
packages_get_other_libs (GSList *pkgs)
{
- return get_multi_merged (pkgs, get_other_libs, TRUE);
+ return get_multi_merged (pkgs, get_other_libs, TRUE, !ignore_private_libs);
}
char *
{
/* sort by path position so PKG_CONFIG_PATH affects -I flag order */
if (pkg->I_cflags_merged == NULL)
- pkg->I_cflags_merged = get_merged (pkg, get_I_cflags, TRUE);
+ pkg->I_cflags_merged = get_merged (pkg, get_I_cflags, TRUE, FALSE);
return pkg->I_cflags_merged;
}
packages_get_I_cflags (GSList *pkgs)
{
/* sort by path position so PKG_CONFIG_PATH affects -I flag order */
- return get_multi_merged (pkgs, get_I_cflags, TRUE);
+ return get_multi_merged (pkgs, get_I_cflags, TRUE, FALSE);
}
char *
package_get_other_cflags (Package *pkg)
{
if (pkg->other_cflags_merged == NULL)
- pkg->other_cflags_merged = get_merged (pkg, get_other_cflags, TRUE);
+ pkg->other_cflags_merged = get_merged (pkg, get_other_cflags, TRUE, FALSE);
return pkg->other_cflags_merged;
}
char *
packages_get_other_cflags (GSList *pkgs)
{
- return get_multi_merged (pkgs, get_other_cflags, TRUE);
+ return get_multi_merged (pkgs, get_other_cflags, TRUE, FALSE);
}
char *