From a197e0cafb276a9b732f914b1f679ebb487b47f1 Mon Sep 17 00:00:00 2001 From: pinglin Date: Tue, 19 Mar 2019 20:46:27 +0800 Subject: [PATCH] cross_compile argument doesn't apply reproduce: ./configure --cross-compile --cross-answers=XXX The output log now will show correct cross-answers. --- third_party/waf/waflib/Context.py | 20 ++++++++++++++++++-- third_party/waf/waflib/Tools/c_config.py | 11 +++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/third_party/waf/waflib/Context.py b/third_party/waf/waflib/Context.py index 3222fb1551c..d1c87512095 100644 --- a/third_party/waf/waflib/Context.py +++ b/third_party/waf/waflib/Context.py @@ -359,8 +359,16 @@ class Context(ctx): encoding = kw.pop('decode_as', default_encoding) + exec_args = kw.pop('exec_args', []) + if isinstance(cmd, str): + cmd = [cmd] + exec_args + elif isinstance(cmd, list): + cmd = cmd + exec_args try: - ret, out, err = Utils.run_process(cmd, kw, cargs) + if exec_args: + ret, out, err = Utils.run_regular_process(cmd, kw, cargs) + else: + ret, out, err = Utils.run_process(cmd, kw, cargs) except Exception as e: raise Errors.WafError('Execution failure: %s' % str(e), ex=e) @@ -438,8 +446,16 @@ class Context(ctx): encoding = kw.pop('decode_as', default_encoding) + exec_args = kw.pop('exec_args', []) + if isinstance(cmd, str): + cmd = [cmd] + exec_args + elif isinstance(cmd, list): + cmd = cmd + exec_args try: - ret, out, err = Utils.run_process(cmd, kw, cargs) + if exec_args: + ret, out, err = Utils.run_regular_process(cmd, kw, cargs) + else: + ret, out, err = Utils.run_process(cmd, kw, cargs) except Exception as e: raise Errors.WafError('Execution failure: %s' % str(e), ex=e) diff --git a/third_party/waf/waflib/Tools/c_config.py b/third_party/waf/waflib/Tools/c_config.py index 76082152cd9..25e468b0844 100644 --- a/third_party/waf/waflib/Tools/c_config.py +++ b/third_party/waf/waflib/Tools/c_config.py @@ -660,20 +660,23 @@ class test_exec(Task.Task): """ color = 'PINK' def run(self): + exec_args = Utils.to_list(self.generator.exec_args) + if getattr(self.generator, 'rpath', None): if getattr(self.generator, 'define_ret', False): - self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()]) + self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], exec_args=exec_args) else: - self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()]) + self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], exec_args=exec_args) else: env = self.env.env or {} env.update(dict(os.environ)) for var in ('LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'PATH'): env[var] = self.inputs[0].parent.abspath() + os.path.pathsep + env.get(var, '') + if getattr(self.generator, 'define_ret', False): - self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env) + self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env, exec_args=exec_args) else: - self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env) + self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env, exec_args=exec_args) @feature('test_exec') @after_method('apply_link') -- 2.17.1