]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Disable compression by default
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 29 Apr 2010 16:25:26 +0000 (18:25 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 29 Apr 2010 16:25:26 +0000 (18:25 +0200)
NEWS.txt
ccache.c
manual.txt
test.sh

index a874424c50fddf6843a396ab6586e21db41d248c..f857dca21db5402db803afee0d000f7f58b1e6ef 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -54,10 +54,11 @@ New features and improvements
       `CCACHE_BASEDIR` environment variable to an absolute path that specifies
       which paths to rewrite.
 
-    - Object files are now by default stored compressed in the cache. The
+    - Object files are now optionally stored compressed in the cache. The
       runtime cost is negligible, and more files will fit in the ccache
-      directory and in the disk cache. `CCACHE_NOCOMPRESS` can be set to
-      disable object file compression.
+      directory and in the disk cache. Set `CCACHE_COMPRESS` to enable object
+      file compression. Note that you can't use compression in combination with
+      the hard link feature.
 
     - A `CCACHE_COMPILERCHECK` option has been added. This option tells ccache
       what compiler-identifying information to hash to ensure that results
index 53fc0b6679a1ef3b31e7c98d9c1a96e8d29017ff..727d9b8ff357b8ede548bc9609f3ff538f511840 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -586,7 +586,7 @@ static void to_cache(ARGS *args)
                failed();
        }
 
-       compress = !getenv("CCACHE_NOCOMPRESS");
+       compress = getenv("CCACHE_COMPRESS") ? 1 : 0;
 
        if (stat(tmp_stderr, &st) != 0) {
                cc_log("Failed to stat %s", tmp_stderr);
index a29877684d45f59a0609f6fcaf79adb410b5a97c..7274c276f7ca817657a1a19676844bafeaa6246b 100644 (file)
@@ -40,6 +40,7 @@ FEATURES
 * Easy installation.
 * Low overhead.
 * Optionally uses hard links where possible to avoid copies.
+* Optionally compresses files in the cache to reduce disk space.
 
 
 LIMITATIONS
@@ -170,6 +171,14 @@ cases you won't need any of these as the defaults will be fine.
     You can optionally set *CCACHE_CC* to force the name of the compiler to
     use. If you don't do this then ccache works it out from the command line.
 
+*CCACHE_COMPRESS*::
+
+    If you set the environment variable *CCACHE_COMPRESS* then ccache will
+    compress object files and other compiler output it puts in the cache.
+    However, this setting has no effect on how files are retrieved from the
+    cache; compressed and uncompressed results will still be usable regardless
+    of this setting.
+
 *CCACHE_COMPILERCHECK*::
 
     By default, ccache includes the modification time (mtime) and size of the
@@ -228,8 +237,8 @@ cases you won't need any of these as the defaults will be fine.
     compiler output rather than using a file copy. Using hard links is faster,
     but can confuse programs like ``make'' that rely on modification times.
     Hard links are never made for compressed cache files. This means that you
-    typically also should set the *CCACHE_NOCOMPRESS* variable if you want to
-    use hard links.
+    typically should not set the *CCACHE_COMPRESS* variable if you want to use
+    hard links.
 
 *CCACHE_HASHDIR*::
 
@@ -254,13 +263,6 @@ cases you won't need any of these as the defaults will be fine.
     of levels of hash in the cache directory. The default is 2. The minimum is
     1 and the maximum is 8.
 
-*CCACHE_NOCOMPRESS*::
-
-    If you set the environment variable *CCACHE_NOCOMPRESS* then no compression
-    is used for 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.
-
 *CCACHE_NODIRECT*::
 
     If you set the environment variable *CCACHE_NODIRECT* then ccache will not
@@ -344,10 +346,10 @@ various statistics).
 CACHE COMPRESSION
 -----------------
 
-By default, ccache will compress all files it puts into the cache using the
+ccache can optionally compress all files it puts into the cache using the
 compression library zlib. While this involves a negligible performance
 slowdown, it significantly increases the number of files that fit in the cache.
-You can turn off compression by setting the *CCACHE_NOCOMPRESS* environment
+You can turn on compression by setting the *CCACHE_COMPRESS* environment
 variable.
 
 
diff --git a/test.sh b/test.sh
index 10baa2e6d60bbf700586017b543f9de8942a6f72..933f4e00d2b390d7be3551d8085e42d31679df9f 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -37,6 +37,7 @@ TESTDIR=testdir.$$
 unset CCACHE_BASEDIR
 unset CCACHE_CC
 unset CCACHE_COMPILERCHECK
+unset CCACHE_COMPRESS
 unset CCACHE_CPP2
 unset CCACHE_DIR
 unset CCACHE_DISABLE
@@ -46,7 +47,6 @@ unset CCACHE_HARDLINK
 unset CCACHE_HASHDIR
 unset CCACHE_LOGFILE
 unset CCACHE_NLEVELS
-unset CCACHE_NOCOMPRESS
 unset CCACHE_NODIRECT
 unset CCACHE_NOSTATS
 unset CCACHE_PATH
@@ -1023,17 +1023,17 @@ EOF
     ##################################################################
     # Check that compressed and uncompressed files get the same hash sum.
     testname="compression hash sum"
-    $CCACHE $COMPILER -c test.c
+    CCACHE_COMPRESS=1 $CCACHE $COMPILER -c test.c
     checkstat 'cache hit (direct)' 0
     checkstat 'cache hit (preprocessed)' 0
     checkstat 'cache miss' 1
 
-    $CCACHE $COMPILER -c test.c
+    CCACHE_COMPRESS=1 $CCACHE $COMPILER -c test.c
     checkstat 'cache hit (direct)' 0
     checkstat 'cache hit (preprocessed)' 1
     checkstat 'cache miss' 1
 
-    CCACHE_NOCOMPRESS=1 $CCACHE $COMPILER -c test.c
+    $CCACHE $COMPILER -c test.c
     checkstat 'cache hit (direct)' 0
     checkstat 'cache hit (preprocessed)' 2
     checkstat 'cache miss' 1