summaryrefslogtreecommitdiff
path: root/devel/pkg-config/patches/patch-ab
blob: 9cb98603ffd9864c43b5a71e60956629ce8b1484 (plain)
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
$NetBSD: patch-ab,v 1.3 2005/10/22 12:59:14 wiz Exp $

The static variables are needed because they are used in a struct
initializer. The IRIX/mipseb C compiler needs those addresses to be
constant.

Log all pkg-config calls to a file.  Used by pkgtools/verifypc.

--- main.c.orig	2005-10-22 14:48:50.000000000 +0200
+++ main.c
@@ -172,27 +172,27 @@ pkg_uninstalled (Package *pkg)
 int
 main (int argc, char **argv)
 {
-  int want_my_version = 0;
-  int want_version = 0;
-  int want_libs = 0;
-  int want_cflags = 0;
-  int want_l_libs = 0;
-  int want_L_libs = 0;
-  int want_other_libs = 0;
-  int want_I_cflags = 0;
-  int want_other_cflags = 0;
-  int want_list = 0;
-  int want_static_lib_list = ENABLE_INDIRECT_DEPS;
-  int want_short_errors = 0;
+  static int want_my_version = 0;
+  static int want_version = 0;
+  static int want_libs = 0;
+  static int want_cflags = 0;
+  static int want_l_libs = 0;
+  static int want_L_libs = 0;
+  static int want_other_libs = 0;
+  static int want_I_cflags = 0;
+  static int want_other_cflags = 0;
+  static int want_list = 0;
+  static int want_static_lib_list = ENABLE_INDIRECT_DEPS;
+  static int want_short_errors = 0;
   int result;
-  int want_uninstalled = 0;
-  char *variable_name = NULL;
-  int want_exists = 0;
-  char *required_atleast_version = NULL;
-  char *required_exact_version = NULL;
-  char *required_max_version = NULL;
-  char *required_pkgconfig_version = NULL;
-  int want_silence_errors = 0;
+  static int want_uninstalled = 0;
+  static char *variable_name = NULL;
+  static int want_exists = 0;
+  static char *required_atleast_version = NULL;
+  static char *required_exact_version = NULL;
+  static char *required_max_version = NULL;
+  static char *required_pkgconfig_version = NULL;
+  static int want_silence_errors = 0;
   GString *str;
   GSList *packages = NULL;
   char *search_path;
@@ -462,12 +462,27 @@ main (int argc, char **argv)
     gboolean failed = FALSE;
     GSList *reqs;
     GSList *iter;
+    char *log_name;
+    FILE *log;
 
     reqs = parse_module_list (NULL, str->str,
                               "(command line arguments)");
 
     iter = reqs;
 
+    log_name = getenv ("PKG_CONFIG_LOG");
+    if (log_name != NULL)
+      {
+        log = fopen (getenv ("PKG_CONFIG_LOG"), "a");
+        if (log == NULL)
+          {
+            fprintf (stderr, "Cannot open log file: %s\n", log_name);
+            exit (1);
+          }
+      }
+    else
+      log = NULL;
+
     while (iter != NULL)
       {
         Package *req;
@@ -478,6 +493,18 @@ main (int argc, char **argv)
         else
           req = get_package (ver->name);
 
+        if (log != NULL)
+          {
+            if (req == NULL)
+              fprintf (log, "%s NOT-FOUND", ver->name);
+            else
+              fprintf (log, "%s %s %s", ver->name,
+                       comparison_to_str (ver->comparison),
+                       (ver->version == NULL) ? "(null)" : ver->version);
+
+            fprintf (log, "\n");
+          }
+
         if (req == NULL)
           {
             failed = TRUE;
@@ -508,6 +535,11 @@ main (int argc, char **argv)
         iter = g_slist_next (iter);
       }
 
+    if (log != NULL)
+      {
+        fclose (log);
+      }
+
     if (failed) {
       return 1;
     }