Feature: Use CCACHE_DIR from environment, if set

Closes: #288
Approved by: alexlarsson
auto
Olaf Leidinger 2019-05-17 18:08:40 +02:00 committed by Atomic Bot
parent 788ffbb630
commit 75c24ce291
2 changed files with 14 additions and 2 deletions

View File

@ -344,7 +344,8 @@
<term><option>--ccache</option></term>
<listitem><para>
Enable use of ccache in the build (needs ccache in the sdk)
Enable use of ccache in the build (needs ccache in the sdk). The default ccache folder can be
overridden by setting the environment variable CCACHE_DIR.
</para></listitem>
</varlistentry>

View File

@ -202,7 +202,18 @@ builder_context_constructed (GObject *object)
self->build_dir = g_file_get_child (self->state_dir, "build");
self->cache_dir = g_file_get_child (self->state_dir, "cache");
self->checksums_dir = g_file_get_child (self->state_dir, "checksums");
self->ccache_dir = g_file_get_child (self->state_dir, "ccache");
// Check, if CCACHE_DIR is set in environment and use it, instead of subdir of state_dir
const char * env_ccache_dir = g_getenv ("CCACHE_DIR");
if (env_ccache_dir && g_path_is_absolute(env_ccache_dir))
{
g_debug ("Using CCACHE_DIR '%s'", env_ccache_dir);
self->ccache_dir = g_file_new_for_path (env_ccache_dir);
}
else
{
self->ccache_dir = g_file_get_child(self->state_dir, "ccache");
}
}
static void