summaryrefslogtreecommitdiff
path: root/shared/n-acd/src/meson.build
blob: 3e92681f91b5a345f1aef00510d6c35ee18f8a26 (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
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
#
# target: libnacd.so
#

libnacd_symfile = join_paths(meson.current_source_dir(), 'libnacd.sym')

libnacd_deps = [
        dep_clist,
        dep_crbtree,
        dep_csiphash,
        dep_cstdaux,
]

libnacd_sources = [
        'n-acd.c',
        'n-acd-probe.c',
        'util/timer.c',
]

if use_ebpf
        libnacd_sources += [
                'n-acd-bpf.c',
        ]
else
        libnacd_sources += [
                'n-acd-bpf-fallback.c',
        ]
endif

libnacd_private = static_library(
        'nacd-private',
        libnacd_sources,
        c_args: [
                '-fvisibility=hidden',
                '-fno-common'
        ],
        dependencies: libnacd_deps,
        pic: true,
)

libnacd_shared = shared_library(
        'nacd',
        objects: libnacd_private.extract_all_objects(),
        dependencies: libnacd_deps,
        install: not meson.is_subproject(),
        soversion: 0,
        link_depends: libnacd_symfile,
        link_args: [
                '-Wl,--no-undefined',
                '-Wl,--version-script=@0@'.format(libnacd_symfile)
        ],
)

libnacd_dep = declare_dependency(
        include_directories: include_directories('.'),
        link_with: libnacd_private,
        dependencies: libnacd_deps,
        version: meson.project_version(),
)

if not meson.is_subproject()
        install_headers('n-acd.h')

        mod_pkgconfig.generate(
                libraries: libnacd_shared,
                version: meson.project_version(),
                name: 'libnacd',
                filebase: 'libnacd',
                description: project_description,
        )
endif

#
# target: test-*
#

test_api = executable('test-api', ['test-api.c'], link_with: libnacd_shared)
test('API Symbol Visibility', test_api)

if use_ebpf
        test_bpf = executable('test-bpf', ['test-bpf.c'], dependencies: libnacd_dep)
        test('eBPF socket filtering', test_bpf)
endif

test_loopback = executable('test-loopback', ['test-loopback.c'], dependencies: libnacd_dep)
test('Echo Suppression via Loopback', test_loopback)

test_timer = executable('test-timer', ['util/test-timer.c'], dependencies: libnacd_dep)
test('Timer helper', test_timer)

#test_unplug = executable('test-unplug', ['test-unplug.c'], dependencies: libnacd_dep)
#test('Async Interface Hotplug', test_unplug)

test_veth = executable('test-veth', ['test-veth.c'], dependencies: libnacd_dep)
test('Parallel ACD instances', test_veth)