From: York Sun Date: Tue, 4 Oct 2016 21:33:51 +0000 (-0700) Subject: tools: buildman: Add compiler wrapper X-Git-Tag: v2016.11-rc2~10^2~19 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d5fe013ceefe72466f192fd17f1dae8ce29684ef;p=u-boot tools: buildman: Add compiler wrapper Now we can use compiler wrapper such as ccache or distcc for buildman. Signed-off-by: York Sun CC: Simon Glass Acked-by: Simon Glass --- diff --git a/tools/buildman/README b/tools/buildman/README index 8c5f8610d0..514bebc9f8 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -211,6 +211,15 @@ arm: arm-none-eabi- and buildman will find arm-none-eabi-gcc in /usr/bin if you have it installed. +[toolchain-wrapper] +wrapper: ccache + +This tells buildman to use a compiler wrapper in front of CROSS_COMPILE. In +this example, ccache. It doesn't affect the toolchain scan. The wrapper is +added when CROSS_COMPILE environtal variable is set. The name in this +section is ignored. If more than one line is provided, only the last one +is taken. + 3. Make sure you have the require Python pre-requisites Buildman uses multiprocessing, Queue, shutil, StringIO, ConfigParser and diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 41e4e4c535..4778876201 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -127,6 +127,18 @@ class Toolchain: return PRIORITY_CALC + prio return PRIORITY_CALC + prio + def GetWrapper(self, show_warning=True): + """Get toolchain wrapper from the setting file. + """ + value = '' + for name, value in bsettings.GetItems('toolchain-wrapper'): + if not value: + print "Warning: Wrapper not found" + if value: + value = value + ' ' + + return value + def MakeEnvironment(self, full_path): """Returns an environment for using the toolchain. @@ -138,10 +150,12 @@ class Toolchain: PATH """ env = dict(os.environ) + wrapper = self.GetWrapper() + if full_path: - env['CROSS_COMPILE'] = os.path.join(self.path, self.cross) + env['CROSS_COMPILE'] = wrapper + os.path.join(self.path, self.cross) else: - env['CROSS_COMPILE'] = self.cross + env['CROSS_COMPILE'] = wrapper + self.cross env['PATH'] = self.path + ':' + env['PATH'] return env