From: Rafael Kitover Date: Tue, 19 Jul 2022 08:31:04 +0000 (-0700) Subject: doc: Improve install guide (#1121) X-Git-Tag: v4.7~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d92e6741ae7d4d9548b83fff69ed13c8db4d65a1;p=thirdparty%2Fccache.git doc: Improve install guide (#1121) --- diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 641d01697..5c10109b4 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -11,31 +11,28 @@ To build ccache you need: languages](https://ccache.dev/platform-compiler-language-support.html) for details. - A C99 compiler. -- [libzstd](http://www.zstd.net). If you don't have libzstd installed and - can't or don't want to install it in a standard system location, there are - two options: +- [libzstd](http://www.zstd.net). If you don't have libzstd installed and can't + or don't want to install it in a standard system location, it will be + automatically downloaded, built and linked statically as part of the build + process. To disable this, pass `-DZSTD_FROM_INTERNET=OFF` to `cmake`. You can + also install zstd in a custom path and pass + `-DCMAKE_PREFIX_PATH=/some/custom/path` to `cmake`. - 1. Install zstd in a custom path and set `CMAKE_PREFIX_PATH` to it, e.g. - by passing `-DCMAKE_PREFIX_PATH=/some/custom/path` to `cmake`, or - 2. Pass `-DZSTD_FROM_INTERNET=ON` to `cmake` to make it download libzstd - from the Internet and unpack it in the local binary tree. Ccache will - then be linked statically to the locally built libzstd. - - To link libzstd statically you can use `-DZSTD_LIBRARY=/path/to/libzstd.a`. + To link libzstd statically, if you have a static libzstd available pass + `-DSTATIC_LINK=ON` to cmake, this is the default on Windows. Or use + `-DZSTD_LIBRARY=/path/to/libzstd.a`. Optional: - [hiredis](https://github.com/redis/hiredis) for the Redis storage backend. If you don't have libhiredis installed and can't or don't want to install it in a - standard system location, there are two options: - - 1. Install hiredis in a custom path and set `CMAKE_PREFIX_PATH` to it, e.g. - by passing `-DCMAKE_PREFIX_PATH=/some/custom/path` to `cmake`, or - 2. Pass `-DHIREDIS_FROM_INTERNET=ON` to `cmake` to make it download hiredis - from the Internet and unpack it in the local binary tree. Ccache will - then be linked statically to the locally built libhiredis. + standard system location, it will be automatically downloaded, built and + linked statically as part of the build process. To disable this, pass + `-DHIREDIS_FROM_INTERNET=OFF` to cmake. You can also install hiredis in a + custom path and pass `-DCMAKE_PREFIX_PATH=/some/custom/path` to `cmake`. - To link libhiredis statically you can use + To link libhiredis statically, if you have a static libhiredis available pass + `-DSTATIC_LINK=ON` to cmake, this is the default on Windows. Or use `-DHIREDIS_LIBRARY=/path/to/libhiredis.a`. - GNU Bourne Again SHell (bash) for tests. - [Asciidoctor](https://asciidoctor.org) to build the HTML documentation. @@ -52,11 +49,13 @@ Installation Here is the typical way to build and install ccache: - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - make - make install +```bash +mkdir build +cd build +cmake -DCMAKE_BUILD_TYPE=Release .. +make +make install +``` You can set the installation directory to e.g. `/usr` by adding `-DCMAKE_INSTALL_PREFIX=/usr` to the `cmake` command. You can set the directory @@ -72,21 +71,21 @@ There are two different ways to use ccache to cache a compilation: wish to use ccache for all your compilations. To do this, create a symbolic link to ccache named as the compiler. For example, here is set up ccache to masquerade as `gcc` and `g++`: -+ -------------------------------------------------------------------------------- + +```bash cp ccache /usr/local/bin/ ln -s ccache /usr/local/bin/gcc ln -s ccache /usr/local/bin/g++ -------------------------------------------------------------------------------- -+ -On platforms that don't support symbolic links you can simply copy ccache to the +``` + +. On platforms that don't support symbolic links you can simply copy ccache to the compiler name instead for a similar effect: -+ -------------------------------------------------------------------------------- + +```bash cp ccache /usr/local/bin/gcc cp ccache /usr/local/bin/g++ -------------------------------------------------------------------------------- -+ -And so forth. This will work as long as the directory with symbolic links or +``` + +. And so forth. This will work as long as the directory with symbolic links or ccache copies comes before the directory with the compiler (typically `/usr/bin`) in `PATH`.