summaryrefslogtreecommitdiffstats
path: root/src/resolve/meson.build
blob: e11aefce7acb7418b2fed984ab926e5924a12d92 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# SPDX-License-Identifier: LGPL-2.1-or-later

resolve_includes = [includes, include_directories('.')]

basic_dns_sources = files(
        'resolved-dns-dnssec.c',
        'resolved-dns-dnssec.h',
        'resolved-dns-packet.c',
        'resolved-dns-packet.h',
        'resolved-dns-rr.c',
        'resolved-dns-rr.h',
        'resolved-dns-answer.c',
        'resolved-dns-answer.h',
        'resolved-dns-question.c',
        'resolved-dns-question.h',
        'resolved-util.c',
        'resolved-util.h',
        'dns-type.c',
        'dns-type.h',
)

systemd_resolved_sources = files(
        'resolved-bus.c',
        'resolved-bus.h',
        'resolved-conf.c',
        'resolved-conf.h',
        'resolved-def.h',
        'resolved-dns-cache.c',
        'resolved-dns-cache.h',
        'resolved-dns-query.c',
        'resolved-dns-query.h',
        'resolved-dns-scope.c',
        'resolved-dns-scope.h',
        'resolved-dns-search-domain.c',
        'resolved-dns-search-domain.h',
        'resolved-dns-server.c',
        'resolved-dns-server.h',
        'resolved-dns-stream.c',
        'resolved-dns-stream.h',
        'resolved-dns-stub.c',
        'resolved-dns-stub.h',
        'resolved-dns-synthesize.c',
        'resolved-dns-synthesize.h',
        'resolved-dns-transaction.c',
        'resolved-dns-transaction.h',
        'resolved-dns-trust-anchor.c',
        'resolved-dns-trust-anchor.h',
        'resolved-dns-zone.c',
        'resolved-dns-zone.h',
        'resolved-dnssd-bus.c',
        'resolved-dnssd-bus.h',
        'resolved-dnssd.c',
        'resolved-dnssd.h',
        'resolved-dnstls.h',
        'resolved-etc-hosts.c',
        'resolved-etc-hosts.h',
        'resolved-link-bus.c',
        'resolved-link-bus.h',
        'resolved-link.c',
        'resolved-link.h',
        'resolved-llmnr.c',
        'resolved-llmnr.h',
        'resolved-manager.c',
        'resolved-manager.h',
        'resolved-mdns.c',
        'resolved-mdns.h',
        'resolved-resolv-conf.c',
        'resolved-resolv-conf.h',
        'resolved-socket-graveyard.c',
        'resolved-socket-graveyard.h',
        'resolved-varlink.c',
        'resolved-varlink.h',
)

resolvectl_sources = files(
         'resolvconf-compat.c',
         'resolvconf-compat.h',
         'resolvectl.c',
         'resolvectl.h',
)

############################################################

dns_type_list_txt = custom_target(
        'dns_type-list.txt',
        input : ['generate-dns_type-list.sed', 'dns-type.h'],
        output : 'dns_type-list.txt',
        command : [sed, '-n', '-r', '-f', '@INPUT0@', '@INPUT1@'],
        capture : true)

generate_dns_type_gperf = find_program('generate-dns_type-gperf.py')

gperf_file = custom_target(
        'dns_type-from-name.gperf',
        input : dns_type_list_txt,
        output : 'dns_type-from-name.gperf',
        command : [generate_dns_type_gperf, 'dns_type', 'DNS_TYPE_', '@INPUT@'],
        capture : true)

basic_dns_sources += custom_target(
        'dns_type-from-name.h',
        input : gperf_file,
        output : 'dns_type-from-name.h',
        command : [gperf,
                   '-L', 'ANSI-C', '-t', '--ignore-case',
                   '-N', 'lookup_dns_type',
                   '-H', 'hash_dns_type_name',
                   '-p', '-C',
                   '@INPUT@'],
        capture : true)

basic_dns_sources += custom_target(
        'dns_type-to-name.h',
        input : ['dns_type-to-name.awk', dns_type_list_txt],
        output : 'dns_type-to-name.h',
        command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
        capture : true)

libsystemd_resolve_core = static_library(
        'systemd-resolve-core',
        basic_dns_sources,
        include_directories : includes,
        build_by_default : false)

systemd_resolved_sources += custom_target(
        'resolved_gperf.c',
        input : 'resolved-gperf.gperf',
        output : 'resolved-gperf.c',
        command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])

systemd_resolved_sources += custom_target(
        'resolved_dnssd_gperf.c',
        input : 'resolved-dnssd-gperf.gperf',
        output : 'resolved-dnssd-gperf.c',
        command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])

systemd_resolved_dependencies = [threads, libm] + [lib_openssl_or_gcrypt]
if conf.get('ENABLE_DNS_OVER_TLS') == 1
        if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
                systemd_resolved_sources += files(
                        'resolved-dnstls-gnutls.c',
                        'resolved-dnstls-gnutls.h',
                )
                systemd_resolved_dependencies += libgnutls
        elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
                systemd_resolved_sources += files(
                        'resolved-dnstls-openssl.c',
                        'resolved-dnstls-openssl.h',
                )
                systemd_resolved_dependencies += libopenssl
        else
                error('unknown dependency for supporting DNS-over-TLS')
        endif
endif

if conf.get('ENABLE_RESOLVE') == 1
        install_data('org.freedesktop.resolve1.conf',
                     install_dir : dbuspolicydir)
        install_data('org.freedesktop.resolve1.service',
                     install_dir : dbussystemservicedir)
        install_data('org.freedesktop.resolve1.policy',
                     install_dir : polkitpolicydir)
        install_data('resolv.conf',
                     install_dir : rootlibexecdir)
endif

custom_target(
        'resolved.conf',
        input : 'resolved.conf.in',
        output : 'resolved.conf',
        command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
        install : conf.get('ENABLE_RESOLVE') == 1 and install_sysconfdir_samples,
        install_dir : pkgsysconfdir)

############################################################

tests += [
        [files('test-resolve-tables.c'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm]],

        [files('test-dns-packet.c'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm]],

        [files('test-resolved-etc-hosts.c',
               'resolved-etc-hosts.c',
               'resolved-etc-hosts.h'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm]],

        [files('test-resolved-packet.c'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm]],

        [files('test-resolved-stream.c')
         + basic_dns_sources + systemd_resolved_sources,
         [libshared],
         [lib_openssl_or_gcrypt,
          libm]
         + systemd_resolved_dependencies,
         resolve_includes],

        [files('test-dnssec.c'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm],
         [], 'HAVE_OPENSSL_OR_GCRYPT'],

        [files('test-dnssec-complex.c'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm],
         [], '', 'manual'],
]

fuzzers += [
        [files('fuzz-dns-packet.c'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm]],
        [files('fuzz-etc-hosts.c',
          'resolved-etc-hosts.c',
          'resolved-etc-hosts.h'),
         [libsystemd_resolve_core,
          libshared],
         [lib_openssl_or_gcrypt,
          libm]],
]

systemd_resolved_sources += files('resolved.c')