Updated package list to match new versions / new packages.
[beastbuild.git] / ccache-win32-20090430.diff
1 diff -u ../orig/ccache-win32-20090430/ccache.c ccache-win32-20090430/ccache.c
2 --- ../orig/ccache-win32-20090430/ccache.c      Thu Apr 30 14:09:34 2009
3 +++ ccache-win32-20090430/ccache.c      Sun May 10 07:33:30 2009
4 @@ -121,11 +121,15 @@
5                 }
6                 args_add_prefix(orig_args, p);
7         }
8 -
9 +#ifdef _WIN32
10 +       int rc = execute (orig_args->argv, NULL, NULL);
11 +       exit (rc);
12 +#else
13         execv(orig_args->argv[0], orig_args->argv);
14         cc_log("execv returned (%s)!\n", strerror(errno));
15         perror(orig_args->argv[0]);
16         exit(1);
17 +#endif
18  }
19  
20  
21 diff -u ../orig/ccache-win32-20090430/execute.c ccache-win32-20090430/execute.c
22 --- ../orig/ccache-win32-20090430/execute.c     Thu Apr 30 14:09:34 2009
23 +++ ccache-win32-20090430/execute.c     Sun May 10 08:08:50 2009
24 @@ -22,10 +22,10 @@
25  static char *argvtos(char **argv)
26  {
27         int i, len;
28 -       char *ptr, *str;
29 +       char *ptr, *str, *aptr;
30  
31         for (i = 0, len = 0; argv[i]; i++) {
32 -               len += strlen(argv[i]) + 3;
33 +               len += 2 * strlen(argv[i]) + 3; /* upper bound: each character escaped */
34         }
35  
36         str = ptr = (char *)malloc(len + 1);
37 @@ -33,10 +33,13 @@
38                 return NULL;
39  
40         for (i = 0; argv[i]; i++) {
41 -               len = strlen(argv[i]);
42                 *ptr++ = '"';
43 -               memcpy(ptr, argv[i], len);
44 -               ptr += len;
45 +               for (aptr = argv[i]; *aptr; aptr++)
46 +               {
47 +                       if (*aptr == '"')
48 +                           *ptr++ = '\\';
49 +                       *ptr++ = *aptr;
50 +               }
51                 *ptr++ = '"';
52                 *ptr++ = ' ';
53         }
54 @@ -61,28 +64,36 @@
55         DWORD exitcode;
56         char *args;
57         HANDLE fd_out, fd_err;
58 -       SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
59  
60 -       fd_out = CreateFile(path_stdout, GENERIC_WRITE, 0, &sa, CREATE_ALWAYS,
61 -                            FILE_ATTRIBUTE_NORMAL, NULL);
62 -       if (fd_out == INVALID_HANDLE_VALUE) {
63 -               return STATUS_NOCACHE;
64 -       }
65 +       if (path_stdout && path_stderr)
66 +       {
67 +               SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
68 +
69 +               fd_out = CreateFile(path_stdout, GENERIC_WRITE, 0, &sa, CREATE_ALWAYS,
70 +                                   FILE_ATTRIBUTE_NORMAL, NULL);
71 +               if (fd_out == INVALID_HANDLE_VALUE) {
72 +                       return STATUS_NOCACHE;
73 +               }
74  
75 -       fd_err = CreateFile(path_stderr, GENERIC_WRITE, 0, &sa, CREATE_ALWAYS,
76 -                            FILE_ATTRIBUTE_NORMAL, NULL);
77 -       if (fd_err == INVALID_HANDLE_VALUE) {
78 -               return STATUS_NOCACHE;
79 +               fd_err = CreateFile(path_stderr, GENERIC_WRITE, 0, &sa, CREATE_ALWAYS,
80 +                                   FILE_ATTRIBUTE_NORMAL, NULL);
81 +               if (fd_err == INVALID_HANDLE_VALUE) {
82 +                       return STATUS_NOCACHE;
83 +               }
84         }
85     
86         ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION));
87         ZeroMemory(&sinfo, sizeof(STARTUPINFO));
88  
89         sinfo.cb = sizeof(STARTUPINFO); 
90 -       sinfo.hStdError = fd_err;
91 -       sinfo.hStdOutput = fd_out;
92 -       sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
93 -       sinfo.dwFlags |= STARTF_USESTDHANDLES;
94 +
95 +       if (path_stdout && path_stderr)
96 +       {
97 +               sinfo.hStdError = fd_err;
98 +               sinfo.hStdOutput = fd_out;
99 +               sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
100 +               sinfo.dwFlags |= STARTF_USESTDHANDLES;
101 +       }
102   
103         args = argvtos(argv);
104  
105 @@ -90,8 +101,12 @@
106                              &sinfo, &pinfo);
107  
108         free(args);
109 -       CloseHandle(fd_out);
110 -       CloseHandle(fd_err);
111 +
112 +       if (path_stdout && path_stderr)
113 +       {
114 +               CloseHandle(fd_out);
115 +               CloseHandle(fd_err);
116 +       }
117  
118         if (ret == 0)
119                 return -1;
120 diff -u ../orig/ccache-win32-20090430/util.c ccache-win32-20090430/util.c
121 --- ../orig/ccache-win32-20090430/util.c        Thu Apr 30 14:09:34 2009
122 +++ ccache-win32-20090430/util.c        Sun May 10 07:29:43 2009
123 @@ -285,12 +285,13 @@
124  /* return the dir name of a file - caller frees */
125  char *dirname(char *s)
126  {
127 -       char *p;
128 +       char *p, *delim;
129         s = x_strdup(s);
130 -       p = strrchr(s, '/');
131 -       p = strrchr(s, '\\');
132 -       if (p) {
133 -               *p = 0;
134 +       for (p = s; *p; p++)
135 +           if (*p == '/' || *p == '\\')
136 +               delim = p;
137 +       if (delim) {
138 +               *delim = 0;
139         } 
140         return s;
141  }