0003-Allow-overriding-g-ir-scanner-and-g-ir-compiler-bina.patch 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From 49b1c8df7e4ff3a441d831f926d87920952025bf Mon Sep 17 00:00:00 2001
  2. From: James Hilliard <james.hilliard1@gmail.com>
  3. Date: Sat, 2 May 2020 20:43:36 -0600
  4. Subject: [PATCH] Allow overriding g-ir-scanner and g-ir-compiler binaries.
  5. This is useful when one needs to force meson to use wrappers for cross
  6. compilation.
  7. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  8. [james.hilliard1@gmail.com: backport and largely adapt upstream commit
  9. 1e073c4c1bd7de06bc74d84e3807c9b210e57a22, as the version in master has
  10. undergone haevy refactorisation]
  11. ---
  12. mesonbuild/modules/gnome.py | 34 +++++++++++++++++++++-------------
  13. 1 file changed, 21 insertions(+), 13 deletions(-)
  14. diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
  15. index a00005588..b6d7cc141 100644
  16. --- a/mesonbuild/modules/gnome.py
  17. +++ b/mesonbuild/modules/gnome.py
  18. @@ -32,7 +32,7 @@ from ..mesonlib import (
  19. MachineChoice, MesonException, OrderedSet, Popen_safe, extract_as_list,
  20. join_args, unholder,
  21. )
  22. -from ..dependencies import Dependency, PkgConfigDependency, InternalDependency
  23. +from ..dependencies import Dependency, PkgConfigDependency, InternalDependency, ExternalProgram
  24. from ..interpreterbase import noKwargs, permittedKwargs, FeatureNew, FeatureNewKwargs
  25. # gresource compilation is broken due to the way
  26. @@ -735,21 +735,29 @@ class GnomeModule(ExtensionModule):
  27. # these utilities via pkg-config, so it would be best to use the
  28. # results from pkg-config when possible.
  29. gi_util_dirs_check = [state.environment.get_build_dir(), state.environment.get_source_dir()]
  30. - giscanner = self.interpreter.find_program_impl('g-ir-scanner')
  31. - if giscanner.found():
  32. - giscanner_path = giscanner.get_command()[0]
  33. - if not any(x in giscanner_path for x in gi_util_dirs_check):
  34. - giscanner = self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {})
  35. + giscanner_bin = state.environment.lookup_binary_entry(MachineChoice.HOST, 'g-ir-scanner')
  36. + if giscanner_bin is not None:
  37. + giscanner = ExternalProgram.from_entry('g-ir-scanner', giscanner_bin)
  38. else:
  39. - giscanner = self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {})
  40. + giscanner = self.interpreter.find_program_impl('g-ir-scanner')
  41. + if giscanner.found():
  42. + giscanner_path = giscanner.get_command()[0]
  43. + if not any(x in giscanner_path for x in gi_util_dirs_check):
  44. + giscanner = self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {})
  45. + else:
  46. + giscanner = self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {})
  47. - gicompiler = self.interpreter.find_program_impl('g-ir-compiler')
  48. - if gicompiler.found():
  49. - gicompiler_path = gicompiler.get_command()[0]
  50. - if not any(x in gicompiler_path for x in gi_util_dirs_check):
  51. - gicompiler = self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {})
  52. + gicompiler_bin = state.environment.lookup_binary_entry(MachineChoice.HOST, 'g-ir-compiler')
  53. + if gicompiler_bin is not None:
  54. + gicompiler = ExternalProgram.from_entry('g-ir-compiler', gicompiler_bin)
  55. else:
  56. - gicompiler = self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {})
  57. + gicompiler = self.interpreter.find_program_impl('g-ir-compiler')
  58. + if gicompiler.found():
  59. + gicompiler_path = gicompiler.get_command()[0]
  60. + if not any(x in gicompiler_path for x in gi_util_dirs_check):
  61. + gicompiler = self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {})
  62. + else:
  63. + gicompiler = self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {})
  64. ns = kwargs.pop('namespace')
  65. nsversion = kwargs.pop('nsversion')
  66. --
  67. 2.25.1