head 1.1; access; symbols; locks; strict; comment @# @; 1.1 date 2007.06.30.08.30.35; author rse; state Exp; branches; next ; commitid FwVwhB63qiWnEUns; desc @@ 1.1 log @apply patches from upstream vendor CVS @ text @Index: Makefile.in --- Makefile.in.orig 2004-09-13 12:38:30 +0200 +++ Makefile.in 2007-06-30 10:27:56 +0200 @@@@ -8,7 +8,9 @@@@ INSTALLCMD=@@INSTALL@@ CC=@@CC@@ -CFLAGS=@@CFLAGS@@ -I. +CPPFLAGS=@@CPPFLAGS@@ -I. +CFLAGS=$(CPPFLAGS) @@CFLAGS@@ +LDFLAGS=@@LDFLAGS@@ EXEEXT=@@EXEEXT@@ OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \ @@@@ -20,7 +22,7 @@@@ docs: ccache.1 web/ccache-man.html ccache$(EXEEXT): $(OBJS) $(HEADERS) - $(CC) $(CFLAGS) -o $@@ $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@@ $(OBJS) ccache.1: ccache.yo -yodl2man -o ccache.1 ccache.yo Index: ccache.1 --- ccache.1.orig 2004-09-13 12:38:30 +0200 +++ ccache.1 2007-06-30 10:27:56 +0200 @@@@ -234,6 +234,16 @@@@ incorrect setting of this debug info rarely causes problems\&. If you strike problems with gdb not using the correct directory then enable this option\&. +.IP +.IP "\fBCCACHE_NOHASH_SIZE_MTIME\fP" +This tells ccache to not hash the real compiler's size and modification +time. Normally this is the mechanism to detect compiler upgrades. +There are situations however, where even though the compiler's size or +modification time has changed you can safely use the cached objects +(e.g. if as part of your build system the compiler is built as well +and the compiler's source has not changed; or if the compiler has only +changes that do not affect code generation). Use this feature only if +you know what you are doing. .IP .IP "\fBCCACHE_UNIFY\fP" If you set the environment variable CCACHE_UNIFY Index: ccache.c --- ccache.c.orig 2004-09-13 12:38:30 +0200 +++ ccache.c 2007-06-30 10:27:56 +0200 @@@@ -158,9 +158,9 @@@@ struct stat st1, st2; int status; - x_asprintf(&tmp_stdout, "%s/tmp.stdout.%s", temp_dir, tmp_string()); - x_asprintf(&tmp_stderr, "%s/tmp.stderr.%s", temp_dir, tmp_string()); - x_asprintf(&tmp_hashname, "%s/tmp.hash.%s.o", temp_dir, tmp_string()); + x_asprintf(&tmp_stdout, "%s.tmp.stdout.%s", hashname, tmp_string()); + x_asprintf(&tmp_stderr, "%s.tmp.stderr.%s", hashname, tmp_string()); + x_asprintf(&tmp_hashname, "%s.tmp.%s", hashname, tmp_string()); args_add(args, "-o"); args_add(args, tmp_hashname); @@@@ -331,8 +331,12 @@@@ hash_string(str_basename(args->argv[0])); } - hash_int(st.st_size); - hash_int(st.st_mtime); + if (getenv("CCACHE_HASH_COMPILER")) { + hash_file(args->argv[0]); + } else if (!getenv("CCACHE_NOHASH_SIZE_MTIME")) { + hash_int(st.st_size); + hash_int(st.st_mtime); + } /* possibly hash the current working directory */ if (getenv("CCACHE_HASHDIR")) { @@@@ -640,6 +644,8 @@@@ /* these are too hard */ if (strcmp(argv[i], "-fbranch-probabilities")==0 || + strcmp(argv[i], "-coverage") == 0 || + strcmp(argv[i], "-ftest-coverage") == 0 || strcmp(argv[i], "-M") == 0 || strcmp(argv[i], "-MM") == 0 || strcmp(argv[i], "-x") == 0) { Index: ccache.h --- ccache.h.orig 2004-09-13 12:38:30 +0200 +++ ccache.h 2007-06-30 10:27:56 +0200 @@@@ -6,11 +6,10 @@@@ #include #include #include -#include #include +#include #include #include -#include #include #include #include @@@@ -19,6 +18,7 @@@@ #include #include #include +#include #ifdef HAVE_PWD_H #include #endif Index: cleanup.c --- cleanup.c.orig 2003-09-28 06:48:17 +0200 +++ cleanup.c 2007-06-30 10:27:56 +0200 @@@@ -57,6 +57,17 @@@@ free(p); return; } + + if (strstr(fname, ".tmp.") != NULL) { + /* delete any tmp files older than 1 hour */ + if (st->st_mtime + 3600 < time(NULL)) { + unlink(fname); + free(p); + return; + } + } + + free(p); if (num_files == allocated) { Index: config.h.in --- config.h.in.orig 2003-09-28 06:48:17 +0200 +++ config.h.in 2007-06-30 10:27:56 +0200 @@@@ -19,6 +19,9 @@@@ /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@@@ -31,6 +34,9 @@@@ /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH @@@@ -98,3 +104,8 @@@@ /* Define _GNU_SOURCE so that we get all necessary prototypes */ #undef _GNU_SOURCE + +/* Define on UNIX to activate XPG/5 features. */ +#if !defined(_XOPEN_SOURCE) +# define _XOPEN_SOURCE +#endif Index: util.c --- util.c.orig 2004-09-13 12:38:30 +0200 +++ util.c 2007-06-30 10:27:56 +0200 @@@@ -151,7 +151,7 @@@@ vasprintf(ptr, format, ap); va_end(ap); - if (!ptr) fatal("out of memory in x_asprintf"); + if (!*ptr) fatal("out of memory in x_asprintf"); } /* @@@@ -187,14 +187,10 @@@@ { void *p2; if (!ptr) return x_malloc(size); - p2 = malloc(size); + p2 = realloc(ptr, size); if (!p2) { fatal("out of memory in x_realloc"); } - if (ptr) { - memcpy(p2, ptr, size); - free(ptr); - } return p2; } @@@@ -448,7 +444,7 @@@@ } } #endif - fatal("Unable to determine home directory"); + fprintf(stderr, "ccache: Unable to determine home directory"); return NULL; } @