]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/meson.build
7701d3de0a35f4aa43a99a4c2d69fe48c36661ec
[thirdparty/systemd.git] / src / core / meson.build
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 libcore_sources = files(
4 'apparmor-setup.c',
5 'audit-fd.c',
6 'automount.c',
7 'bpf-devices.c',
8 'bpf-firewall.c',
9 'bpf-foreign.c',
10 'bpf-lsm.c',
11 'bpf-socket-bind.c',
12 'cgroup.c',
13 'core-varlink.c',
14 'dbus-automount.c',
15 'dbus-cgroup.c',
16 'dbus-device.c',
17 'dbus-execute.c',
18 'dbus-job.c',
19 'dbus-kill.c',
20 'dbus-manager.c',
21 'dbus-mount.c',
22 'dbus-path.c',
23 'dbus-scope.c',
24 'dbus-service.c',
25 'dbus-slice.c',
26 'dbus-socket.c',
27 'dbus-swap.c',
28 'dbus-target.c',
29 'dbus-timer.c',
30 'dbus-unit.c',
31 'dbus-util.c',
32 'dbus.c',
33 'device.c',
34 'dynamic-user.c',
35 'efi-random.c',
36 'emergency-action.c',
37 'exec-credential.c',
38 'execute.c',
39 'execute-serialize.c',
40 'generator-setup.c',
41 'ima-setup.c',
42 'import-creds.c',
43 'job.c',
44 'kill.c',
45 'kmod-setup.c',
46 'load-dropin.c',
47 'load-fragment.c',
48 'manager-dump.c',
49 'manager-serialize.c',
50 'manager.c',
51 'mount.c',
52 'namespace.c',
53 'path.c',
54 'restrict-ifaces.c',
55 'scope.c',
56 'selinux-access.c',
57 'selinux-setup.c',
58 'service.c',
59 'show-status.c',
60 'slice.c',
61 'smack-setup.c',
62 'socket.c',
63 'swap.c',
64 'target.c',
65 'timer.c',
66 'transaction.c',
67 'unit-dependency-atom.c',
68 'unit-printf.c',
69 'unit-serialize.c',
70 'unit.c',
71 )
72
73 if conf.get('BPF_FRAMEWORK') == 1
74 libcore_sources += files(
75 'bpf-util.c',
76 )
77 endif
78
79 subdir('bpf/socket_bind')
80 subdir('bpf/restrict_fs')
81 subdir('bpf/restrict_ifaces')
82
83 if conf.get('BPF_FRAMEWORK') == 1
84 libcore_sources += [
85 socket_bind_skel_h,
86 restrict_fs_skel_h,
87 restrict_ifaces_skel_h]
88 endif
89
90 load_fragment_gperf_gperf = custom_target(
91 'load-fragment-gperf.gperf',
92 input : 'load-fragment-gperf.gperf.in',
93 output: 'load-fragment-gperf.gperf',
94 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'])
95
96 load_fragment_gperf_c = custom_target(
97 'load-fragment-gperf.c',
98 input : load_fragment_gperf_gperf,
99 output : 'load-fragment-gperf.c',
100 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
101
102 awkscript = 'load-fragment-gperf-nulstr.awk'
103 load_fragment_gperf_nulstr_c = custom_target(
104 'load-fragment-gperf-nulstr.c',
105 input : [awkscript, load_fragment_gperf_gperf],
106 output : 'load-fragment-gperf-nulstr.c',
107 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
108 capture : true)
109
110 libcore_name = 'systemd-core-@0@'.format(shared_lib_tag)
111
112 libcore = shared_library(
113 libcore_name,
114 libcore_sources,
115 load_fragment_gperf_c,
116 load_fragment_gperf_nulstr_c,
117 include_directories : includes,
118 c_args : ['-fvisibility=default'],
119 link_args : ['-shared',
120 '-Wl,--version-script=' + libshared_sym_path],
121 link_depends : libshared_sym_path,
122 link_with : libshared,
123 dependencies : [libacl,
124 libapparmor,
125 libaudit,
126 libblkid,
127 libdl,
128 libkmod,
129 libm,
130 libmount,
131 libpam,
132 librt,
133 libseccomp,
134 libselinux,
135 threads,
136 userspace],
137 install : true,
138 install_dir : pkglibdir)
139
140 core_includes = [includes, include_directories('.')]
141
142 systemd_sources = files(
143 'main.c',
144 'crash-handler.c',
145 )
146
147 systemd_executor_sources = files(
148 'executor.c',
149 'exec-invoke.c',
150 )
151
152 executables += [
153 libexec_template + {
154 'name' : 'systemd',
155 'dbus' : true,
156 'public' : true,
157 'sources' : systemd_sources,
158 'link_with' : [
159 libcore,
160 libshared,
161 ],
162 'dependencies' : libseccomp,
163 },
164 libexec_template + {
165 'name' : 'systemd-executor',
166 'public' : true,
167 'sources' : systemd_executor_sources,
168 'include_directories' : core_includes,
169 'link_with' : [
170 libcore,
171 libshared,
172 ],
173 'dependencies' : [
174 libapparmor,
175 libpam,
176 libseccomp,
177 libselinux,
178 ],
179 },
180 fuzz_template + {
181 'sources' : files('fuzz-unit-file.c'),
182 'link_with' : [
183 libcore,
184 libshared
185 ],
186 'dependencies' : libmount,
187 },
188 fuzz_template + {
189 'sources' : files('fuzz-manager-serialize.c'),
190 'link_with' : [
191 libcore,
192 libshared
193 ],
194 },
195 fuzz_template + {
196 'sources' : files('fuzz-execute-serialize.c'),
197 'link_with' : [
198 libcore,
199 libshared
200 ],
201 },
202 ]
203
204 in_files = [['system.conf', pkgconfigfiledir],
205 ['user.conf', pkgconfigfiledir],
206 ['org.freedesktop.systemd1.policy', polkitpolicydir]]
207
208 foreach item : in_files
209 file = item[0]
210 dir = item[1]
211
212 custom_target(
213 file,
214 input : file + '.in',
215 output: file,
216 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
217 install : (dir == pkgconfigfiledir) ? install_sysconfdir_samples : (dir != 'no'),
218 install_dir : dir)
219 endforeach
220
221 systemd_pc = custom_target(
222 'systemd.pc',
223 input : 'systemd.pc.in',
224 output : 'systemd.pc',
225 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
226 install : pkgconfigdatadir != 'no',
227 install_tag : 'devel',
228 install_dir : pkgconfigdatadir)
229
230 install_data('org.freedesktop.systemd1.conf',
231 install_dir : dbuspolicydir)
232 install_data('org.freedesktop.systemd1.service',
233 install_dir : dbussystemservicedir)
234
235 install_emptydir(systemshutdowndir)
236 install_emptydir(systemsleepdir)
237 install_emptydir(systemgeneratordir)
238 install_emptydir(usergeneratordir)
239
240 if install_sysconfdir
241 install_emptydir(pkgsysconfdir / 'system')
242 install_emptydir(pkgsysconfdir / 'user')
243 install_emptydir(sysconfdir / 'xdg/systemd')
244 meson.add_install_script(sh, '-c', ln_s.format(pkgsysconfdir / 'user',
245 sysconfdir / 'xdg/systemd/user'))
246 endif
247
248 install_emptydir(sbindir)
249 meson.add_install_script(sh, '-c', ln_s.format(libexecdir / 'systemd', sbindir / 'init'))
250
251 ############################################################
252
253 core_test_template = test_template + {
254 'link_with' : [
255 libcore,
256 libshared,
257 ],
258 'include_directories' : core_includes,
259 'suite' : 'core',
260 }