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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. From 8de64376005b8630ce5e29f45d5502a56b121173 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <Aduskett@gmail.com>
  3. Date: Wed, 8 May 2019 13:08:43 -0400
  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 | 4 +++-
  16. glib/meson.build | 5 +++--
  17. gobject/meson.build | 5 +++--
  18. meson.build | 6 +++++-
  19. meson_options.txt | 5 +++++
  20. 5 files changed, 19 insertions(+), 6 deletions(-)
  21. diff --git a/gio/meson.build b/gio/meson.build
  22. index 4e5e021..925563c 100644
  23. --- a/gio/meson.build
  24. +++ b/gio/meson.build
  25. @@ -994,4 +994,6 @@ if enable_systemtap
  26. endif
  27. subdir('fam')
  28. -subdir('tests')
  29. +if build_tests
  30. + subdir('tests')
  31. +endif
  32. diff --git a/glib/meson.build b/glib/meson.build
  33. index 8350ea2..bc1a7c5 100644
  34. --- a/glib/meson.build
  35. +++ b/glib/meson.build
  36. @@ -370,5 +370,6 @@ if enable_systemtap
  37. install_dir : tapset_install_dir,
  38. install : true)
  39. endif
  40. -
  41. -subdir('tests')
  42. +if build_tests
  43. + subdir('tests')
  44. +endif
  45. diff --git a/gobject/meson.build b/gobject/meson.build
  46. index db8d3c4..094cb58 100644
  47. --- a/gobject/meson.build
  48. +++ b/gobject/meson.build
  49. @@ -165,5 +165,6 @@ if enable_systemtap
  50. install_dir : tapset_install_dir,
  51. install : true)
  52. endif
  53. -
  54. -subdir('tests')
  55. +if build_tests
  56. + subdir('tests')
  57. +endif
  58. diff --git a/meson.build b/meson.build
  59. index b57b2d6..d625a50 100644
  60. --- a/meson.build
  61. +++ b/meson.build
  62. @@ -75,6 +75,8 @@ installed_tests_enabled = get_option('installed_tests')
  63. installed_tests_template = files('template.test.in')
  64. installed_tests_template_tap = files('template-tap.test.in')
  65. +build_tests = get_option('tests')
  66. +
  67. add_project_arguments('-D_GNU_SOURCE', language: 'c')
  68. # Disable strict aliasing;
  69. @@ -1994,8 +1996,10 @@ subdir('gthread')
  70. subdir('gmodule')
  71. subdir('gio')
  72. subdir('fuzzing')
  73. -subdir('tests')
  74. +if build_tests
  75. + subdir('tests')
  76. +endif
  77. # xgettext is optional (on Windows for instance)
  78. if find_program('xgettext', required : get_option('nls')).found()
  79. subdir('po')
  80. diff --git a/meson_options.txt b/meson_options.txt
  81. index 5c5b4df..7ffde0a 100644
  82. --- a/meson_options.txt
  83. +++ b/meson_options.txt
  84. @@ -89,3 +89,8 @@ option('nls',
  85. value : 'auto',
  86. yield: true,
  87. description : 'Enable native language support (translations)')
  88. +
  89. +option('tests',
  90. + type : 'boolean',
  91. + value : false,
  92. + description : 'Build tests')
  93. --
  94. 2.21.0