summaryrefslogtreecommitdiff
path: root/recipes/dietlibc/files/ccache.patch
blob: 839b5b99a06c0da3816822cab575838dc4b50cd6 (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
Index: dietlibc-0.31/diet.c
===================================================================
--- dietlibc-0.31.orig/diet.c	2006-08-27 15:49:00.000000000 +0200
+++ dietlibc-0.31/diet.c	2009-01-31 22:56:06.828080683 +0100
@@ -127,7 +127,12 @@
     }
   }
   {
-    char *cc=argv[1];
+    char *cc;
+    if (!strcmp(argv[1],"ccache")) {
+	cc=argv[2];
+    } else {
+   	cc=argv[1];
+    }
     char *tmp=strchr(cc,0)-2;
     char *tmp2,*tmp3;
     if (tmp<cc) goto donttouch;
@@ -139,7 +144,7 @@
       if (tmp3<tmp2) tmp2=tmp3;
       if (tmp2-cc>90) error("platform name too long!\n");
       shortplatform=platform+len;
-      memmove(shortplatform,argv[1],(size_t)(tmp2-cc));
+      memmove(shortplatform,cc,(size_t)(tmp2-cc));
       platform[tmp2-cc+len]=0;
       if (shortplatform[0]=='i' && shortplatform[2]=='8' && shortplatform[3]=='6') shortplatform[1]='3';
     } else {
@@ -285,6 +290,9 @@

       dest=newargv;
       *dest++=argv[1];
+      if (strcmp(argv[1],"ccache") == 0) {
+	 *dest++=argv[2];
+      }
       if (argv[2]) {
 	if (!strcmp(argv[2],"-V")) {
 	  *dest++=argv[2];
@@ -294,9 +302,9 @@
 	} else if (!memcmp(argv[2],"-V",2)) {
 	  *dest++=argv[2];
 	  ++argv;
-	  --argc;
 	}
       }
+
 #ifndef __DYN_LIB
       if (_link) { *dest++=(char*)nostdlib; *dest++=dashstatic; *dest++=dashL; }
 #else
@@ -314,7 +322,15 @@
 #ifdef WANT_DYNAMIC
       if (_link) { *dest++=d; }
 #endif
-      for (i=2; i<argc; ++i) {
+      if (strcmp(argv[1],"ccache") == 0) {
+         i=3;
+      } else {
+         i=2;
+      }
+      for (i; i<argc; ++i) {
+        if (strstr(argv[i],"isystem") != NULL) {
+		continue;
+	}
 	if (mangleopts)
 	  if (argv[i][0]=='-' && (argv[i][1]=='O' || argv[i][1]=='f' ||
 				  (argv[i][1]=='m' && argv[i][2]!='3' && argv[i][2]!='6'))) {
@@ -322,6 +338,8 @@
 	      continue;
 	  }
 	*dest++=argv[i];
+	*dest--;
+	*dest++;
       }
 #ifndef __DYN_LIB
       if (compile || _link) {