phase1, phase2: add unified ccache handling
authorJo-Philipp Wich <jo@mein.io>
Sun, 22 Jan 2017 14:23:13 +0000 (15:23 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 22 Jan 2017 14:23:45 +0000 (15:23 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/ccache.sh [new file with mode: 0755]
phase1/master.cfg
phase2/master.cfg

diff --git a/phase1/ccache.sh b/phase1/ccache.sh
new file mode 100755 (executable)
index 0000000..61590f2
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+export LC_ALL=C
+
+mkdir -p "$HOME/.ccache"
+
+grep -sq max_size "$HOME/.ccache/ccache.conf" || \
+       echo "max_size = 10.0G" >> "$HOME/.ccache/ccache.conf"
+
+grep -sq compiler_check "$HOME/.ccache/ccache.conf" || \
+       echo "compiler_check = %compiler% -dumpmachine; %compiler% -dumpversion" >> "$HOME/.ccache/ccache.conf"
+
+for dir in $(make --no-print-directory val.TOOLCHAIN_DIR val.STAGING_DIR val.STAGING_DIR_HOST V=s | grep staging_dir/); do
+       mkdir -p "$dir"
+       test -L "$dir/ccache" || rm -rf "$dir/ccache"
+       ln -s "$HOME/.ccache" "$dir/ccache"
+done
+
+./staging_dir/host/bin/ccache -s 2>/dev/null
+
+exit 0
index ae69309ecef9464a3879bd2cb577856609a21be6..bc21f809543e62cb3ad5c26692cec38090666475 100644 (file)
@@ -454,6 +454,20 @@ for target in targets:
                command=["./scripts/feeds", "install", "-a"],
                env = MakeEnv()))
 
+       # ccache helper
+       factory.addStep(FileDownload(
+               mastersrc = "ccache.sh",
+               slavedest = "ccache.sh",
+               mode = 0755
+       ))
+
+       # ccache prepare
+       factory.addStep(ShellCommand(
+                name = "prepccache",
+                description = "Preparing ccache",
+                command = ["./ccache.sh"]
+       ))
+
        # seed config
        factory.addStep(FileDownload(
                mastersrc = "config.seed",
index 08b5387c12ddbe013282ae7d35845e41bba089b5..d6d2e224edd6f3387a42fe2e2b09f2eae31d3f54 100644 (file)
@@ -287,6 +287,17 @@ for arch in arches:
                workdir = "build/sdk",
                command = ["sh", "-c", "rm -f .config && make defconfig"]))
 
+       factory.addStep(FileDownload(
+               mastersrc = home_dir+'/ccache.sh',
+               slavedest = 'sdk/ccache.sh',
+               mode = 0755))
+
+       factory.addStep(ShellCommand(
+               name = "prepccache",
+               description = "Preparing ccache",
+               workdir = "build/sdk",
+               command = ["./ccache.sh"]))
+
        factory.addStep(ShellCommand(
                name = "updatefeeds",
                description = "Updating feeds",