meson.build 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. project('nagios-tang', 'c', license: 'GPL3+', version: '7',
  2. default_options: 'c_std=c99')
  3. add_project_arguments(
  4. '-Wall',
  5. '-Wextra',
  6. '-Werror',
  7. '-Wstrict-aliasing',
  8. '-Wchar-subscripts',
  9. '-Wformat-security',
  10. '-Wmissing-declarations',
  11. '-Wmissing-prototypes',
  12. '-Wnested-externs',
  13. '-Wpointer-arith',
  14. '-Wshadow',
  15. '-Wsign-compare',
  16. '-Wstrict-prototypes',
  17. '-Wtype-limits',
  18. '-Wunused-function',
  19. '-Wno-missing-field-initializers',
  20. '-Wno-unused-command-line-argument',
  21. '-Wno-unused-parameter',
  22. '-Wno-unknown-pragmas',
  23. language: 'c'
  24. )
  25. libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
  26. http = meson.get_compiler('c').find_library('http_parser')
  27. jose = dependency('jose', version: '>=8')
  28. actv = find_program('systemd-socket-activate', required: false)
  29. tang = find_program([
  30. join_paths(libexecdir, 'tangd'),
  31. '/usr/libexec/tangd',
  32. '/usr/local/libexec/tangd',
  33. ], required: false)
  34. kgen = find_program([
  35. join_paths(libexecdir, 'tangd-keygen'),
  36. '/usr/libexec/tangd-keygen',
  37. '/usr/local/libexec/tangd-keygen',
  38. ], required: false)
  39. updt = find_program([
  40. join_paths(libexecdir, 'tangd-update'),
  41. '/usr/libexec/tangd-update',
  42. '/usr/local/libexec/tangd-update',
  43. ], required: false)
  44. if tang.found() and kgen.found() and updt.found() and actv.found()
  45. env = environment()
  46. env.append('PATH',
  47. meson.current_build_dir(),
  48. libexecdir,
  49. '/usr/libexec',
  50. '/usr/local/libexec',
  51. separator: ':'
  52. )
  53. test('tang', find_program(meson.current_source_dir() + '/tang'), env: env)
  54. else
  55. warning('Will not run tests due to missing dependencies!')
  56. endif
  57. a2x = find_program('a2x', required: false)
  58. if a2x.found()
  59. custom_target('nagios-tang.1',
  60. command: [a2x, '-f', 'manpage', '-D', meson.current_build_dir(), '@INPUT@'],
  61. install_dir: join_paths(get_option('mandir'), 'man1'),
  62. input: 'nagios-tang.1.adoc',
  63. output: 'nagios-tang.1',
  64. install: true,
  65. )
  66. else
  67. warning('Will not install man page due to missing dependencies!')
  68. endif
  69. executable('tang', 'tang.c',
  70. install_dir: join_paths(get_option('libdir'), 'nagios', 'plugins'),
  71. dependencies: [http, jose],
  72. install: true,
  73. )