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