File: meson.build

package info (click to toggle)
tang 15-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 468 kB
  • sloc: ansic: 1,079; sh: 439; makefile: 13
file content (104 lines) | stat: -rw-r--r-- 2,922 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
project('tang', 'c',
  version: '15',
  license: 'GPL3+',
  default_options: [
    'c_std=c99',
    'prefix=/usr',
    'sysconfdir=/etc',
    'localstatedir=/var',
    'warning_level=3',
    'werror=true'
  ]
)

libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
bindir = join_paths(get_option('prefix'), get_option('bindir'))
systemunitdir = join_paths(get_option('prefix'), 'lib/systemd/system')
licensedir = join_paths(get_option('prefix'), 'share', 'licenses', meson.project_name())
if host_machine.system() == 'freebsd'
  licensedir += '-'+meson.project_version()
endif
jwkdir = join_paths('/var/lib/tang')

data = configuration_data()
data.set('libexecdir', libexecdir)
data.set('sysconfdir', sysconfdir)
data.set('systemunitdir', systemunitdir)
data.set('jwkdir', jwkdir)
data.set('user', get_option('user'))
data.set('group', get_option('group'))

add_project_arguments(
  '-D_POSIX_C_SOURCE=200809L',
  '-Wstrict-aliasing',
  '-Wchar-subscripts',
  '-Wformat',
  '-Wformat-security',
  '-Wmissing-declarations',
  '-Wmissing-prototypes',
  '-Wnested-externs',
  '-Wpointer-arith',
  '-Wshadow',
  '-Wsign-compare',
  '-Wstrict-prototypes',
  '-Wtype-limits',
  '-Wunused-function',
  '-Wno-missing-field-initializers',
  '-Wno-unused-parameter',
  '-Wno-pedantic',
  language: 'c'
)

add_project_arguments('-DVERSION="'+meson.project_version() + '"', language : 'c')

jose = dependency('jose', version: '>=8')
asciidoctor = find_program('asciidoctor', required: false)
compiler = meson.get_compiler('c')

http_lib = []
if compiler.has_header('llhttp.h', args: '-I/usr/local/include')
  http_lib = 'llhttp'
  add_project_arguments('-DUSE_LLHTTP', language: 'c')
else
  if not compiler.has_header('http_parser.h', args: '-I/usr/local/include')
    error('neither llhttp nor http-parser devel files found.')
  endif
  http_lib = 'http_parser'
endif

if host_machine.system() == 'freebsd'
  http_parser = compiler.find_library(http_lib, dirs : '/usr/local/lib')
else
  http_parser = compiler.find_library(http_lib)
endif

licenses = ['COPYING']
libexecbins = []
bins = []
mans = []
units = []

subdir('doc')
subdir('src')
subdir('units')
subdir('tests')

install_data(libexecbins, install_dir: libexecdir)
install_data(bins, install_dir: bindir)
install_data(units, install_dir: systemunitdir)
install_data(licenses, install_dir: licensedir)

if asciidoctor.found()
  foreach m : mans
    custom_target(m.split('/')[-1], input: m + '.adoc', output: m.split('/')[-1],
      command: [asciidoctor, '--attribute', 'reproducible', '--backend=manpage', '-D', meson.current_build_dir(), '@INPUT@'],
      install_dir: join_paths(get_option('mandir'), 'man' + m.split('.')[-1]),
      install: true
    )
  endforeach
else
  warning('Will not build man pages due to missing asciidoctor dependency!')
endif

# vim:set ts=2 sw=2 et: