meson.build 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. project('tang', 'c',
  2. version: '11',
  3. license: 'GPL3+',
  4. default_options: [
  5. 'c_std=c99',
  6. 'prefix=/usr',
  7. 'sysconfdir=/etc',
  8. 'localstatedir=/var',
  9. 'warning_level=3',
  10. 'werror=true'
  11. ]
  12. )
  13. libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
  14. sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
  15. bindir = join_paths(get_option('prefix'), get_option('bindir'))
  16. systemunitdir = join_paths(get_option('prefix'), 'lib/systemd/system')
  17. licensedir = join_paths(get_option('prefix'), 'share', 'licenses', meson.project_name())
  18. if host_machine.system() == 'freebsd'
  19. licensedir += '-'+meson.project_version()
  20. endif
  21. jwkdir = join_paths(get_option('localstatedir'), 'db', meson.project_name())
  22. data = configuration_data()
  23. data.set('libexecdir', libexecdir)
  24. data.set('sysconfdir', sysconfdir)
  25. data.set('systemunitdir', systemunitdir)
  26. data.set('jwkdir', jwkdir)
  27. data.set('user', get_option('user'))
  28. data.set('group', get_option('group'))
  29. add_project_arguments(
  30. '-D_POSIX_C_SOURCE=200809L',
  31. '-Wstrict-aliasing',
  32. '-Wchar-subscripts',
  33. '-Wformat',
  34. '-Wformat-security',
  35. '-Wmissing-declarations',
  36. '-Wmissing-prototypes',
  37. '-Wnested-externs',
  38. '-Wpointer-arith',
  39. '-Wshadow',
  40. '-Wsign-compare',
  41. '-Wstrict-prototypes',
  42. '-Wtype-limits',
  43. '-Wunused-function',
  44. '-Wno-missing-field-initializers',
  45. '-Wno-unused-parameter',
  46. '-Wno-pedantic',
  47. language: 'c'
  48. )
  49. jose = dependency('jose', version: '>=8')
  50. a2x = find_program('a2x', required: false)
  51. compiler = meson.get_compiler('c')
  52. if not compiler.has_header('http_parser.h',args : '-I/usr/local/include')
  53. error('http-parser devel files not found.')
  54. endif
  55. if host_machine.system() == 'freebsd'
  56. http_parser = compiler.find_library('http_parser',dirs : '/usr/local/lib')
  57. else
  58. http_parser = compiler.find_library('http_parser')
  59. endif
  60. licenses = ['COPYING']
  61. libexecbins = []
  62. bins = []
  63. mans = []
  64. units = []
  65. subdir('doc')
  66. subdir('src')
  67. subdir('units')
  68. subdir('tests')
  69. install_data(libexecbins, install_dir: libexecdir)
  70. install_data(bins, install_dir: bindir)
  71. install_data(units, install_dir: systemunitdir)
  72. install_data(licenses, install_dir: licensedir)
  73. if a2x.found()
  74. foreach m : mans
  75. custom_target(m.split('/')[-1], input: m + '.adoc', output: m.split('/')[-1],
  76. command: [a2x, '--attribute=' + build_machine.system(), '-f', 'manpage', '-D', meson.current_build_dir(), '@INPUT@'],
  77. install_dir: join_paths(get_option('mandir'), 'man' + m.split('.')[-1]),
  78. install: true
  79. )
  80. endforeach
  81. else
  82. warning('Will not build man pages due to missing a2x (asciidoc) dependency!')
  83. endif
  84. # vim:set ts=2 sw=2 et: