Created
October 18, 2022 01:13
-
-
Save wrl/0ea026744b2d6939be2cc608daff8091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# cross_compile.py - waf tool for cross-compilation | |
# Written in 2017 by William Light <[email protected]> | |
# | |
# To the extent possible under law, the author(s) have dedicated all copyright | |
# and related and neighboring rights to this software to the public domain | |
# worldwide. This software is distributed without any warranty. | |
# | |
# You should have received a copy of the CC0 Public Domain Dedication along | |
# with this software. If not, see | |
# <http://creativecommons.org/publicdomain/zero/1.0/>. | |
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('--target', action='store', default=False) | |
def configure(ctx): | |
if ctx.options.target: | |
override_find_program(ctx.options.target) | |
ctx.env.ARE_WE_CROSS_COMPILING = True | |
else: | |
ctx.env.ARE_WE_CROSS_COMPILING = False | |
# 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