* The patch for proper Requires.private processing is still necessary,

unfortunately.  For instance, libxcb's xcb.pc declares:

    Requires.private: pthread-stubs ...

  Thus libxcb has to declare the pthread-stubs package as a
  propagatedBuildInput, otherwise packages that check for libxcb using
  pkg-config (such as libX11) will fail.  But then we get a totally
  unnecessary additional runtime dependency, which is clearly a bad
  thing.

svn path=/nixpkgs/branches/stdenv-updates/; revision=13058
This commit is contained in:
Eelco Dolstra 2008-10-13 12:51:04 +00:00
parent a2b9febb42
commit 1e6622f4d5
2 changed files with 230 additions and 0 deletions

View File

@ -10,6 +10,12 @@ stdenv.mkDerivation rec {
sha256 = "0lrvk17724mc2nzpaa0vwybarrl50r7qdnr4h6jijm50srrf1808";
};
patches = [
# Process Requires.private properly, see
# http://bugs.freedesktop.org/show_bug.cgi?id=4738.
./requires-private.patch
];
meta = {
description = "A tool that allows packages to find out information about other packages";
homepage = http://pkg-config.freedesktop.org/wiki/;

View File

@ -0,0 +1,224 @@
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-13 14:41:42.000000000 +0200
***************
*** 431,436 ****
--- 431,457 ----
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 cflags or static libs wanted */
+ if (want_cflags ||
+ want_I_cflags ||
+ want_other_cflags ||
+ 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;