You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.4 KiB

  1. From a197e0cafb276a9b732f914b1f679ebb487b47f1 Mon Sep 17 00:00:00 2001
  2. From: pinglin <pinglin@synology.com>
  3. Date: Tue, 19 Mar 2019 20:46:27 +0800
  4. Subject: [PATCH] cross_compile argument doesn't apply
  5. reproduce:
  6. ./configure --cross-compile --cross-answers=XXX
  7. The output log now will show correct cross-answers.
  8. ---
  9. third_party/waf/waflib/Context.py | 20 ++++++++++++++++++--
  10. third_party/waf/waflib/Tools/c_config.py | 11 +++++++----
  11. 2 files changed, 25 insertions(+), 6 deletions(-)
  12. diff --git a/third_party/waf/waflib/Context.py b/third_party/waf/waflib/Context.py
  13. index 3222fb1551c..d1c87512095 100644
  14. --- a/third_party/waf/waflib/Context.py
  15. +++ b/third_party/waf/waflib/Context.py
  16. @@ -359,8 +359,16 @@ class Context(ctx):
  17. encoding = kw.pop('decode_as', default_encoding)
  18. + exec_args = kw.pop('exec_args', [])
  19. + if isinstance(cmd, str):
  20. + cmd = [cmd] + exec_args
  21. + elif isinstance(cmd, list):
  22. + cmd = cmd + exec_args
  23. try:
  24. - ret, out, err = Utils.run_process(cmd, kw, cargs)
  25. + if exec_args:
  26. + ret, out, err = Utils.run_regular_process(cmd, kw, cargs)
  27. + else:
  28. + ret, out, err = Utils.run_process(cmd, kw, cargs)
  29. except Exception as e:
  30. raise Errors.WafError('Execution failure: %s' % str(e), ex=e)
  31. @@ -438,8 +446,16 @@ class Context(ctx):
  32. encoding = kw.pop('decode_as', default_encoding)
  33. + exec_args = kw.pop('exec_args', [])
  34. + if isinstance(cmd, str):
  35. + cmd = [cmd] + exec_args
  36. + elif isinstance(cmd, list):
  37. + cmd = cmd + exec_args
  38. try:
  39. - ret, out, err = Utils.run_process(cmd, kw, cargs)
  40. + if exec_args:
  41. + ret, out, err = Utils.run_regular_process(cmd, kw, cargs)
  42. + else:
  43. + ret, out, err = Utils.run_process(cmd, kw, cargs)
  44. except Exception as e:
  45. raise Errors.WafError('Execution failure: %s' % str(e), ex=e)
  46. diff --git a/third_party/waf/waflib/Tools/c_config.py b/third_party/waf/waflib/Tools/c_config.py
  47. index 76082152cd9..25e468b0844 100644
  48. --- a/third_party/waf/waflib/Tools/c_config.py
  49. +++ b/third_party/waf/waflib/Tools/c_config.py
  50. @@ -660,20 +660,23 @@ class test_exec(Task.Task):
  51. """
  52. color = 'PINK'
  53. def run(self):
  54. + exec_args = Utils.to_list(self.generator.exec_args)
  55. +
  56. if getattr(self.generator, 'rpath', None):
  57. if getattr(self.generator, 'define_ret', False):
  58. - self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()])
  59. + self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], exec_args=exec_args)
  60. else:
  61. - self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()])
  62. + self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], exec_args=exec_args)
  63. else:
  64. env = self.env.env or {}
  65. env.update(dict(os.environ))
  66. for var in ('LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'PATH'):
  67. env[var] = self.inputs[0].parent.abspath() + os.path.pathsep + env.get(var, '')
  68. +
  69. if getattr(self.generator, 'define_ret', False):
  70. - self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env)
  71. + self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env, exec_args=exec_args)
  72. else:
  73. - self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env)
  74. + self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env, exec_args=exec_args)
  75. @feature('test_exec')
  76. @after_method('apply_link')
  77. --
  78. 2.17.1