--- ccache-2.4.orig/debian/NEWS +++ ccache-2.4/debian/NEWS @@ -0,0 +1,22 @@ +ccache (2.4-8) unstable; urgency=high + + zlib compression is now enabled by default in order to increase the amount + of object files that can fit in the cache. + + The impact on performance is supposed to be almost negligible + (see http://www.gustaebel.de/lars/ccache/). If you do want to disable + it however, simply export the CCACHE_NOCOMPRESS environment variable. + + Note that a zlib-enabled ccache will still read your existing + uncompressed cache. If you want to compress/uncompress your cache, + see the manage-cache.sh script under /usr/share/doc/ccache/examples/. + + -- Francois Marier Sun, 20 May 2007 19:45:07 +1200 + +ccache (2.4-1) unstable; urgency=low + + * This release changes the hash input slighly, so you will probably find + that you will not get any hits against your existing cache when you + upgrade. + + -- Francois Marier Sat, 11 Jun 2005 13:54:33 -0400 --- ccache-2.4.orig/debian/README.Debian +++ ccache-2.4/debian/README.Debian @@ -0,0 +1,59 @@ +Installing ccache +----------------- + +The recommended way to use this with Debian is to either create "cc" +and "gcc" symlinks to /usr/bin/ccache in your private bin directory +(which must be before the real cc and gcc in your path), or use +CC="ccache gcc" on the make command line. + +Another option is to just prepend /usr/lib/ccache in your PATH +environment variable, like + + export PATH="/usr/lib/ccache:$PATH" + +Note that ccache works with both native and cross compilers. + +Ignoring whitespace +------------------- + +If you wish to set up ccache so that it ignores blank lines, have a +look at the CCACHE_UNIFY option. However, please note that this +option is off by default since the reported line numbers may not +match the source files anymore. + + +NFS Issues +---------- + +(from John Coiner on the ccache mailing list) + +When CCache creates a hardlinked output file, it calls utime() to update +the timestamp on the object, so that Make realizes that the object has +changed. + +On NFS, utime() has no coherency guarantee, AFAIK. When utime() runs on +host A, and our parallel implementation of Make is running on host B, +sometimes Make doesn't see the new timestamp soon enough -- and neglects +to relink the final binary. That's a one-way ticket to Silent Mysterious +Failure Town. + +Instead of relying on the object file timestamp, we create a dummy file +with a reliable timestamp: + +objs/foo.o objs/foo.o.built : + if ( ccache gcc -o foo.o -c foo.c ) ; \ + then touch objs/foo.o.built ; \ + else exit 1; \ + fi + +binary : objs/foo.o.built + gcc -o binary objs/foo.o + +NFS does make a coherency guarantee, that if a file is written and +close()d on host A, and subsequently open()ed on host B, that the second +open() will reflect all modifications and attributes from the close(). +Since Make does open() when checking timestamps, and the dummy file is +close()d when it's created, the binary will always relink after the +object is recompiled. + + -- Francois Marier Sun, 20 May 2007 17:35:36 +1200 --- ccache-2.4.orig/debian/changelog +++ ccache-2.4/debian/changelog @@ -0,0 +1,246 @@ +ccache (2.4-17) unstable; urgency=low + + [ Y Giridhar Appaji Nag ] + * New patch 15_gcc4.3_warnings to fix gcc 4.3 warnings. Thanks + William S Fulton for the bug report and + the patch (Closes: #508046) + * Refresh all patches to be "git diff" based and to apply cleanly. + * Update Standards-Version to 3.8.1 (no changes required) + + [ Francois Marier ] + * Make Y Giridhar Appaji Nag the maintainer and + add myself as uploader + + -- Y Giridhar Appaji Nag Sun, 22 Mar 2009 22:08:01 +0530 + +ccache (2.4-16) unstable; urgency=low + + * Fix the documentation references to CCACHE_HARDLINK (patch from Fedora) + * Add a patch for the HTML docs in the source (from Fedora) + * Remove reference to compilercache in the description (closes: #498006) + * Bump Standards-Version to 3.8.0 (no changes) + * Move packaging to git and update VCS fields + + -- Francois Marier Sat, 29 Nov 2008 23:53:39 +1300 + +ccache (2.4-15) unstable; urgency=low + + * Add a new patch which improve the consistency of timestamps on cached + objects to make sure clean-up is based on least recently used objects. + * Patch the set_limit call so that non-writable cache directories return + an error when attempting to size the max(files|size) (closes: #332527) + + -- Francois Marier Sun, 13 Apr 2008 15:07:05 +1200 + +ccache (2.4-14) unstable; urgency=low + + * Mention the long options everywhere in the manpage + * Merge Gentoo patches: + - respect user's LDFLAGS + - use utimes() for timestamp if possible + + -- Francois Marier Sun, 23 Mar 2008 16:30:11 +1300 + +ccache (2.4-13) unstable; urgency=low + + * Update CACHEDIR.TAG patch to avoid creating the tag file when the + CCACHE_READONLY environment variable is set. (closes: #464356) + * Mention the GNU-style long options in the manpage + + -- Francois Marier Thu, 07 Feb 2008 10:50:42 +1300 + +ccache (2.4-12) unstable; urgency=low + + * Add symlink for gcc 4.3 (closes: #463590) + * Add support for the CACHEDIR.TAG spec, thanks to Karl Chen. + (see http://www.brynosaurus.com/cachedir/) + * Fix hyphens in manpage (lintian notice) + * Bump Standards-Version up to 3.7.3 (no changes) + * Bump debhelper compatibility to 6 + + -- Francois Marier Sat, 02 Feb 2008 10:37:22 +1300 + +ccache (2.4-11) unstable; urgency=low + + * Add the collab-maint repo to debian/control + + -- Francois Marier Tue, 20 Nov 2007 15:26:37 +1300 + +ccache (2.4-10) unstable; urgency=low + + * Document where the patches are from in debian/patches/CREDITS + * debian/rules: + - Fixed "make distclean" lintian warning + - Removed commented-out entries + * Set debhelper compatibility to 5 + * Add homepage field in debian/control + * Add symlinks for MinGW (closes: #445782) + * Bump the version to 5 in the debhelper dependency + + -- Francois Marier Fri, 19 Oct 2007 16:04:37 +1300 + +ccache (2.4-9) unstable; urgency=low + + * Add a symlink for gcc 4.2 (closes: #431007) + * Fix dependencies when using -o (closes: #217713) + + -- Francois Marier Sat, 30 Jun 2007 17:58:44 +1200 + +ccache (2.4-8) unstable; urgency=low + + * Enable zlib compression of the cache by default (closes: #409848). + Thanks to Sami Liedes for suggesting this. + * Disable ccache when profiling (closes: #215849). + Thanks to Ted Percival for the Patch. + * Fix NFS renaming issues and add instructions to the README. + Thanks to John Coiner and instructions. + * Put all patches in debian/patches and apply them at build time. + + -- Francois Marier Sun, 20 May 2007 19:42:34 +1200 + +ccache (2.4-7) unstable; urgency=low + + * Use the real compiler when HOME is not set (closes: #396350) + * Include user script under doc/examples (closes: #392435) + Thanks to Behan Webster! + * Add support for GNU --long options (closes: #297126) + + -- Francois Marier Sat, 18 Nov 2006 00:50:59 -0500 + +ccache (2.4-6) unstable; urgency=low + + * Include symlinks for gcc 4.1 (closes: #372838) + * Update watch file + + -- Francois Marier Tue, 13 Jun 2006 22:17:37 -0400 + +ccache (2.4-5) unstable; urgency=low + + * Document the fact that cross-compiling is supported (closes: #349221) + * Bump Standards-Version up to 3.7.2 (no changes) + + -- Francois Marier Sun, 4 Jun 2006 01:20:07 -0400 + +ccache (2.4-4) unstable; urgency=low + + * Mention another way to use ccache in README.Debian (thanks to Benjamin + Drieu for the suggestion) (closes: #267632) + * Update FSF address + * Fix watch file + + -- Francois Marier Sat, 26 Nov 2005 00:15:13 -0500 + +ccache (2.4-3) unstable; urgency=low + + * Actually use the configuration flags in debian/rules + * Bump Standards-Version up to 3.6.2 (no changes) + + -- Francois Marier Sun, 26 Jun 2005 13:33:19 -0400 + +ccache (2.4-2) unstable; urgency=low + + * Add gcc and g++ symlinks to /usr/lib/ccache (closes: #313490) + * Remove invalid entry from Depends + + -- Francois Marier Wed, 15 Jun 2005 20:51:03 -0400 + +ccache (2.4-1) unstable; urgency=low + + * New maintainer (closes: #312867) + * New upstream version: (closes: #273753, #239640) + - New CCACHE_READONLY and CCACHE_TEMPDIR options + - Fixed handling of hard-linked compilers on AIX + - Fixed handling of HOME environment variable (closes: #299880) + - Show cache directory in stats output + * Fix copyright file + * Add 'distcc' to Suggests (closes: #269158) + * Add a note about whitespace in README.Debian (closes: #229116) + * Update rules to add symmlinks for gcc 3.4 & 4.0 (closes: #261177) + * Acknowledge NMUs (closes: #200185, #177129, #174417) + + -- Francois Marier Sun, 12 Jun 2005 12:05:34 -0400 + +ccache (2.3-1.1) unstable; urgency=low + + * Non-maintainer upload during BSP + * Re-apply patch for + #200185 ccache: Incorrect symlinks in /usr/lib/ccache + (Closes: #200185) + + -- Frank Lichtenheld Fri, 19 Mar 2004 11:14:50 +0100 + +ccache (2.3-1) unstable; urgency=low + + * New upstream release: obsoletes existing caches. + * Tweak package description in arbitrary way (closes: #181721) + + -- Paul Russell Mon, 29 Sep 2003 02:53:20 +0200 + +ccache (2.2-2) unstable; urgency=low + + * Insert more symlinks in ccache dir (closes: #197468) + + -- Paul Russell Mon, 16 Jun 2003 10:52:50 +0100 + +ccache (2.2-1) unstable; urgency=low + + * New upstream release (closes: #150755) + * Insert more symlinks in ccache dir (closes: #144462) + + -- Paul Russell Mon, 17 Feb 2003 07:19:36 +0100 + +ccache (2.1.1-2) unstable; urgency=low + + * Restored /usr/lib/ccache symlinks (closes: #179393) + * Fixed manpage typo (closes: #179564) + * With thanks to Andreas Rottmann. + + -- Paul Russell Wed, 5 Feb 2003 10:01:10 +0100 + +ccache (2.1.1-1) unstable; urgency=low + + * NMU (with maintainer consent). + * New upstream release (closes: #174417, #177129). + * debian/control: + + Build-Depend on and use dephelper 4 (DH_COMPAT = 4). + + Bumped Standards-Version to 3.5.8. + + No full stop on short package description (fixes linda warning). + * debian/copright: + + Make lintian feel comfortable; fixes warnings: + - copyright-should-refer-to-common-license-file-for-gpl + - copyright-lists-upstream-authors-with-dh_make-boilerplate + * Built with g++ 3.2 :-). + + -- Andreas Rottmann Thu, 16 Jan 2003 11:42:38 +0100 + +ccache (1.9-1) unstable; urgency=low + + * New upstream release (closes: #144920) + + -- Paul Russell Mon, 13 May 2002 10:01:09 +0200 + +ccache (1.8-1) unstable; urgency=low + + * New upstream release (closes: #145401) + + -- Paul Russell Fri, 3 May 2002 02:26:32 +0200 + +ccache (1.7-1) unstable; urgency=low + + * New upstream release + * Install symlinks in /usr/lib/ccache (closes: #141337) + + -- Paul Russell Wed, 10 Apr 2002 17:51:21 +0200 + +ccache (1.4-1) unstable; urgency=low + + * New upstream release + + -- Paul Russell Wed, 3 Apr 2002 03:41:46 +0200 + +ccache (1.2-1) unstable; urgency=low + + * Initial Release. + + -- Paul Russell Sun, 31 Mar 2002 14:08:57 +0200 + --- ccache-2.4.orig/debian/compat +++ ccache-2.4/debian/compat @@ -0,0 +1 @@ +6 --- ccache-2.4.orig/debian/control +++ ccache-2.4/debian/control @@ -0,0 +1,19 @@ +Source: ccache +Section: devel +Priority: optional +Maintainer: Y Giridhar Appaji Nag +Uploaders: Francois Marier +Build-Depends: debhelper (>> 6), autotools-dev, zlib1g-dev +Standards-Version: 3.8.1 +Homepage: http://ccache.samba.org +Vcs-git: git://git.debian.org/git/collab-maint/ccache.git +Vcs-Browser: http://git.debian.org/?p=collab-maint/ccache.git;a=summary + +Package: ccache +Architecture: any +Depends: ${shlibs:Depends} +Suggests: distcc +Description: Compiler results cacher, for fast recompiles + ccache is a compiler cache. It speeds up re-compilation of C/C++ code + by caching previous compiles and detecting when the same compile is + being done again. --- ccache-2.4.orig/debian/copyright +++ ccache-2.4/debian/copyright @@ -0,0 +1,29 @@ +This package was debianized by Paul Russell on +Sun, 31 Mar 2002 14:08:57 +0200. + +It was downloaded from http://ccache.samba.org/ftp/ccache/ + +The ccache-zlib patch was downloaded from http://www.gustaebel.de/lars/ccache/ + +Upstream Author: Andrew Tridgell + +Copyright: 2002-2005 Andrew Tridgell + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA + +You are free to distribute this software under the terms of the GNU General +Public License. On Debian systems, the complete text of the GNU General +Public License can be found in /usr/share/common-licenses/GPL file. --- ccache-2.4.orig/debian/dirs +++ ccache-2.4/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +usr/lib/ccache +usr/share/man/man1 --- ccache-2.4.orig/debian/docs +++ ccache-2.4/debian/docs @@ -0,0 +1 @@ +README --- ccache-2.4.orig/debian/examples +++ ccache-2.4/debian/examples @@ -0,0 +1,2 @@ +debian/update-ccache +manage-cache.sh --- ccache-2.4.orig/debian/rules +++ ccache-2.4/debian/rules @@ -0,0 +1,139 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --build $(DEB_HOST_GNU_TYPE) +else + confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +endif + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +patched_files = ccache.c stats.c util.c \ + ccache.1 ccache.h ccache.yo config.h.in \ + configure configure.in Makefile.in \ + web/ccache-man.html web/index.html + +config.status: patch configure-stamp +configure-stamp: + dh_testdir +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + ./configure $(confflags) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info + touch $@ + +patch: patch-stamp +patch-stamp: + for ufile in $(patched_files); do \ + [ -f "$(CURDIR)/$$ufile" ] || continue; \ + [ ! -f "$(CURDIR)/$$ufile.unpatched" ] || continue; \ + echo "### Saving unpatched file $$ufile"; \ + cp -f "$(CURDIR)/$$ufile" "$(CURDIR)/$$ufile.unpatched"; \ + done + mkdir -p debian/patched + for pfile in debian/patches/*.diff; do \ + [ -f "$$pfile" ] || continue; \ + pname="$$(basename $$pfile .diff)"; \ + [ ! -f "debian/patched/$$pname.patched" ] || continue; \ + echo "### Applying patch $$pname"; \ + patch -p1 -N < $$pfile; \ + cp -f "$$pfile" "debian/patched/$$pname.patched"; \ + done + chmod +x $(CURDIR)/manage-cache.sh + touch $@ + +build: build-stamp +build-stamp: config.status + dh_testdir + $(MAKE) + touch $@ + +clean: clean-patched unpatch +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + [ ! -f Makefile ] || $(MAKE) distclean + rm -f config.guess config.sub + dh_clean + +unpatch: + for ufile in $(patched_files); do \ + [ -f "$(CURDIR)/$$ufile.unpatched" ] || continue; \ + echo "### Restoring unpatched file $$ufile"; \ + mv -f "$(CURDIR)/$$ufile.unpatched" "$(CURDIR)/$$ufile"; \ + done + rm -f $(CURDIR)/manage-cache.sh + rm -rf debian/patched patch-stamp + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/ccache. + $(MAKE) install prefix=$(CURDIR)/debian/ccache/usr + + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/$(DEB_BUILD_GNU_TYPE)-gcc + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/$(DEB_BUILD_GNU_TYPE)-g++ + set -e; for ver in 2.95 3.0 3.2 3.3 3.4 4.0 4.1 4.2 4.3; do \ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/$(DEB_BUILD_GNU_TYPE)-gcc-$$ver; \ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/gcc-$$ver; \ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/$(DEB_BUILD_GNU_TYPE)-g++-$$ver; \ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/g++-$$ver; \ + done + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/cc + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/c++ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/gcc + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/g++ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/i586-mingw32msvc-c++ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/i586-mingw32msvc-cc + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/i586-mingw32msvc-g++ + ln -s ../../bin/ccache $(CURDIR)/debian/ccache/usr/lib/ccache/i586-mingw32msvc-gcc + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installmenu + dh_installcron + dh_installman + dh_installinfo + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install patch unpatch --- ccache-2.4.orig/debian/update-ccache +++ ccache-2.4/debian/update-ccache @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Update compiler links to ccache (in /usr/local/bin) +# +# The idea is that /usr/local/bin is ahead of /usr/bin in your PATH, so adding +# the link /usr/local/bin/cc -> /usr/bin/ccache means that it is run instead of +# /usr/bin/cc +# +# Written by: Behan Webster +# + +DIRECTORY=/usr/local/bin +CCACHE=/usr/bin/ccache +CCDIR=/usr/lib/ccache + +usage() { + echo "Usage: `basename $0` [--directory ] [--remove]" + exit 0 +} + +while [ $# -gt 0 ] ; do + case "$1" in + -d*|--d*|--directory) DIRECTORY=$2; shift; shift;; + -h*|--h*|--help) usage;; + -r*|--r*|--remove) REMOVE=1; shift;; + -t*|--t*|--test) TEST=echo; shift;; + esac +done + +for FILE in `cd $CCDIR; ls` ; do + LINK=$DIRECTORY/$FILE + if [ -z "$REMOVE" ] ; then + # Add link + $TEST ln -fs $CCACHE $LINK + else + # Remove link + if [ -L "$LINK" ] ; then + $TEST rm -f $LINK + fi + fi +done + +# vim: sw=4 ts=4 --- ccache-2.4.orig/debian/watch +++ ccache-2.4/debian/watch @@ -0,0 +1,2 @@ +version=2 +http://samba.org/ftp/ccache/ccache-(.*)\.tar\.gz --- ccache-2.4.orig/debian/patches/15_gcc4.3_warnings.diff +++ ccache-2.4/debian/patches/15_gcc4.3_warnings.diff @@ -0,0 +1,43 @@ +diff --git a/ccache.c b/ccache.c +index 8ed9892..38775cf 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -144,7 +144,9 @@ static const char *tmp_string(void) + gethostname(hostname, sizeof(hostname)-1); + #endif + hostname[sizeof(hostname)-1] = 0; +- asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()); ++ if (asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()) == -1) { ++ fatal("could not allocate tmp_string"); ++ } + } + + return ret; +diff --git a/stats.c b/stats.c +index ddaf768..593cd15 100644 +--- a/stats.c ++++ b/stats.c +@@ -91,7 +91,7 @@ static void write_stats(int fd, unsigned counters[STATS_END]) + if (len >= (int)sizeof(buf)-1) fatal("stats too long?!"); + + lseek(fd, 0, SEEK_SET); +- write(fd, buf, len); ++ if (write(fd, buf, len) == -1) fatal("could not write stats"); + } + + +diff --git a/util.c b/util.c +index 6056d36..5b28d14 100644 +--- a/util.c ++++ b/util.c +@@ -372,7 +372,9 @@ void x_asprintf(char **ptr, const char *format, ...) + + *ptr = NULL; + va_start(ap, format); +- vasprintf(ptr, format, ap); ++ if (vasprintf(ptr, format, ap) == -1) { ++ fatal("out of memory in x_asprintf"); ++ } + va_end(ap); + + if (!ptr) fatal("out of memory in x_asprintf"); --- ccache-2.4.orig/debian/patches/14_hardlink_doc.diff +++ ccache-2.4/debian/patches/14_hardlink_doc.diff @@ -0,0 +1,39 @@ +diff --git a/ccache.1 b/ccache.1 +index 410a10b..cc48c3b 100644 +--- a/ccache.1 ++++ b/ccache.1 +@@ -334,7 +334,7 @@ following conditions need to be met: + .IP o + Use the same \fBCCACHE_DIR\fP environment variable setting + .IP o +-Set the \fBCCACHE_NOLINK\fP environment variable ++Unset the \fBCCACHE_HARDLINK\fP environment variable + .IP o + Make sure everyone sets the CCACHE_UMASK environment variable + to 002, this ensures that cached files are accessible to everyone in +diff --git a/ccache.yo b/ccache.yo +index 311bead..650c30d 100644 +--- a/ccache.yo ++++ b/ccache.yo +@@ -298,7 +298,7 @@ following conditions need to be met: + + itemize( + it() Use the same bf(CCACHE_DIR) environment variable setting +- it() Set the bf(CCACHE_NOLINK) environment variable ++ it() Unset the bf(CCACHE_HARDLINK) environment variable + it() Make sure everyone sets the CCACHE_UMASK environment variable + to 002, this ensures that cached files are accessible to everyone in + the group. +diff --git a/web/ccache-man.html b/web/ccache-man.html +index b831e71..0cdf8cd 100644 +--- a/web/ccache-man.html ++++ b/web/ccache-man.html +@@ -256,7 +256,7 @@ relinked without reason. To share a cache without side effects, the + following conditions need to be met: +

    +
  • Use the same CCACHE_DIR environment variable setting +-
  • Set the CCACHE_NOLINK environment variable ++
  • Unset the CCACHE_HARDLINK environment variable +
  • Make sure everyone sets the CCACHE_UMASK environment variable + to 002, this ensures that cached files are accessible to everyone in + the group. --- ccache-2.4.orig/debian/patches/13_html_links.diff +++ ccache-2.4/debian/patches/13_html_links.diff @@ -0,0 +1,35 @@ +diff --git a/web/index.html b/web/index.html +index cc0289b..4af8391 100644 +--- a/web/index.html ++++ b/web/index.html +@@ -29,10 +29,10 @@ The latest release is ccache 2.4. +
  • fixed handling of HOME environment variable +
+ +-See the manual page for details ++See the manual page for details + on the new options.

+ +-You can get this release from the download directory ++You can get this release from the download directory + +

NOTE! This release changes the hash input slighly, so you will + probably find that you will not get any hits against your existing +@@ -87,7 +87,7 @@ I have coded ccache very carefully to try to provide these guarantees. + +

Documentation

+ +-See the manual page ++See the manual page + + +

Performance

+@@ -116,7 +116,7 @@ build system. +

Download

+ + You can download the latest release from the download directory.

++href="http://ccache.samba.org/ftp/ccache/">download directory.

+ + For the bleeding edge, you can fetch ccache via CVS or + rsync. To fetch via cvs use the following command: --- ccache-2.4.orig/debian/patches/12_cachesize_permissions.diff +++ ccache-2.4/debian/patches/12_cachesize_permissions.diff @@ -0,0 +1,89 @@ +diff --git a/ccache.c b/ccache.c +index 290c688..8ed9892 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -1048,15 +1048,23 @@ static int ccache_main(int argc, char *argv[]) + case 'F': + check_cache_dir(); + v = atoi(optarg); +- stats_set_limits(v, -1); +- printf("Set cache file limit to %u\n", (unsigned)v); ++ if (stats_set_limits(v, -1) == 0) { ++ printf("Set cache file limit to %u\n", (unsigned)v); ++ } else { ++ printf("Could not set cache file limit.\n"); ++ exit(1); ++ } + break; + + case 'M': + check_cache_dir(); + v = value_units(optarg); +- stats_set_limits(-1, v); +- printf("Set cache size limit to %uk\n", (unsigned)v); ++ if (stats_set_limits(-1, v) == 0) { ++ printf("Set cache size limit to %uk\n", (unsigned)v); ++ } else { ++ printf("Could not set cache size limit.\n"); ++ exit(1); ++ } + break; + + default: +diff --git a/ccache.h b/ccache.h +index 8d3c93c..bd67cbc 100644 +--- a/ccache.h ++++ b/ccache.h +@@ -118,7 +118,7 @@ void stats_zero(void); + void stats_summary(void); + void stats_tocache(size_t size); + void stats_read(const char *stats_file, unsigned counters[STATS_END]); +-void stats_set_limits(long maxfiles, long maxsize); ++int stats_set_limits(long maxfiles, long maxsize); + size_t value_units(const char *s); + void display_size(unsigned v); + void stats_set_sizes(const char *dir, size_t num_files, size_t total_size); +diff --git a/stats.c b/stats.c +index e5662fb..ddaf768 100644 +--- a/stats.c ++++ b/stats.c +@@ -286,7 +286,7 @@ void stats_zero(void) + + + /* set the per directory limits */ +-void stats_set_limits(long maxfiles, long maxsize) ++int stats_set_limits(long maxfiles, long maxsize) + { + int dir; + unsigned counters[STATS_END]; +@@ -298,7 +298,9 @@ void stats_set_limits(long maxfiles, long maxsize) + maxsize /= 16; + } + +- create_dir(cache_dir); ++ if (create_dir(cache_dir) != 0) { ++ return 1; ++ } + + /* set the limits in each directory */ + for (dir=0;dir<=0xF;dir++) { +@@ -306,7 +308,9 @@ void stats_set_limits(long maxfiles, long maxsize) + int fd; + + x_asprintf(&cdir, "%s/%1x", cache_dir, dir); +- create_dir(cdir); ++ if (create_dir(cdir) != 0) { ++ return 1; ++ } + x_asprintf(&fname, "%s/stats", cdir); + free(cdir); + +@@ -326,6 +330,8 @@ void stats_set_limits(long maxfiles, long maxsize) + } + free(fname); + } ++ ++ return 0; + } + + /* set the per directory sizes */ --- ccache-2.4.orig/debian/patches/11_utimes.diff +++ ccache-2.4/debian/patches/11_utimes.diff @@ -0,0 +1,93 @@ +diff --git a/ccache.c b/ccache.c +index 39742d9..290c688 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -501,8 +501,13 @@ static void from_cache(int first) + + /* update timestamps for LRU cleanup + also gives output_file a sensible mtime when hard-linking (for make) */ ++#ifdef HAVE_UTIMES ++ utimes(hashname, NULL); ++ utimes(stderr_file, NULL); ++#else + utime(hashname, NULL); + utime(stderr_file, NULL); ++#endif + + if (strcmp(output_file, "/dev/null") == 0) { + ret = 0; +diff --git a/ccache.h b/ccache.h +index 71b03ff..8d3c93c 100644 +--- a/ccache.h ++++ b/ccache.h +@@ -22,6 +22,9 @@ + #ifdef HAVE_PWD_H + #include + #endif ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif + + #ifdef ENABLE_ZLIB + #include +diff --git a/config.h.in b/config.h.in +index 3068845..49ccd83 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -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 + +@@ -60,6 +66,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_STAT_H + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_SYS_TIME_H ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_TYPES_H + +@@ -69,6 +78,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_UNISTD_H + ++/* Define to 1 if you have the `utimes' function. */ ++#undef HAVE_UTIMES ++ + /* Define to 1 if you have the `vasprintf' function. */ + #undef HAVE_VASPRINTF + +diff --git a/configure.in b/configure.in +index be77bbf..1ac94d3 100644 +--- a/configure.in ++++ b/configure.in +@@ -27,10 +27,11 @@ AC_HEADER_DIRENT + AC_HEADER_TIME + AC_HEADER_SYS_WAIT + +-AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h) ++AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h) + + AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp) + AC_CHECK_FUNCS(gethostname getpwuid) ++AC_CHECK_FUNCS(utimes) + + AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [ + AC_TRY_COMPILE( --- ccache-2.4.orig/debian/patches/10_lru_cleanup.diff +++ ccache-2.4/debian/patches/10_lru_cleanup.diff @@ -0,0 +1,25 @@ +diff --git a/ccache.c b/ccache.c +index c636692..39742d9 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -499,6 +499,9 @@ static void from_cache(int first) + return; + } + ++ /* update timestamps for LRU cleanup ++ also gives output_file a sensible mtime when hard-linking (for make) */ ++ utime(hashname, NULL); + utime(stderr_file, NULL); + + if (strcmp(output_file, "/dev/null") == 0) { +@@ -533,10 +536,6 @@ static void from_cache(int first) + failed(); + } + } +- if (ret == 0) { +- /* update the mtime on the file so that make doesn't get confused */ +- utime(output_file, NULL); +- } + + /* get rid of the intermediate preprocessor file */ + if (i_tmpfile) { --- ccache-2.4.orig/debian/patches/09_respect_ldflags.diff +++ ccache-2.4/debian/patches/09_respect_ldflags.diff @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index e32ebe5..438ec19 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -21,7 +21,7 @@ all: ccache$(EXEEXT) + docs: ccache.1 web/ccache-man.html + + ccache$(EXEEXT): $(OBJS) $(HEADERS) +- $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + + ccache.1: ccache.yo + -yodl2man -o ccache.1 ccache.yo --- ccache-2.4.orig/debian/patches/08_manpage_hyphens.diff +++ ccache-2.4/debian/patches/08_manpage_hyphens.diff @@ -0,0 +1,89 @@ +diff --git a/ccache.1 b/ccache.1 +index 2e854d9..410a10b 100644 +--- a/ccache.1 ++++ b/ccache.1 +@@ -49,7 +49,7 @@ Print a options summary page + .IP "\fB-s, --show-stats\fP" + Print the current statistics summary for the cache\&. The + statistics are stored spread across the subdirectories of the +-cache\&. Using "ccache -s" adds up the statistics across all ++cache\&. Using "ccache \-s" adds up the statistics across all + subdirectories and prints the totals\&. + .IP + .IP "\fB-z, --zero-stats\fP" +@@ -60,7 +60,7 @@ Print the ccache version number + .IP + .IP "\fB-c, --cleanup\fP" + Clean the cache and re-calculate the cache file count and +-size totals\&. Normally the -c option should not be necessary as ccache ++size totals\&. Normally the \-c option should not be necessary as ccache + keeps the cache below the specified limits at runtime and keeps + statistics up to date on each compile\&. This option is mostly useful + if you manually modify the cache contents or believe that the cache +@@ -100,9 +100,9 @@ To install for the second method do something like this: + + + cp ccache /usr/local/bin/ +- ln -s /usr/local/bin/ccache /usr/local/bin/gcc +- ln -s /usr/local/bin/ccache /usr/local/bin/g++ +- ln -s /usr/local/bin/ccache /usr/local/bin/cc ++ ln \-s /usr/local/bin/ccache /usr/local/bin/gcc ++ ln \-s /usr/local/bin/ccache /usr/local/bin/g++ ++ ln \-s /usr/local/bin/ccache /usr/local/bin/cc + + .fi + +@@ -118,7 +118,7 @@ cause "interesting" problems\&. + .PP + When run as a compiler front end ccache usually just takes the same + command line options as the compiler you are using\&. The only exception +-to this is the option \&'--ccache-skip\&'\&. That option can be used to tell ++to this is the option \&'\-\-ccache-skip\&'\&. That option can be used to tell + ccache that the next option is definitely not a input filename, and + should be passed along to the compiler as-is\&. + .PP +@@ -128,7 +128,7 @@ compiler option, as it needs the input filename to determine the name + of the resulting object file (among other things)\&. The heuristic + ccache uses in this parse is that any string on the command line that + exists as a file is treated as an input file name (usually a C +-file)\&. By using --ccache-skip you can force an option to not be ++file)\&. By using \-\-ccache-skip you can force an option to not be + treated as an input file name and instead be passed along to the + compiler as a command line option\&. + .PP +@@ -239,7 +239,7 @@ this option\&. + .IP "\fBCCACHE_UNIFY\fP" + If you set the environment variable CCACHE_UNIFY + then ccache will use the C/C++ unifier when hashing the pre-processor +-output if -g is not used in the compile\&. The unifier is slower than a ++output if \-g is not used in the compile\&. The unifier is slower than a + normal hash, so setting this environment variable loses a little bit + of speed, but it means that ccache can take advantage of not + recompiling when the changes to the source code consist of +@@ -268,7 +268,7 @@ into the cache\&. + .PP + By default ccache has a one gigabyte limit on the cache size and no + maximum number of files\&. You can set a different limit using the +-"ccache -M" and "ccache -F" options, which set the size and number of ++"ccache \-M" and "ccache \-F" options, which set the size and number of + files limits\&. + .PP + When these limits are reached ccache will reduce the cache to 20% +@@ -290,7 +290,7 @@ code a 2nd time and use the previously compiled output\&. You detect + that it is the same code by forming a hash of: + .PP + .IP o +-the pre-processor output from running the compiler with -E ++the pre-processor output from running the compiler with \-E + .IP o + the command line options + .IP o +@@ -345,7 +345,7 @@ cache directory (and that you trust all users of the shared cache)\&. + .IP o + Make sure that the setgid bit is set on all directories in the + cache\&. This tells the filesystem to inherit group ownership for new +-directories\&. The command "chmod g+s `find $CCACHE_DIR -type d`" might ++directories\&. The command "chmod g+s `find $CCACHE_DIR \-type d`" might + be useful for this\&. + .PP + .SH "HISTORY" --- ccache-2.4.orig/debian/patches/07_cachedirtag.diff +++ ccache-2.4/debian/patches/07_cachedirtag.diff @@ -0,0 +1,75 @@ +diff --git a/ccache.c b/ccache.c +index 843929f..c636692 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -1143,6 +1143,14 @@ int main(int argc, char *argv[]) + exit(1); + } + ++ if (!getenv("CCACHE_READONLY")) { ++ if (create_cachedirtag(cache_dir) != 0) { ++ fprintf(stderr,"ccache: failed to create %s/CACHEDIR.TAG (%s)\n", ++ cache_dir, strerror(errno)); ++ exit(1); ++ } ++ } ++ + ccache(argc, argv); + return 1; + } +diff --git a/ccache.h b/ccache.h +index 67904cd..71b03ff 100644 +--- a/ccache.h ++++ b/ccache.h +@@ -94,6 +94,7 @@ int move_file(const char *src, const char *dest); + int test_if_compressed(const char *filename); + + int create_dir(const char *dir); ++int create_cachedirtag(const char *dir); + void x_asprintf(char **ptr, const char *format, ...); + char *x_strdup(const char *s); + void *x_realloc(void *ptr, size_t size); +diff --git a/util.c b/util.c +index 70d7ea7..6056d36 100644 +--- a/util.c ++++ b/util.c +@@ -329,6 +329,39 @@ int create_dir(const char *dir) + return 0; + } + ++char const CACHEDIR_TAG[] = ++ "Signature: 8a477f597d28d172789f06886806bc55\n" ++ "# This file is a cache directory tag created by ccache.\n" ++ "# For information about cache directory tags, see:\n" ++ "# http://www.brynosaurus.com/cachedir/\n"; ++ ++int create_cachedirtag(const char *dir) ++{ ++ char *filename; ++ struct stat st; ++ FILE *f; ++ x_asprintf(&filename, "%s/CACHEDIR.TAG", dir); ++ if (stat(filename, &st) == 0) { ++ if (S_ISREG(st.st_mode)) { ++ goto success; ++ } ++ errno = EEXIST; ++ goto error; ++ } ++ f = fopen(filename, "w"); ++ if (!f) goto error; ++ if (fwrite(CACHEDIR_TAG, sizeof(CACHEDIR_TAG)-1, 1, f) != 1) { ++ goto error; ++ } ++ if (fclose(f)) goto error; ++success: ++ free(filename); ++ return 0; ++error: ++ free(filename); ++ return 1; ++} ++ + /* + this is like asprintf() but dies if the malloc fails + note that we use vsnprintf in a rather poor way to make this more portable --- ccache-2.4.orig/debian/patches/06_md.diff +++ ccache-2.4/debian/patches/06_md.diff @@ -0,0 +1,79 @@ +diff --git a/ccache.c b/ccache.c +index 64c979b..843929f 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -647,6 +647,13 @@ static void process_args(int argc, char **argv) + int found_S_opt = 0; + struct stat st; + char *e; ++ /* is gcc being asked to output dependencies? */ ++ int generating_dependencies = 0; ++ /* is the dependency makefile name overridden with -MF? */ ++ int dependency_filename_specified = 0; ++ /* is the dependency makefile target name specified with -MQ or -MF? */ ++ int dependency_target_specified = 0; ++ + + stripped_args = args_init(0, NULL); + +@@ -725,6 +732,18 @@ static void process_args(int argc, char **argv) + continue; + } + ++ /* These options require special handling, because they ++ behave differently with gcc -E, when the output ++ file is not specified. */ ++ ++ if (strcmp(argv[i], "-MD") == 0 || strcmp(argv[i], "-MMD") == 0) { ++ generating_dependencies = 1; ++ } else if (strcmp(argv[i], "-MF") == 0) { ++ dependency_filename_specified = 1; ++ } else if (strcmp(argv[i], "-MQ") == 0 || strcmp(argv[i], "-MT") == 0) { ++ dependency_target_specified = 1; ++ } ++ + /* options that take an argument */ + { + const char *opts[] = {"-I", "-include", "-imacros", "-iprefix", +@@ -837,6 +856,41 @@ static void process_args(int argc, char **argv) + p[2] = 0; + } + ++ /* If dependencies are generated, configure the preprocessor */ ++ ++ if (generating_dependencies && output_file) { ++ if (!dependency_filename_specified) { ++ char *default_depfile_name = x_strdup(output_file); ++ char *p = strrchr(default_depfile_name, '.'); ++ ++ if (p) { ++ if (strlen(p) < 2) { ++ stats_update(STATS_ARGS); ++ failed(); ++ return; ++ } ++ *p = 0; ++ } ++ else { ++ int len = p - default_depfile_name; ++ ++ p = x_malloc(len + 3); ++ strncpy(default_depfile_name, p, len - 1); ++ free(default_depfile_name); ++ default_depfile_name = p; ++ } ++ ++ strcat(default_depfile_name, ".d"); ++ args_add(stripped_args, "-MF"); ++ args_add(stripped_args, default_depfile_name); ++ } ++ ++ if (!dependency_target_specified) { ++ args_add(stripped_args, "-MT"); ++ args_add(stripped_args, output_file); ++ } ++ } ++ + /* cope with -o /dev/null */ + if (strcmp(output_file,"/dev/null") != 0 && stat(output_file, &st) == 0 && !S_ISREG(st.st_mode)) { + cc_log("Not a regular file %s\n", output_file); --- ccache-2.4.orig/debian/patches/05_nfs_fix.diff +++ ccache-2.4/debian/patches/05_nfs_fix.diff @@ -0,0 +1,49 @@ +diff --git a/ccache.1 b/ccache.1 +index 87b3a85..2e854d9 100644 +--- a/ccache.1 ++++ b/ccache.1 +@@ -381,12 +381,6 @@ ccache can handle a much wider ranger of compiler options + .IP o + ccache avoids a double call to cpp on a cache miss + .PP +-.SH "BUGS" +-.PP +-When the cache is stored on an NFS filesystem, the filesystem must be +-exported with the \fBno_subtree_check\fP option to make renames between +-directories reliable\&. +-.PP + .SH "CREDITS" + .PP + Thanks to the following people for their contributions to ccache +diff --git a/util.c b/util.c +index a6b8899..70d7ea7 100644 +--- a/util.c ++++ b/util.c +@@ -58,9 +58,26 @@ void copy_fd(int fd_in, int fd_out) + } + } + ++static int safe_rename(const char* oldpath, const char* newpath) ++{ ++ /* safe_rename is for creating entries in the cache. ++ ++ Works like rename(), but it never overwrites an existing ++ cache entry. This avoids corruption on NFS. */ ++ int status = link( oldpath, newpath ); ++ if( status == 0 || errno == EEXIST ) ++ { ++ return unlink( oldpath ); ++ } ++ else ++ { ++ return -1; ++ } ++} ++ + /* move a file using rename */ + int move_file(const char *src, const char *dest) { +- return rename(src, dest); ++ return safe_rename(src, dest); + } + + /* copy a file - used when hard links don't work --- ccache-2.4.orig/debian/patches/04_ignore_profile.diff +++ ccache-2.4/debian/patches/04_ignore_profile.diff @@ -0,0 +1,14 @@ +diff --git a/ccache.c b/ccache.c +index f9b7b82..64c979b 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -660,6 +660,9 @@ static void process_args(int argc, char **argv) + + /* these are too hard */ + if (strcmp(argv[i], "-fbranch-probabilities")==0 || ++ strcmp(argv[i], "--coverage") == 0 || ++ strcmp(argv[i], "-fprofile-arcs") == 0 || ++ strcmp(argv[i], "-ftest-coverage") == 0 || + strcmp(argv[i], "-M") == 0 || + strcmp(argv[i], "-MM") == 0 || + strcmp(argv[i], "-x") == 0) { --- ccache-2.4.orig/debian/patches/03_long_options.diff +++ ccache-2.4/debian/patches/03_long_options.diff @@ -0,0 +1,133 @@ +diff --git a/ccache.1 b/ccache.1 +index 9d1cbcd..87b3a85 100644 +--- a/ccache.1 ++++ b/ccache.1 +@@ -23,14 +23,14 @@ Here is a summary of the options to ccache\&. + .nf + + +--s show statistics summary +--z zero statistics +--c run a cache cleanup +--C clear the cache completely +--F set maximum files in cache +--M set maximum size of cache (use G, M or K) +--h this help page +--V print version number ++\-s, \-\-show-stats show statistics summary ++\-z, \-\-zero-stats zero statistics ++\-c, \-\-cleanup run a cache cleanup ++\-C, \-\-clear clear the cache completely ++\-F , \-\-max-files= set maximum files in cache ++\-M , \-\-max-size= set maximum size of cache (use G, M or K) ++\-h, \-\-help this help page ++\-V, \-\-version print version number + + .fi + +@@ -43,22 +43,22 @@ invoked as a compiler none of these options apply\&. In that case your + normal compiler options apply and you should refer to your compilers + documentation\&. + .PP +-.IP "\fB-h\fP" ++.IP "\fB-h, --help\fP" + Print a options summary page + .IP +-.IP "\fB-s\fP" ++.IP "\fB-s, --show-stats\fP" + Print the current statistics summary for the cache\&. The + statistics are stored spread across the subdirectories of the + cache\&. Using "ccache -s" adds up the statistics across all + subdirectories and prints the totals\&. + .IP +-.IP "\fB-z\fP" ++.IP "\fB-z, --zero-stats\fP" + Zero the cache statistics\&. + .IP +-.IP "\fB-V\fP" ++.IP "\fB-V, --version\fP" + Print the ccache version number + .IP +-.IP "\fB-c\fP" ++.IP "\fB-c, --cleanup\fP" + Clean the cache and re-calculate the cache file count and + size totals\&. Normally the -c option should not be necessary as ccache + keeps the cache below the specified limits at runtime and keeps +@@ -66,16 +66,16 @@ statistics up to date on each compile\&. This option is mostly useful + if you manually modify the cache contents or believe that the cache + size statistics may be inaccurate\&. + .IP +-.IP "\fB-C\fP" ++.IP "\fB-C, --clear\fP" + Clear the entire cache, removing all cached files\&. + .IP +-.IP "\fB-F maxfiles\fP" ++.IP "\fB-F , --max-files=\fP" + This sets the maximum number of files allowed in + the cache\&. The value is stored inside the cache directory and applies + to all future compiles\&. Due to the way the value is stored the actual + value used is always rounded down to the nearest multiple of 16\&. + .IP +-.IP "\fB-M maxsize\fP" ++.IP "\fB-M , --max-size=\fP" + This sets the maximum cache size\&. You can specify + a value in gigabytes, megabytes or kilobytes by appending a G, M or K + to the value\&. The default is gigabytes\&. The actual value stored is +diff --git a/ccache.c b/ccache.c +index f6be1bc..f9b7b82 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -22,6 +22,7 @@ + */ + + #include "ccache.h" ++#include + + /* the base cache directory */ + char *cache_dir = NULL; +@@ -911,14 +912,14 @@ static void usage(void) + printf("\tcompiler [compile options] (via symbolic link)\n"); + printf("\nOptions:\n"); + +- printf("-s show statistics summary\n"); +- printf("-z zero statistics\n"); +- printf("-c run a cache cleanup\n"); +- printf("-C clear the cache completely\n"); +- printf("-F set maximum files in cache\n"); +- printf("-M set maximum size of cache (use G, M or K)\n"); +- printf("-h this help page\n"); +- printf("-V print version number\n"); ++ printf("-s, --show-stats show statistics summary\n"); ++ printf("-z, --zero-stats zero statistics\n"); ++ printf("-c, --cleanup run a cache cleanup\n"); ++ printf("-C, --clear clear the cache completely\n"); ++ printf("-F , --max-files= set maximum files in cache\n"); ++ printf("-M , --max-size= set maximum size of cache (use G, M or K)\n"); ++ printf("-h, --help this help page\n"); ++ printf("-V, --version print version number\n"); + } + + static void check_cache_dir(void) +@@ -934,7 +935,21 @@ static int ccache_main(int argc, char *argv[]) + int c; + size_t v; + +- while ((c = getopt(argc, argv, "hszcCF:M:V")) != -1) { ++ static struct option long_options[] = ++ { ++ {"show-stats", no_argument, 0, 's'}, ++ {"zero-stats", no_argument, 0, 'z'}, ++ {"cleanup", no_argument, 0, 'c'}, ++ {"clear", no_argument, 0, 'C'}, ++ {"max-files", required_argument, 0, 'F'}, ++ {"max-size", required_argument, 0, 'M'}, ++ {"help", no_argument, 0, 'h'}, ++ {"version", no_argument, 0, 'V'}, ++ {0, 0, 0, 0} ++ }; ++ int option_index = 0; ++ ++ while ((c = getopt_long(argc, argv, "hszcCF:M:V", long_options, &option_index)) != -1) { + switch (c) { + case 'V': + printf("ccache version %s\n", CCACHE_VERSION); --- ccache-2.4.orig/debian/patches/02_ccache-compressed.diff +++ ccache-2.4/debian/patches/02_ccache-compressed.diff @@ -0,0 +1,990 @@ +diff --git a/Makefile.in b/Makefile.in +index 0bf3eb9..e32ebe5 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -11,6 +11,7 @@ CC=@CC@ + CFLAGS=@CFLAGS@ -I. + EXEEXT=@EXEEXT@ + ++LIBS= @LIBS@ + OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \ + cleanup.o snprintf.o unify.o + HEADERS = ccache.h mdfour.h +@@ -20,7 +21,7 @@ all: ccache$(EXEEXT) + docs: ccache.1 web/ccache-man.html + + ccache$(EXEEXT): $(OBJS) $(HEADERS) +- $(CC) $(CFLAGS) -o $@ $(OBJS) ++ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) + + ccache.1: ccache.yo + -yodl2man -o ccache.1 ccache.yo +diff --git a/ccache.1 b/ccache.1 +index daec8ee..9d1cbcd 100644 +--- a/ccache.1 ++++ b/ccache.1 +@@ -210,7 +210,8 @@ If you set the environment variable + CCACHE_HARDLINK then ccache will attempt to use hard links from the + cache directory when creating the compiler output rather than using a + file copy\&. Using hard links is faster, but can confuse programs like +-\&'make\&' that rely on modification times\&. ++\&'make\&' that rely on modification times\&. Hard links are never made for ++compressed cache files\&. + .IP + .IP "\fBCCACHE_RECACHE\fP" + This forces ccache to not use any cached +@@ -257,6 +258,11 @@ systems like this you can use the CCACHE_EXTENSION option to override + the default\&. On HP-UX set this environment variable to "i" if you use + the aCC compiler\&. + .IP ++.IP "\fBCCACHE_NOCOMPRESS\fP" ++If you set the environment variable ++CCACHE_NOCOMPRESS then there is no compression used on files that go ++into the cache\&. ++.IP + .PP + .SH "CACHE SIZE MANAGEMENT" + .PP +@@ -269,6 +275,14 @@ When these limits are reached ccache will reduce the cache to 20% + below the numbers you specified in order to avoid doing the cache + clean operation too often\&. + .PP ++.SH "CACHE COMPRESSION" ++.PP ++By default ccache will compress all files it puts into the cache ++using the zlib compression\&. While this involves a negligible ++performance slowdown, it significantly increases the number of files ++that fit in the cache\&. You can turn off compression setting the ++CCACHE_NOCOMPRESS environment variable\&. ++.PP + .SH "HOW IT WORKS" + .PP + The basic idea is to detect when you are compiling exactly the same +diff --git a/ccache.c b/ccache.c +index e7272d5..f6be1bc 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -199,7 +199,7 @@ static void to_cache(ARGS *args) + fd = open(tmp_stderr, O_RDONLY | O_BINARY); + if (fd != -1) { + if (strcmp(output_file, "/dev/null") == 0 || +- rename(tmp_hashname, output_file) == 0 || errno == ENOENT) { ++ move_file(tmp_hashname, output_file) == 0 || errno == ENOENT) { + if (cpp_stderr) { + /* we might have some stderr from cpp */ + int fd2 = open(cpp_stderr, O_RDONLY | O_BINARY); +@@ -231,14 +231,25 @@ static void to_cache(ARGS *args) + x_asprintf(&path_stderr, "%s.stderr", hashname); + + if (stat(tmp_stderr, &st1) != 0 || +- stat(tmp_hashname, &st2) != 0 || +- rename(tmp_hashname, hashname) != 0 || +- rename(tmp_stderr, path_stderr) != 0) { ++ stat(tmp_hashname, &st2) != 0 || ++ move_file(tmp_hashname, hashname) != 0 || ++ move_file(tmp_stderr, path_stderr) != 0) { + cc_log("failed to rename tmp files - %s\n", strerror(errno)); + stats_update(STATS_ERROR); + failed(); + } + ++#if ENABLE_ZLIB ++ /* do an extra stat on the cache files for ++ the size statistics */ ++ if (stat(path_stderr, &st1) != 0 || ++ stat(hashname, &st2) != 0) { ++ cc_log("failed to stat cache files - %s\n", strerror(errno)); ++ stats_update(STATS_ERROR); ++ failed(); ++ } ++#endif ++ + cc_log("Placed %s into cache\n", output_file); + stats_tocache(file_size(&st1) + file_size(&st2)); + +@@ -474,7 +485,13 @@ static void from_cache(int first) + } + + /* the user might be disabling cache hits */ ++#ifndef ENABLE_ZLIB ++ /* if the cache file is compressed we must recache */ ++ if ((first && getenv("CCACHE_RECACHE")) || ++ test_if_compressed(hashname) == 1) { ++#else + if (first && getenv("CCACHE_RECACHE")) { ++#endif + close(fd_stderr); + unlink(stderr_file); + free(stderr_file); +@@ -487,7 +504,9 @@ static void from_cache(int first) + ret = 0; + } else { + unlink(output_file); +- if (getenv("CCACHE_HARDLINK")) { ++ /* only make a hardlink if the cache file is uncompressed */ ++ if (getenv("CCACHE_HARDLINK") && ++ test_if_compressed(hashname) == 0) { + ret = link(hashname, output_file); + } else { + ret = copy_file(hashname, output_file); +diff --git a/ccache.h b/ccache.h +index faec597..67904cd 100644 +--- a/ccache.h ++++ b/ccache.h +@@ -23,6 +23,10 @@ + #include + #endif + ++#ifdef ENABLE_ZLIB ++#include ++#endif ++ + #define STATUS_NOTFOUND 3 + #define STATUS_FATAL 4 + #define STATUS_NOCACHE 5 +@@ -36,6 +40,13 @@ + #define DEFAULT_MAXSIZE (1000*1000) + #endif + ++/* file copy mode */ ++#ifdef ENABLE_ZLIB ++#define COPY_UNCOMPRESSED 0 ++#define COPY_FROM_CACHE 1 ++#define COPY_TO_CACHE 2 ++#endif ++ + enum stats { + STATS_NONE=0, + STATS_STDOUT, +@@ -79,6 +90,8 @@ void fatal(const char *msg); + + void copy_fd(int fd_in, int fd_out); + int copy_file(const char *src, const char *dest); ++int move_file(const char *src, const char *dest); ++int test_if_compressed(const char *filename); + + int create_dir(const char *dir); + void x_asprintf(char **ptr, const char *format, ...); +diff --git a/ccache.yo b/ccache.yo +index 12e45a6..311bead 100644 +--- a/ccache.yo ++++ b/ccache.yo +@@ -169,6 +169,11 @@ will have problems with the intermediate filename extensions used in + this optimisation, in which case this option could allow ccache to be + used. + ++dit(bf(CCACHE_NOCOMPRESS)) If you set the environment variable ++CCACHE_NOCOMPRESS then there is no compression used on files that go ++into the cache. However, this setting has no effect on how files are ++retrieved from the cache, compressed results will still be usable. ++ + dit(bf(CCACHE_NOSTATS)) If you set the environment variable + CCACHE_NOSTATS then ccache will not update the statistics files on + each compile. +@@ -181,7 +186,8 @@ dit(bf(CCACHE_HARDLINK)) If you set the environment variable + CCACHE_HARDLINK then ccache will attempt to use hard links from the + cache directory when creating the compiler output rather than using a + file copy. Using hard links is faster, but can confuse programs like +-'make' that rely on modification times. ++'make' that rely on modification times. Hard links are never made for ++compressed cache files. + + dit(bf(CCACHE_RECACHE)) This forces ccache to not use any cached + results, even if it finds them. New results are still cached, but +@@ -236,6 +242,14 @@ When these limits are reached ccache will reduce the cache to 20% + below the numbers you specified in order to avoid doing the cache + clean operation too often. + ++manpagesection(CACHE COMPRESSION) ++ ++By default ccache will compress all files it puts into the cache ++using the zlib compression. While this involves a negligible ++performance slowdown, it significantly increases the number of files ++that fit in the cache. You can turn off compression setting the ++CCACHE_NOCOMPRESS environment variable. ++ + manpagesection(HOW IT WORKS) + + The basic idea is to detect when you are compiling exactly the same +@@ -294,6 +308,8 @@ itemize( + cache. This tells the filesystem to inherit group ownership for new + directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might + be useful for this. ++ it() Set bf(CCACHE_NOCOMPRESS) for all users, if there are users with ++ versions of ccache that do not support compression. + ) + + manpagesection(HISTORY) +diff --git a/config.h.in b/config.h.in +index 286f038..3068845 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -98,3 +98,6 @@ + + /* Define _GNU_SOURCE so that we get all necessary prototypes */ + #undef _GNU_SOURCE ++ ++/* Define to 1 if you like to have zlib compression for the ccache. */ ++#undef ENABLE_ZLIB +diff --git a/configure b/configure +index 2275677..c96e3ee 100755 +--- a/configure ++++ b/configure +@@ -836,6 +836,11 @@ if test -n "$ac_init_help"; then + + cat <<\_ACEOF + ++Optional Features: ++ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) ++ --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ++ --enable-zlib enable zlib support for ccache compression ++ + Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags +@@ -936,7 +941,7 @@ esac + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi +- cd "$ac_popdir" ++ cd $ac_popdir + done + fi + +@@ -1859,7 +1864,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -1917,7 +1923,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2033,7 +2040,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2087,7 +2095,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2132,7 +2141,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2176,7 +2186,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2609,7 +2620,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2681,7 +2693,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2735,7 +2748,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2806,7 +2820,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2860,7 +2875,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2927,7 +2943,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2997,7 +3014,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3078,7 +3096,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3248,7 +3267,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3319,7 +3339,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3509,7 +3530,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3611,7 +3633,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3676,7 +3699,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -3775,6 +3799,229 @@ _ACEOF + + fi + ++# Check whether --enable-zlib or --disable-zlib was given. ++if test "${enable_zlib+set}" = set; then ++ enableval="$enable_zlib" ++ ++else ++ enable_zlib=yes ++fi; ++ ++if test x"$enable_zlib" = x"yes"; then ++ if test "${ac_cv_header_zlib_h+set}" = set; then ++ echo "$as_me:$LINENO: checking for zlib.h" >&5 ++echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 ++if test "${ac_cv_header_zlib_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 ++echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 ++else ++ # Is the header compilable? ++echo "$as_me:$LINENO: checking zlib.h usability" >&5 ++echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++#include ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_header_compiler=no ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6 ++ ++# Is the header present? ++echo "$as_me:$LINENO: checking zlib.h presence" >&5 ++echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag ++ else ++ ac_cpp_err= ++ fi ++else ++ ac_cpp_err=yes ++fi ++if test -z "$ac_cpp_err"; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++rm -f conftest.err conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6 ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) ++ { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes ++ ;; ++ no:yes:* ) ++ { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} ++ { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------------ ## ++## Report this to the AC_PACKAGE_NAME lists. ## ++## ------------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++esac ++echo "$as_me:$LINENO: checking for zlib.h" >&5 ++echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 ++if test "${ac_cv_header_zlib_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_header_zlib_h=$ac_header_preproc ++fi ++echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 ++echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 ++ ++fi ++if test $ac_cv_header_zlib_h = yes; then ++ echo "$as_me:$LINENO: checking for gzdopen in -lz" >&5 ++echo $ECHO_N "checking for gzdopen in -lz... $ECHO_C" >&6 ++if test "${ac_cv_lib_z_gzdopen+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lz $LIBS" ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++/* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char gzdopen (); ++int ++main () ++{ ++gzdopen (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_z_gzdopen=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_z_gzdopen=no ++fi ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzdopen" >&5 ++echo "${ECHO_T}$ac_cv_lib_z_gzdopen" >&6 ++if test $ac_cv_lib_z_gzdopen = yes; then ++ LIBS="-lz $LIBS"; cat >>confdefs.h <<\_ACEOF ++#define ENABLE_ZLIB 1 ++_ACEOF ++ ++fi ++ ++fi ++ ++ ++fi ++ + ac_config_files="$ac_config_files Makefile" + + cat >confcache <<\_ACEOF +@@ -4568,6 +4815,11 @@ esac + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + ++ if test x"$ac_file" != x-; then ++ { echo "$as_me:$LINENO: creating $ac_file" >&5 ++echo "$as_me: creating $ac_file" >&6;} ++ rm -f "$ac_file" ++ fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ +@@ -4606,12 +4858,6 @@ echo "$as_me: error: cannot find input file: $f" >&2;} + fi;; + esac + done` || { (exit 1); exit 1; } +- +- if test x"$ac_file" != x-; then +- { echo "$as_me:$LINENO: creating $ac_file" >&5 +-echo "$as_me: creating $ac_file" >&6;} +- rm -f "$ac_file" +- fi + _ACEOF + cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +diff --git a/configure.in b/configure.in +index 3229ef0..be77bbf 100644 +--- a/configure.in ++++ b/configure.in +@@ -68,5 +68,14 @@ if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then + AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) + fi + ++dnl Check for zlib. ++AC_ARG_ENABLE([zlib], ++ AS_HELP_STRING([--enable-zlib], [enable zlib support for ccache compression]),, ++ [enable_zlib=yes]) ++ ++if test x"$enable_zlib" = x"yes"; then ++ AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, gzdopen, LIBS="-lz $LIBS"; AC_DEFINE(ENABLE_ZLIB))) ++fi ++ + AC_CONFIG_FILES([Makefile]) + AC_OUTPUT +diff --git a/manage-cache.sh b/manage-cache.sh +new file mode 100644 +index 0000000..7ef329d +--- /dev/null ++++ b/manage-cache.sh +@@ -0,0 +1,68 @@ ++#!/bin/bash ++# ++# 2004-05-12 lars@gustaebel.de ++ ++CCACHE_DIR=${CCACHE_DIR:-$HOME/.ccache} ++ ++echo "Do you want to compress or decompress the ccache in $CCACHE_DIR?" ++read -p "Type c or d: " mode ++ ++if [ "$mode" != "c" ] && [ "$mode" != "d" ] ++then ++ exit 1 ++fi ++ ++is_compressed() { ++ test "$(head -c 2 $1)" = $'\x1f\x8b' ++ return $? ++} ++ ++tmpfile=$(mktemp) ++ ++for dir in 0 1 2 3 4 5 6 7 8 9 a b c d e f ++do ++ # process ccache subdir ++ echo -n "$dir " ++ ++ # find cache files ++ find $CCACHE_DIR/$dir -type f -name '*-*' | ++ sort > $tmpfile ++ ++ oldsize=$(cat $CCACHE_DIR/$dir/stats | cut -d ' ' -f 13) ++ newsize=0 ++ ++ while read file ++ do ++ # empty files will be ignored since compressing ++ # them makes them bigger ++ test $(stat -c %s $file) -eq 0 && continue ++ ++ if [ $mode = c ] ++ then ++ if ! is_compressed $file ++ then ++ gzip $file ++ mv $file.gz $file ++ fi ++ else ++ if is_compressed $file ++ then ++ mv $file $file.gz ++ gzip -d $file.gz ++ fi ++ fi ++ ++ # calculate new size statistic for this subdir ++ let newsize=$newsize+$(stat -c "%B*%b" $file)/1024 ++ done < $tmpfile ++ ++ # update statistic file ++ read -a numbers < $CCACHE_DIR/$dir/stats ++ numbers[12]=$newsize ++ echo "${numbers[*]} " > $CCACHE_DIR/$dir/stats ++done ++echo ++ ++# clean up ++rm $tmpfile ++ +diff --git a/util.c b/util.c +index 962dd49..a6b8899 100644 +--- a/util.c ++++ b/util.c +@@ -44,6 +44,7 @@ void fatal(const char *msg) + exit(1); + } + ++#ifndef ENABLE_ZLIB + /* copy all data from one file descriptor to another */ + void copy_fd(int fd_in, int fd_out) + { +@@ -57,6 +58,11 @@ void copy_fd(int fd_in, int fd_out) + } + } + ++/* move a file using rename */ ++int move_file(const char *src, const char *dest) { ++ return rename(src, dest); ++} ++ + /* copy a file - used when hard links don't work + the copy is done via a temporary file and atomic rename + */ +@@ -120,6 +126,174 @@ int copy_file(const char *src, const char *dest) + return 0; + } + ++#else /* ENABLE_ZLIB */ ++ ++/* copy all data from one file descriptor to another ++ possibly decompressing it ++*/ ++void copy_fd(int fd_in, int fd_out) { ++ char buf[10240]; ++ int n; ++ gzFile gz_in; ++ ++ gz_in = gzdopen(dup(fd_in), "rb"); ++ ++ if (!gz_in) { ++ fatal("Failed to copy fd"); ++ } ++ ++ while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) { ++ if (write(fd_out, buf, n) != n) { ++ fatal("Failed to copy fd"); ++ } ++ } ++} ++ ++static int _copy_file(const char *src, const char *dest, int mode) { ++ int fd_in, fd_out; ++ gzFile gz_in, gz_out = NULL; ++ char buf[10240]; ++ int n, ret; ++ char *tmp_name; ++ mode_t mask; ++ struct stat st; ++ ++ x_asprintf(&tmp_name, "%s.XXXXXX", dest); ++ ++ if (getenv("CCACHE_NOCOMPRESS")) { ++ mode = COPY_UNCOMPRESSED; ++ } ++ ++ /* open source file */ ++ fd_in = open(src, O_RDONLY); ++ if (fd_in == -1) { ++ return -1; ++ } ++ ++ gz_in = gzdopen(fd_in, "rb"); ++ if (!gz_in) { ++ close(fd_in); ++ return -1; ++ } ++ ++ /* open destination file */ ++ fd_out = mkstemp(tmp_name); ++ if (fd_out == -1) { ++ gzclose(gz_in); ++ free(tmp_name); ++ return -1; ++ } ++ ++ if (mode == COPY_TO_CACHE) { ++ /* The gzip file format occupies at least 20 bytes. So ++ it will always occupy an entire filesystem block, ++ even for empty files. ++ Since most stderr files will be empty, we turn off ++ compression in this case to save space. ++ */ ++ if (fstat(fd_in, &st) != 0) { ++ gzclose(gz_in); ++ close(fd_out); ++ free(tmp_name); ++ return -1; ++ } ++ if (file_size(&st) == 0) { ++ mode = COPY_UNCOMPRESSED; ++ } ++ } ++ ++ if (mode == COPY_TO_CACHE) { ++ gz_out = gzdopen(dup(fd_out), "wb"); ++ if (!gz_out) { ++ gzclose(gz_in); ++ close(fd_out); ++ free(tmp_name); ++ return -1; ++ } ++ } ++ ++ while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) { ++ if (mode == COPY_TO_CACHE) { ++ ret = gzwrite(gz_out, buf, n); ++ } else { ++ ret = write(fd_out, buf, n); ++ } ++ if (ret != n) { ++ gzclose(gz_in); ++ if (gz_out) { ++ gzclose(gz_out); ++ } ++ close(fd_out); ++ unlink(tmp_name); ++ free(tmp_name); ++ return -1; ++ } ++ } ++ ++ gzclose(gz_in); ++ if (gz_out) { ++ gzclose(gz_out); ++ } ++ ++ /* get perms right on the tmp file */ ++ mask = umask(0); ++ fchmod(fd_out, 0666 & ~mask); ++ umask(mask); ++ ++ /* the close can fail on NFS if out of space */ ++ if (close(fd_out) == -1) { ++ unlink(tmp_name); ++ free(tmp_name); ++ return -1; ++ } ++ ++ unlink(dest); ++ ++ if (rename(tmp_name, dest) == -1) { ++ unlink(tmp_name); ++ free(tmp_name); ++ return -1; ++ } ++ ++ free(tmp_name); ++ ++ return 0; ++} ++ ++/* move a file to the cache, compressing it */ ++int move_file(const char *src, const char *dest) { ++ int ret; ++ ++ ret = _copy_file(src, dest, COPY_TO_CACHE); ++ if (ret != -1) unlink(src); ++ return ret; ++} ++ ++/* copy a file from the cache, decompressing it */ ++int copy_file(const char *src, const char *dest) { ++ return _copy_file(src, dest, COPY_FROM_CACHE); ++} ++#endif /* ENABLE_ZLIB */ ++ ++/* test if a file is zlib compressed */ ++int test_if_compressed(const char *filename) { ++ FILE *f; ++ ++ f = fopen(filename, "rb"); ++ if (!f) { ++ return 0; ++ } ++ ++ /* test if file starts with 1F8B, which is zlib's ++ * magic number */ ++ if ((fgetc(f) != 0x1f) || (fgetc(f) != 0x8b)) { ++ fclose(f); ++ return 0; ++ } ++ ++ fclose(f); ++ return 1; ++} + + /* make sure a directory exists */ + int create_dir(const char *dir) --- ccache-2.4.orig/debian/patches/01_no_home.diff +++ ccache-2.4/debian/patches/01_no_home.diff @@ -0,0 +1,104 @@ +diff --git a/ccache.c b/ccache.c +index c15ced5..e7272d5 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -836,6 +836,13 @@ static void ccache(int argc, char *argv[]) + { + /* find the real compiler */ + find_compiler(argc, argv); ++ ++ /* use the real compiler if HOME is not set */ ++ if (!cache_dir) { ++ cc_log("Unable to determine home directory\n"); ++ cc_log("ccache is disabled\n"); ++ failed(); ++ } + + /* we might be disabled */ + if (getenv("CCACHE_DISABLE")) { +@@ -895,6 +902,13 @@ static void usage(void) + printf("-V print version number\n"); + } + ++static void check_cache_dir(void) ++{ ++ if (!cache_dir) { ++ fatal("Unable to determine home directory"); ++ } ++} ++ + /* the main program when not doing a compile */ + static int ccache_main(int argc, char *argv[]) + { +@@ -914,31 +928,37 @@ static int ccache_main(int argc, char *argv[]) + exit(0); + + case 's': ++ check_cache_dir(); + stats_summary(); + break; + + case 'c': ++ check_cache_dir(); + cleanup_all(cache_dir); + printf("Cleaned cache\n"); + break; + + case 'C': ++ check_cache_dir(); + wipe_all(cache_dir); + printf("Cleared cache\n"); + break; + + case 'z': ++ check_cache_dir(); + stats_zero(); + printf("Statistics cleared\n"); + break; + + case 'F': ++ check_cache_dir(); + v = atoi(optarg); + stats_set_limits(v, -1); + printf("Set cache file limit to %u\n", (unsigned)v); + break; + + case 'M': ++ check_cache_dir(); + v = value_units(optarg); + stats_set_limits(-1, v); + printf("Set cache size limit to %uk\n", (unsigned)v); +@@ -983,7 +1003,10 @@ int main(int argc, char *argv[]) + + cache_dir = getenv("CCACHE_DIR"); + if (!cache_dir) { +- x_asprintf(&cache_dir, "%s/.ccache", get_home_directory()); ++ const char *home_directory = get_home_directory(); ++ if (home_directory) { ++ x_asprintf(&cache_dir, "%s/.ccache", home_directory); ++ } + } + + temp_dir = getenv("CCACHE_TEMPDIR"); +@@ -1023,7 +1046,7 @@ int main(int argc, char *argv[]) + } + + /* make sure the cache dir exists */ +- if (create_dir(cache_dir) != 0) { ++ if (cache_dir && (create_dir(cache_dir) != 0)) { + fprintf(stderr,"ccache: failed to create %s (%s)\n", + cache_dir, strerror(errno)); + exit(1); +diff --git a/util.c b/util.c +index ec5ccdd..962dd49 100644 +--- a/util.c ++++ b/util.c +@@ -448,7 +448,7 @@ const char *get_home_directory(void) + } + } + #endif +- fatal("Unable to determine home directory"); ++ cc_log("Unable to determine home directory"); + return NULL; + } + --- ccache-2.4.orig/debian/patches/CREDITS +++ ccache-2.4/debian/patches/CREDITS @@ -0,0 +1,59 @@ +01_no_home.diff: + Francois Marier + Made especially for the Debian package. + +02_ccache_compressed.diff: + Lars Gustäbel + http://www.gustaebel.de/lars/ccache/ (downloaded on 2007-05-20) + +03_long_options.diff: + Francois Marier + Made especially for the Debian package. + +04_ignore_profile.diff: + Ted Percival + http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=20;filename=ccache-profile.patch;att=1;bug=215849 + +05_nfs_fix.diff: + John Coiner + http://lists.samba.org/archive/ccache/2007q1/000265.html + +06_md.diff: + Andrea Bittau + http://darkircop.org/ccache/ccache-2.4-md.patch (downloaded on 2007-06-30) + +07_cachedirtag.diff: + Karl Chen + http://lists.samba.org/archive/ccache/2008q1/000316.html (downloaded on 2008-02-02) + +08_manpage_hyphens.diff: + Francois Marier + Made especially for the Debian package. + +09_respect_ldflags.diff: + Lisa Seelye + http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/ccache/files/ccache-2.4-respectflags.patch?rev=1.1&view=markup + +10_lru_cleanup.diff: + RW + http://lists.samba.org/archive/ccache/2008q2/000339.html (downloaded on 2008-04-11) + +11_utimes.diff: + Robin H. Johnson + http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/ccache/files/ccache-2.4-utimes.patch?rev=1.1&view=markup + +12_cachesize_permissions.diff: + Francois Marier + Made especially for the Debian package to fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=332527 + +13_html_links.diff: + Ville Skytta + http://cvs.fedoraproject.org/viewcvs/rpms/ccache/F-9/ccache-html-links.patch?rev=1.1&view=markup + +14_hardlink_doc.diff: + Ville Skytta + http://cvs.fedoraproject.org/viewcvs/rpms/ccache/F-9/ccache-2.4-hardlink-doc.patch?rev=1.1&view=markup + +15_gcc4.3_warnings.diff: + William S Fulton + http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=gcc4.3warnings-clean.patch;att=1;bug=508046