nixpkgs/pkgs/development/tools/misc/pkgconfig/requires-private.patch
Eelco Dolstra 5bc2dc536d * `pkg-config --cflags': ignore Requires.private (just like --libs).
Whether this is correct is debatable (especially since there is no
  formal semantics for Requires.private), but not ignoring it breaks
  some packages (like Pango's dependency on Cairo).

svn path=/nixpkgs/branches/stdenv-updates/; revision=13060
2008-10-14 12:06:36 +00:00

222 lines
6.1 KiB
Diff

diff -rc pkg-config-0.23-orig/main.c pkg-config-0.23/main.c
*** pkg-config-0.23-orig/main.c 2008-01-16 23:06:48.000000000 +0100
--- pkg-config-0.23/main.c 2008-10-14 13:04:04.000000000 +0200
***************
*** 431,436 ****
--- 431,454 ----
else
disable_private_libs();
+ /* Only process Requires field if cflags or libs wanted */
+ if (want_libs ||
+ want_cflags ||
+ want_l_libs ||
+ want_L_libs ||
+ want_other_libs ||
+ want_I_cflags ||
+ want_other_cflags)
+ enable_requires();
+ else
+ disable_requires();
+
+ /* Only process Requires.private if static libs wanted */
+ if (want_static_lib_list)
+ enable_requires_private();
+ else
+ disable_requires_private();
+
if (want_my_version)
{
printf ("%s\n", VERSION);
diff -rc pkg-config-0.23-orig/parse.c pkg-config-0.23/parse.c
*** pkg-config-0.23-orig/parse.c 2008-01-16 21:42:49.000000000 +0100
--- pkg-config-0.23/parse.c 2008-10-13 14:41:42.000000000 +0200
***************
*** 913,919 ****
#endif
static void
! parse_line (Package *pkg, const char *untrimmed, const char *path, gboolean ignore_requires, gboolean ignore_private_libs)
{
char *str;
char *p;
--- 913,921 ----
#endif
static void
! parse_line (Package *pkg, const char *untrimmed, const char *path,
! gboolean ignore_requires, gboolean ignore_requires_private,
! gboolean ignore_private_libs)
{
char *str;
char *p;
***************
*** 956,970 ****
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);
! else
! goto cleanup;
! }
else if ((strcmp (tag, "Libs.private") == 0) &&
ignore_private_libs == FALSE)
parse_libs_private (pkg, p, path);
--- 958,969 ----
parse_description (pkg, p, path);
else if (strcmp (tag, "Version") == 0)
parse_version (pkg, p, path);
! else if ((strcmp (tag, "Requires.private") == 0) &&
! ignore_requires_private == FALSE)
! parse_requires_private (pkg, p, path);
! else if ((strcmp (tag, "Requires") == 0) &&
! ignore_requires == FALSE)
! parse_requires (pkg, p, path);
else if ((strcmp (tag, "Libs.private") == 0) &&
ignore_private_libs == FALSE)
parse_libs_private (pkg, p, path);
***************
*** 1067,1073 ****
}
Package*
! parse_package_file (const char *path, gboolean ignore_requires, gboolean ignore_private_libs)
{
FILE *f;
Package *pkg;
--- 1066,1074 ----
}
Package*
! parse_package_file (const char *path, gboolean ignore_requires,
! gboolean ignore_requires_private,
! gboolean ignore_private_libs)
{
FILE *f;
Package *pkg;
***************
*** 1104,1110 ****
{
one_line = TRUE;
! parse_line (pkg, str->str, path, ignore_requires, ignore_private_libs);
g_string_truncate (str, 0);
}
--- 1105,1112 ----
{
one_line = TRUE;
! parse_line (pkg, str->str, path, ignore_requires,
! ignore_requires_private, ignore_private_libs);
g_string_truncate (str, 0);
}
diff -rc pkg-config-0.23-orig/parse.h pkg-config-0.23/parse.h
*** pkg-config-0.23-orig/parse.h 2008-01-16 21:42:49.000000000 +0100
--- pkg-config-0.23/parse.h 2008-10-13 14:41:42.000000000 +0200
***************
*** 23,28 ****
--- 23,29 ----
#include "pkg.h"
Package *parse_package_file (const char *path, gboolean ignore_requires,
+ gboolean ignore_requires_private,
gboolean ignore_private_libs);
Package *get_compat_package (const char *name);
diff -rc pkg-config-0.23-orig/pkg.c pkg-config-0.23/pkg.c
*** pkg-config-0.23-orig/pkg.c 2008-01-16 22:59:49.000000000 +0100
--- pkg-config-0.23/pkg.c 2008-10-13 14:41:42.000000000 +0200
***************
*** 55,60 ****
--- 55,61 ----
gboolean disable_uninstalled = FALSE;
gboolean ignore_requires = FALSE;
+ gboolean ignore_requires_private = FALSE;
gboolean ignore_private_libs = TRUE;
void
***************
*** 337,343 ****
}
debug_spew ("Reading '%s' from file '%s'\n", name, location);
! pkg = parse_package_file (location, ignore_requires, ignore_private_libs);
if (pkg == NULL)
{
--- 338,345 ----
}
debug_spew ("Reading '%s' from file '%s'\n", name, location);
! pkg = parse_package_file (location, ignore_requires, ignore_requires_private,
! ignore_private_libs);
if (pkg == NULL)
{
***************
*** 1506,1511 ****
--- 1508,1514 ----
int mlen = 0;
ignore_requires = TRUE;
+ ignore_requires_private = TRUE;
g_hash_table_foreach (locations, max_len_foreach, &mlen);
g_hash_table_foreach (locations, packages_foreach, GINT_TO_POINTER (mlen + 1));
***************
*** 1522,1524 ****
--- 1525,1551 ----
{
ignore_private_libs = TRUE;
}
+
+ void
+ enable_requires(void)
+ {
+ ignore_requires = FALSE;
+ }
+
+ void
+ disable_requires(void)
+ {
+ ignore_requires = TRUE;
+ }
+
+ void
+ enable_requires_private(void)
+ {
+ ignore_requires_private = FALSE;
+ }
+
+ void
+ disable_requires_private(void)
+ {
+ ignore_requires_private = TRUE;
+ }
diff -rc pkg-config-0.23-orig/pkg.h pkg-config-0.23/pkg.h
*** pkg-config-0.23-orig/pkg.h 2008-01-16 22:27:19.000000000 +0100
--- pkg-config-0.23/pkg.h 2008-10-13 14:41:42.000000000 +0200
***************
*** 120,125 ****
--- 120,131 ----
void enable_private_libs(void);
void disable_private_libs(void);
+ void enable_requires(void);
+ void disable_requires(void);
+
+ void enable_requires_private(void);
+ void disable_requires_private(void);
+
/* If TRUE, do not automatically prefer uninstalled versions */
extern gboolean disable_uninstalled;