summaryrefslogtreecommitdiffstats
path: root/src/resolve/meson.build
blob: 92b67b6333d764ce474aeb05a7085fcfebd178ae (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
# SPDX-License-Identifier: LGPL-2.1+

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
        dns-type.c
'''.split())

dns_type_h = files('dns-type.h')[0]

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

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

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

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')

dns_type_headers = [dns_type_h]
foreach item : [['dns_type', dns_type_list_txt, 'dns_type', 'DNS_TYPE_']]

        fname = '@0@-from-name.gperf'.format(item[0])
        gperf_file = custom_target(
                fname,
                input : item[1],
                output : fname,
                command : [generate_dns_type_gperf, item[2], item[3], '@INPUT@'],
                capture : true)

        fname = '@0@-from-name.h'.format(item[0])
        target1 = custom_target(
                fname,
                input : gperf_file,
                output : fname,
                command : [gperf,
                           '-L', 'ANSI-C', '-t', '--ignore-case',
                           '-N', 'lookup_@0@'.format(item[2]),
                           '-H', 'hash_@0@_name'.format(item[2]),
                           '-p', '-C',
                           '@INPUT@'],
                capture : true)

        fname = '@0@-to-name.h'.format(item[0])
        awkscript = '@0@-to-name.awk'.format(item[0])
        target2 = custom_target(
                fname,
                input : [awkscript, item[1]],
                output : fname,
                command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
                capture : true)

        dns_type_headers += [target1, target2]
endforeach

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

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

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

systemd_resolved_sources += [resolved_gperf_c, resolved_dnssd_gperf_c]

systemd_resolved_dependencies = [threads, libgpg_error, libm, libidn]
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)

        resolved_conf = configure_file(
                input : 'resolved.conf.in',
                output : 'resolved.conf',
                configuration : substs)
        install_data(resolved_conf,
                     install_dir : pkgsysconfdir)

        install_data('resolv.conf',
                     install_dir : rootlibexecdir)
endif

tests += [
        [['src/resolve/test-resolve-tables.c',
          dns_type_headers,
          'src/shared/test-tables.h'],
         [libsystemd_resolve_core,
          libshared],
         [libgcrypt,
          libgpg_error,
          libm],
         'ENABLE_RESOLVE'],

        [['src/resolve/test-dns-packet.c',
          dns_type_headers],
         [libsystemd_resolve_core,
          libshared],
         [libgcrypt,
          libgpg_error,
          libm],
         'ENABLE_RESOLVE'],

        [['src/resolve/test-resolved-etc-hosts.c',
          'src/resolve/resolved-etc-hosts.c',
          'src/resolve/resolved-etc-hosts.h'],
         [libsystemd_resolve_core,
          libshared],
         [libgcrypt,
          libgpg_error,
          libm],
         'ENABLE_RESOLVE'],

        [['src/resolve/test-resolved-packet.c',
          dns_type_headers],
         [libsystemd_resolve_core,
          libshared],
         [libgcrypt,
          libgpg_error,
          libm],
         'ENABLE_RESOLVE'],

        [['src/resolve/test-dnssec.c',
          dns_type_headers],
         [libsystemd_resolve_core,
          libshared],
         [libgcrypt,
          libgpg_error,
          libm],
         'ENABLE_RESOLVE'],

        [['src/resolve/test-dnssec-complex.c',
          'src/resolve/dns-type.c',
          dns_type_headers],
         [],
         [],
         'ENABLE_RESOLVE', 'manual'],
]