meson.build 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. project('tang', 'c',
  2. version: '14',
  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. add_project_arguments('-DVERSION="'+meson.project_version() + '"', language : 'c')
  50. jose = dependency('jose', version: '>=8')
  51. a2x = find_program('a2x', required: false)
  52. compiler = meson.get_compiler('c')
  53. if not compiler.has_header('http_parser.h',args : '-I/usr/local/include')
  54. error('http-parser devel files not found.')
  55. endif
  56. if host_machine.system() == 'freebsd'
  57. http_parser = compiler.find_library('http_parser',dirs : '/usr/local/lib')
  58. else
  59. http_parser = compiler.find_library('http_parser')
  60. endif
  61. licenses = ['COPYING']
  62. libexecbins = []
  63. bins = []
  64. mans = []
  65. units = []
  66. subdir('doc')
  67. subdir('src')
  68. subdir('units')
  69. subdir('tests')
  70. install_data(libexecbins, install_dir: libexecdir)
  71. install_data(bins, install_dir: bindir)
  72. install_data(units, install_dir: systemunitdir)
  73. install_data(licenses, install_dir: licensedir)
  74. if a2x.found()
  75. foreach m : mans
  76. custom_target(m.split('/')[-1], input: m + '.adoc', output: m.split('/')[-1],
  77. command: [a2x, '--attribute=' + build_machine.system(), '-f', 'manpage', '-D', meson.current_build_dir(), '@INPUT@'],
  78. install_dir: join_paths(get_option('mandir'), 'man' + m.split('.')[-1]),
  79. install: true
  80. )
  81. endforeach
  82. else
  83. warning('Will not build man pages due to missing a2x (asciidoc) dependency!')
  84. endif
  85. # vim:set ts=2 sw=2 et: