0002-add-option-to-build-tests.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. From cdccbc6ec36243463613cb32d7058c26c3c51e16 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <Aduskett@gmail.com>
  3. Date: Wed, 18 Sep 2019 09:50:00 -0700
  4. Subject: [PATCH] add option to build tests.
  5. Upstream won't build tests when cross-compiling. However; this means still
  6. building the tests during a host build. Building the tests causes build
  7. failures on older distributions such as CentOS 6 and Debian 7 because the
  8. command `objcopy --add-symbol` is used when building the test
  9. "test_resources2," which is not available with the older version of objcopy
  10. provided by the distributions.
  11. Instead, add the option 'tests' which when set to false, enforces not
  12. building any tests, even when building the host variant.
  13. Signed-off-by: Adam Duskett <Aduskett@gmail.com>
  14. ---
  15. gio/meson.build | 1 -
  16. glib/meson.build | 3 +-
  17. gobject/meson.build | 1 -
  18. meson.build | 2 +-
  19. meson_options.txt | 5 +++++
  20. 5 files changed, 6 insertions(+), 5 deletions(-)
  21. diff --git a/gio/meson.build b/gio/meson.build
  22. index 9a9e621..6adc014 100644
  23. --- a/gio/meson.build
  24. +++ b/gio/meson.build
  25. @@ -1010,7 +1010,6 @@ endif
  26. subdir('fam')
  27. # Don’t build the tests unless we can run them (either natively or in an exe wrapper)
  28. -build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
  29. if build_tests
  30. subdir('tests')
  31. endif
  32. diff --git a/glib/meson.build b/glib/meson.build
  33. index 91a48f1..230d562 100644
  34. --- a/glib/meson.build
  35. +++ b/glib/meson.build
  36. @@ -458,8 +458,7 @@ if enable_systemtap
  37. )
  38. endif
  39. -# Don’t build the tests unless we can run them (either natively or in an exe wrapper)
  40. -build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
  41. +build_tests = get_option('tests')
  42. if build_tests
  43. subdir('tests')
  44. endif
  45. diff --git a/gobject/meson.build b/gobject/meson.build
  46. index c7805c5..fb5874d 100644
  47. --- a/gobject/meson.build
  48. +++ b/gobject/meson.build
  49. @@ -166,7 +166,6 @@ if enable_systemtap
  50. endif
  51. # Don’t build the tests unless we can run them (either natively or in an exe wrapper)
  52. -build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
  53. if build_tests
  54. subdir('tests')
  55. endif
  56. diff --git a/meson.build b/meson.build
  57. index 717d1bc..3124f28 100644
  58. --- a/meson.build
  59. +++ b/meson.build
  60. @@ -2098,7 +2098,7 @@ subdir('gmodule')
  61. subdir('gio')
  62. subdir('fuzzing')
  63. # Don’t build the tests unless we can run them (either natively or in an exe wrapper)
  64. -build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
  65. +build_tests = get_option('tests')
  66. if build_tests
  67. subdir('tests')
  68. endif
  69. diff --git a/meson_options.txt b/meson_options.txt
  70. index 2c831e3..90468a7 100644
  71. --- a/meson_options.txt
  72. +++ b/meson_options.txt
  73. @@ -90,6 +90,11 @@ option('nls',
  74. yield: true,
  75. description : 'Enable native language support (translations)')
  76. +option('tests',
  77. + type : 'boolean',
  78. + value : false,
  79. + description : 'Build tests')
  80. +
  81. option('oss_fuzz',
  82. type : 'feature',
  83. value : 'disabled',
  84. --
  85. 2.21.0