The ccache stage snap

This stage snap features a build of ccache to speed up development iteration of the snap.

Prerequisites

Currently only core18 snaps are supported

NOTE

This stage snap is in heavy development, the usage and presentation may change without notice.

How to use

Merge the following part definition to your snapcraft yaml:

parts:
  # Speed up snap build iteration during packaging development
  # https://forum.snapcraft.io/t/the-ccache-build-snap/10820
  ccache:
    plugin: nil
    stage-snaps:
    - ccache
    stage:
    - bin/ccache
    prime:
    - -*

Add ccache part to the dependency of all the parts that require building from C-like source:

parts:
  _part_name_:
    after:
    - ccache

Depending on the plugin you use, merge either of the following to all the parts that require building from C-like source:

parts:
  _part_name_:
    plugin: make
    build-environment:
    - CC: ccache gcc
    - CXX: ccache g++
parts:
  _part_name_:
    plugin: autotools
    configflags:
    - CC=ccache gcc
    - CXX=ccache g++

Known issues

  • FFmpeg failes to build with ccache enabled for some reason…

The implementation

TODO

  • Build ccache-core18 and ccache-core16