summaryrefslogtreecommitdiff
path: root/devel/ccache/patches/patch-ab
blob: 6c8f6b24d2823bbc08a1a2b30dfc7642d63a581e (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
$NetBSD: patch-ab,v 1.2 2004/10/14 02:39:19 xtraeme Exp $

--- ccache.c.orig	2004-09-13 12:38:30.000000000 +0200
+++ ccache.c	2004-10-14 03:04:59.000000000 +0200
@@ -255,6 +255,7 @@
 	int i;
 	char *path_stdout, *path_stderr;
 	char *hash_dir;
+	const char *hash_cc;
 	char *s;
 	struct stat st;
 	int status;
@@ -317,13 +318,22 @@
 		hash_string(args->argv[i]);
 	}
 
-	/* the compiler driver size and date. This is a simple minded way
-	   to try and detect compiler upgrades. It is not 100% reliable */
+	/* If CCACHE_HASHCC is defined, then hash that string, otherwise, hash
+	the compiler driver size and date. This is a simple minded way to
+	try and detect compiler upgrades. It is not 100% reliable */
+
+	hash_cc = getenv("CCACHE_HASHCC");
+	if (hash_cc) {
+		hash_string(hash_cc);
+	} else {
 	if (stat(args->argv[0], &st) != 0) {
 		cc_log("Couldn't stat the compiler!? (argv[0]='%s')\n", args->argv[0]);
 		stats_update(STATS_COMPILER);
 		failed();
 	}
+		hash_int(st.st_size);
+		hash_int(st.st_mtime);
+	}
 
 	/* also include the hash of the compiler name - as some compilers
 	   use hard links and behave differently depending on the real name */
@@ -331,9 +341,6 @@
 		hash_string(str_basename(args->argv[0]));
 	}
 
-	hash_int(st.st_size);
-	hash_int(st.st_mtime);
-
 	/* possibly hash the current working directory */
 	if (getenv("CCACHE_HASHDIR")) {
 		char *cwd = gnu_getcwd();