wiki:Sccache

Version 1 (modified by Philippe Normand, 6 days ago) (diff)

--

Building with sccache(-dist)

This documentation applies to the WPE and GTK ports. From the sccache homepage:

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible, storing a cache in a remote storage using the Amazon Simple Cloud Storage Service (S3) API, the Google Cloud Storage (GCS) API, or Redis. It works as a client-server. The client spawns a server if one is not running already, and sends the wrapped command line as a request to the server, which then does the work and returns stdout/stderr for the job. The client-server model allows the server to be more efficient in its handling of the remote storage.

Sccache can also be used with local storage instead of remote.

Using the Flatpak SDK

First, generate a sccache config file. You will need an authentication token, specific to the scheduler you plan to use. By default the Igalia scheduler is used, unless you provide an override using the command-line: -s sccache.example.com

$ Tools/Scripts/webkit-flatpak -r -t <token>
$ cat WebKitBuild/UserFlatpak/sccache.toml
[dist]
scheduler_url = "https://sccache.igalia.com"
[[dist.toolchains]]
compiler_executable = "/usr/bin/c++"
archive_compiler_executable = "/usr/bin/g++"
type = "path_override"
archive = "/home/phil/WebKit/WebKitBuild/Toolchains/webkit-sdk-gcc-df05b4231b1586d4bc07430d8353065c.tar.gz"

[[dist.toolchains]]
compiler_executable = "/usr/bin/clang++"
archive_compiler_executable = "/usr/bin/clang++"
type = "path_override"
archive = "/home/phil/WebKit/WebKitBuild/Toolchains/webkit-sdk-clang-1898673fc91e702aa44006e0195695a3.tar.gz"

[dist.auth]
token = "s3cr3t-tok3n"
type = "token"

Then build WebKit. By default the generated config file will be used, unless you explicitly set the SCCACHE_CONFIG env var to an existing path.

$ export WEBKIT_USE_SCCACHE=1
$ export NUMBER_OF_PROCESSORS=40
$ Tools/Scripts/build-webkit --gtk 

If you have access to a Redis instance, you can tell sccache to use it:

$ export SCCACHE_REDIS="redis://pass@host:port/dbpath"

Using JHBuild

You need to make sure you have a valid sccache config file and that sccache is installed on your build machine. Then use the same env vars as in the Flatpak SDK setup documented above.