summarylogtreecommitdiffstats
path: root/meson.build
blob: 6829e3e09626ac77c29cb0ceace2b49314a5583c (plain)
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
project('sigmavpn', 'c',
  version: '0.3alpha2',
  meson_version: '>=1.0',
  default_options: [
    'buildtype=debugoptimized',
    'b_ndebug=if-release',
    'c_std=gnu89',
  ],
)

config_path = get_option('prefix') / get_option('sysconfdir')
plugin_path = get_option('prefix') / get_option('libdir') / 'sigmavpn'

cc = meson.get_compiler('c')
add_project_arguments(
  cc.get_supported_arguments('-fcommon'),
  language: 'c',
)

libsodium_dep = dependency('libsodium')

executable('naclkeypair',
  'naclkeypair.c',
  dependencies: libsodium_dep,
  install: true,
)

executable('sigmavpn',
  'main.c',
  'modules.c',
  'types.c',
  'dep' / 'ini.c',
  c_args: [
    '-DPLUGIN_PATH="@0@"'.format(plugin_path),
    '-DCONFIG_PATH="@0@"'.format(config_path),
  ],
  dependencies: [libsodium_dep, dependency('dl')],
  install: true,
)

plugins = {
  'proto': ['raw', 'nacl0', 'nacltai'],
  'intf': ['dummy', 'tuntap', 'udp'],
}
foreach kind, items : plugins
  foreach name : items
    shared_module('@0@_@1@'.format(kind, name),
      kind / '@0@_@1@.c'.format(kind, name),
      dependencies: libsodium_dep,
      install_dir: plugin_path,
      install: true,
    )
  endforeach
endforeach

install_man('sigmavpn.1')
install_data('sigmavpn.conf', install_dir: config_path)