Skip to content

Instantly share code, notes, and snippets.

@wrl
Created July 6, 2016 22:52
Show Gist options
  • Save wrl/8cc6b77e4d9792ea258f0d76a3d410f5 to your computer and use it in GitHub Desktop.
Save wrl/8cc6b77e4d9792ea258f0d76a3d410f5 to your computer and use it in GitHub Desktop.
waf cross compilation tool
#!/usr/bin/env python
def override_find_program(prefix):
from waflib.Configure import find_program as orig_find
from waflib.Configure import conf
if prefix[-1] != '-':
prefix += '-'
@conf
def find_program(self, filename, **kw):
if type(filename) == str:
return orig_find(self, prefix + filename, **kw)
else:
return orig_find(self, [prefix + x for x in filename], **kw)
return orig_find(self, filename, **kw)
def options(ctx):
xcomp_opts = ctx.add_option_group('cross-compilation')
xcomp_opts.add_option('--host', action='store', default=False)
def configure(ctx):
if ctx.options.host:
override_find_program(ctx.options.host)
# vim: set ts=4 sts=4 noet :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment