about summary refs log tree commit diff
path: root/pkgs/development/tools/misc/pkgconfig/private.patch
blob: 4eb6555b4c988085b95fbebee0a9887c64883dc0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
=== modified file 'main.c'
--- main.c	2006-08-16 17:57:14 +0000
+++ main.c	2007-12-18 23:40:46 +0000
@@ -420,6 +420,27 @@
   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);

=== modified file 'parse.c'
--- parse.c	2007-05-30 11:24:42 +0000
+++ parse.c	2007-12-18 23:40:46 +0000
@@ -913,7 +913,9 @@
 #endif
 
 static void
-parse_line (Package *pkg, const char *untrimmed, const char *path, gboolean ignore_requires, gboolean ignore_private_libs)
+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,15 +958,12 @@
         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, "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,7 +1066,9 @@
 }
 
 Package*
-parse_package_file (const char *path, gboolean ignore_requires, gboolean ignore_private_libs)
+parse_package_file (const char *path, gboolean ignore_requires,
+                    gboolean ignore_requires_private,
+                    gboolean ignore_private_libs)
 {
   FILE *f;
   Package *pkg;
@@ -1104,7 +1105,8 @@
     {
       one_line = TRUE;
       
-      parse_line (pkg, str->str, path, ignore_requires, ignore_private_libs);
+      parse_line (pkg, str->str, path, ignore_requires,
+                  ignore_requires_private, ignore_private_libs);
 
       g_string_truncate (str, 0);
     }

=== modified file 'parse.h'
--- parse.h	2005-07-14 13:07:18 +0000
+++ parse.h	2007-12-18 23:40:46 +0000
@@ -23,6 +23,7 @@
 #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);

=== modified file 'pkg.c'
--- pkg.c	2007-06-18 21:19:27 +0000
+++ pkg.c	2007-12-18 23:40:46 +0000
@@ -55,6 +55,7 @@
 
 gboolean disable_uninstalled = FALSE;
 gboolean ignore_requires = FALSE;
+gboolean ignore_requires_private = FALSE;
 gboolean ignore_private_libs = TRUE;
 
 static Package pkg_config_package = {
@@ -349,7 +350,8 @@
     }
 
   debug_spew ("Reading '%s' from file '%s'\n", name, location);
-  pkg = parse_package_file (location, ignore_requires, ignore_private_libs);
+  pkg = parse_package_file (location, ignore_requires, ignore_requires_private,
+                            ignore_private_libs);
   
   if (pkg == NULL)
     {
@@ -1503,6 +1505,7 @@
   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));
@@ -1519,3 +1522,27 @@
 {
   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;
+}

=== modified file 'pkg.h'
--- pkg.h	2005-10-16 17:31:41 +0000
+++ pkg.h	2007-12-18 23:40:46 +0000
@@ -120,6 +120,12 @@
 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;