Skip to content

Instantly share code, notes, and snippets.

@kived
Created December 28, 2015 18:42
Show Gist options
  • Save kived/a651bd88eed9a43004f9 to your computer and use it in GitHub Desktop.
Save kived/a651bd88eed9a43004f9 to your computer and use it in GitHub Desktop.
p4a ccache fix
diff --git a/pythonforandroid/archs.py b/pythonforandroid/archs.py
index 3692c87..1b737ad 100644
--- a/pythonforandroid/archs.py
+++ b/pythonforandroid/archs.py
@@ -52,6 +52,11 @@ class Arch(object):
env['TOOLCHAIN_PREFIX'] = toolchain_prefix
env['TOOLCHAIN_VERSION'] = toolchain_version
+ ccache = ''
+ if self.ctx.ccache:
+ print('ccache found, will optimize builds')
+ ccache = self.ctx.ccache + ' '
+
print('path is', environ['PATH'])
cc = find_executable('{command_prefix}-gcc'.format(
command_prefix=command_prefix), path=environ['PATH'])
@@ -62,11 +67,13 @@ class Arch(object):
'installed. Exiting.')
exit(1)
- env['CC'] = '{command_prefix}-gcc {cflags}'.format(
+ env['CC'] = '{ccache}{command_prefix}-gcc {cflags}'.format(
command_prefix=command_prefix,
+ ccache=ccache,
cflags=env['CFLAGS'])
- env['CXX'] = '{command_prefix}-g++ {cxxflags}'.format(
+ env['CXX'] = '{ccache}{command_prefix}-g++ {cxxflags}'.format(
command_prefix=command_prefix,
+ ccache=ccache,
cxxflags=env['CXXFLAGS'])
env['AR'] = '{}-ar'.format(command_prefix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment