meson.build 2.9 KB

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