| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
|
| 3 |
systemd_sources = files( |
| 4 |
'apparmor-setup.c', |
| 5 |
'clock-warp.c', |
| 6 |
'crash-handler.c', |
| 7 |
'efi-random.c', |
| 8 |
'ima-setup.c', |
| 9 |
'import-creds.c', |
| 10 |
'ipe-setup.c', |
| 11 |
'kmod-setup.c', |
| 12 |
'main.c', |
| 13 |
'smack-setup.c', |
| 14 |
) |
| 15 |
|
| 16 |
if conf.get('HAVE_SELINUX') == 1 |
| 17 |
systemd_sources += files('selinux-setup.c') |
| 18 |
endif |
| 19 |
|
| 20 |
systemd_executor_sources = files( |
| 21 |
'executor.c', |
| 22 |
'exec-invoke.c', |
| 23 |
) |
| 24 |
|
| 25 |
libcore_sources = files( |
| 26 |
'audit-fd.c', |
| 27 |
'automount.c', |
| 28 |
'bpf-bind-iface.c', |
| 29 |
'bpf-devices.c', |
| 30 |
'bpf-firewall.c', |
| 31 |
'bpf-foreign.c', |
| 32 |
'bpf-restrict-fs.c', |
| 33 |
'bpf-restrict-fsaccess.c', |
| 34 |
'bpf-restrict-ifaces.c', |
| 35 |
'bpf-socket-bind.c', |
| 36 |
'cgroup.c', |
| 37 |
'dbus-automount.c', |
| 38 |
'dbus-cgroup.c', |
| 39 |
'dbus-device.c', |
| 40 |
'dbus-execute.c', |
| 41 |
'dbus-job.c', |
| 42 |
'dbus-kill.c', |
| 43 |
'dbus-manager.c', |
| 44 |
'dbus-mount.c', |
| 45 |
'dbus-path.c', |
| 46 |
'dbus-scope.c', |
| 47 |
'dbus-service.c', |
| 48 |
'dbus-slice.c', |
| 49 |
'dbus-socket.c', |
| 50 |
'dbus-swap.c', |
| 51 |
'dbus-target.c', |
| 52 |
'dbus-timer.c', |
| 53 |
'dbus-unit.c', |
| 54 |
'dbus-util.c', |
| 55 |
'dbus.c', |
| 56 |
'device.c', |
| 57 |
'dynamic-user.c', |
| 58 |
'emergency-action.c', |
| 59 |
'exec-credential.c', |
| 60 |
'execute.c', |
| 61 |
'execute-serialize.c', |
| 62 |
'generator-setup.c', |
| 63 |
'job.c', |
| 64 |
'kill.c', |
| 65 |
'load-dropin.c', |
| 66 |
'load-fragment.c', |
| 67 |
'luo.c', |
| 68 |
'manager-dump.c', |
| 69 |
'manager-serialize.c', |
| 70 |
'manager.c', |
| 71 |
'mount.c', |
| 72 |
'namespace.c', |
| 73 |
'path.c', |
| 74 |
'scope.c', |
| 75 |
'selinux-access.c', |
| 76 |
'service.c', |
| 77 |
'show-status.c', |
| 78 |
'slice.c', |
| 79 |
'socket.c', |
| 80 |
'swap.c', |
| 81 |
'taint.c', |
| 82 |
'target.c', |
| 83 |
'timer.c', |
| 84 |
'transaction.c', |
| 85 |
'unit-dependency-atom.c', |
| 86 |
'unit-printf.c', |
| 87 |
'unit-serialize.c', |
| 88 |
'unit.c', |
| 89 |
'varlink.c', |
| 90 |
'varlink-automount.c', |
| 91 |
'varlink-cgroup.c', |
| 92 |
'varlink-common.c', |
| 93 |
'varlink-dynamic-user.c', |
| 94 |
'varlink-execute.c', |
| 95 |
'varlink-job.c', |
| 96 |
'varlink-kill.c', |
| 97 |
'varlink-manager.c', |
| 98 |
'varlink-metrics.c', |
| 99 |
'varlink-mount.c', |
| 100 |
'varlink-path.c', |
| 101 |
'varlink-scope.c', |
| 102 |
'varlink-service.c', |
| 103 |
'varlink-socket.c', |
| 104 |
'varlink-swap.c', |
| 105 |
'varlink-timer.c', |
| 106 |
'varlink-unit.c', |
| 107 |
) |
| 108 |
|
| 109 |
if conf.get('BPF_FRAMEWORK') == 1 |
| 110 |
foreach name : ['socket-bind', 'restrict-fs', 'restrict-ifaces', 'bind-iface'] |
| 111 |
libcore_sources += bpf_programs_by_name[name] |
| 112 |
endforeach |
| 113 |
endif |
| 114 |
|
| 115 |
if conf.get('HAVE_LSM_INTEGRITY_TYPE') == 1 |
| 116 |
libcore_sources += bpf_programs_by_name['restrict-fsaccess'] |
| 117 |
endif |
| 118 |
|
| 119 |
sources += libcore_sources |
| 120 |
|
| 121 |
load_fragment_gperf_gperf = custom_target( |
| 122 |
input : 'load-fragment-gperf.gperf.in', |
| 123 |
output: 'load-fragment-gperf.gperf', |
| 124 |
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@']) |
| 125 |
|
| 126 |
load_fragment_gperf_c = custom_target( |
| 127 |
input : load_fragment_gperf_gperf, |
| 128 |
output : 'load-fragment-gperf.c', |
| 129 |
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@']) |
| 130 |
|
| 131 |
awkscript = 'load-fragment-gperf-nulstr.awk' |
| 132 |
load_fragment_gperf_nulstr_c = custom_target( |
| 133 |
input : [awkscript, load_fragment_gperf_gperf], |
| 134 |
output : 'load-fragment-gperf-nulstr.c', |
| 135 |
command : [awk, '-f', '@INPUT0@', '@INPUT1@'], |
| 136 |
capture : true) |
| 137 |
|
| 138 |
generate_bpf_delegate_configs = files('generate-bpf-delegate-configs.py') |
| 139 |
bpf_delegate_configs_inc = custom_target( |
| 140 |
input : [generate_bpf_delegate_configs, bpf_delegate_sources], |
| 141 |
output : 'bpf-delegate-configs.inc', |
| 142 |
command : [python, |
| 143 |
generate_bpf_delegate_configs, |
| 144 |
'code', |
| 145 |
bpf_delegate_sources], |
| 146 |
capture : true) |
| 147 |
|
| 148 |
bpf_delegate_xml = custom_target( |
| 149 |
input : [generate_bpf_delegate_configs, bpf_delegate_sources], |
| 150 |
output : 'bpf-delegate.xml', |
| 151 |
command : [python, |
| 152 |
generate_bpf_delegate_configs, |
| 153 |
'doc', |
| 154 |
bpf_delegate_sources], |
| 155 |
capture : true) |
| 156 |
man_page_depends += bpf_delegate_xml |
| 157 |
|
| 158 |
generated_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc] |
| 159 |
libcore_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc] |
| 160 |
libcore_build_dir = meson.current_build_dir() |
| 161 |
libcore_name = 'systemd-core-@0@'.format(shared_lib_tag) |
| 162 |
core_includes = [include_directories('.'), includes] |
| 163 |
|
| 164 |
libcore_static = static_library( |
| 165 |
libcore_name, |
| 166 |
libcore_sources, |
| 167 |
include_directories : core_includes, |
| 168 |
implicit_include_directories : false, |
| 169 |
c_args : ['-fvisibility=default'], |
| 170 |
dependencies : [libaudit_cflags, |
| 171 |
libbpf_cflags, |
| 172 |
libcryptsetup_cflags, |
| 173 |
libm, |
| 174 |
libmount_cflags, |
| 175 |
libseccomp_cflags, |
| 176 |
libselinux_cflags, |
| 177 |
userspace], |
| 178 |
build_by_default : false) |
| 179 |
|
| 180 |
libcore = shared_library( |
| 181 |
libcore_name, |
| 182 |
c_args : ['-fvisibility=default'], |
| 183 |
implicit_include_directories : false, |
| 184 |
link_args : ['-shared', |
| 185 |
'-Wl,--version-script=' + libshared_sym_path], |
| 186 |
link_depends : libshared_sym_path, |
| 187 |
link_whole: libcore_static, |
| 188 |
link_with : libshared, |
| 189 |
install : true, |
| 190 |
install_dir : pkglibdir) |
| 191 |
|
| 192 |
executor_libs = get_option('link-executor-shared') ? \ |
| 193 |
[ |
| 194 |
libcore, |
| 195 |
libshared, |
| 196 |
] : [ |
| 197 |
libc_wrapper_static, |
| 198 |
libcore_static, |
| 199 |
libshared_static, |
| 200 |
libbasic_static, |
| 201 |
libsystemd_static, |
| 202 |
] |
| 203 |
|
| 204 |
executables += [ |
| 205 |
libexec_template + { |
| 206 |
'name' : 'systemd', |
| 207 |
'dbus' : true, |
| 208 |
'public' : true, |
| 209 |
'sources' : systemd_sources, |
| 210 |
'link_with' : [ |
| 211 |
libcore, |
| 212 |
libshared, |
| 213 |
], |
| 214 |
'dependencies' : [ |
| 215 |
libapparmor_cflags, |
| 216 |
libkmod_cflags, |
| 217 |
libmount_cflags, |
| 218 |
libseccomp_cflags, |
| 219 |
libselinux_cflags, |
| 220 |
], |
| 221 |
}, |
| 222 |
libexec_template + { |
| 223 |
'name' : 'systemd-executor', |
| 224 |
'public' : true, |
| 225 |
'sources' : systemd_executor_sources, |
| 226 |
'link_with' : executor_libs, |
| 227 |
'dependencies' : [ |
| 228 |
libapparmor_cflags, |
| 229 |
libbpf_cflags, |
| 230 |
libcryptsetup_cflags, |
| 231 |
libmount_cflags, |
| 232 |
libpam_cflags, |
| 233 |
libseccomp_cflags, |
| 234 |
libselinux_cflags, |
| 235 |
], |
| 236 |
}, |
| 237 |
fuzz_template + { |
| 238 |
'sources' : files('fuzz-unit-file.c'), |
| 239 |
'link_with' : [ |
| 240 |
libcore, |
| 241 |
libshared |
| 242 |
], |
| 243 |
'dependencies' : libmount_cflags, |
| 244 |
}, |
| 245 |
fuzz_template + { |
| 246 |
'sources' : files('fuzz-manager-serialize.c'), |
| 247 |
'link_with' : [ |
| 248 |
libcore, |
| 249 |
libshared |
| 250 |
], |
| 251 |
}, |
| 252 |
fuzz_template + { |
| 253 |
'sources' : files('fuzz-execute-serialize.c'), |
| 254 |
'link_with' : [ |
| 255 |
libcore, |
| 256 |
libshared |
| 257 |
], |
| 258 |
}, |
| 259 |
] |
| 260 |
|
| 261 |
in_files = [['system.conf', pkgconfigfiledir], |
| 262 |
['user.conf', pkgconfigfiledir], |
| 263 |
['org.freedesktop.systemd1.policy', polkitpolicydir]] |
| 264 |
|
| 265 |
foreach item : in_files |
| 266 |
file = item[0] |
| 267 |
dir = item[1] |
| 268 |
|
| 269 |
custom_target( |
| 270 |
input : file + '.in', |
| 271 |
output: file, |
| 272 |
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], |
| 273 |
install : (dir == pkgconfigfiledir) ? install_sysconfdir_samples : (dir != 'no'), |
| 274 |
install_dir : dir) |
| 275 |
endforeach |
| 276 |
|
| 277 |
systemd_pc = custom_target( |
| 278 |
input : 'systemd.pc.in', |
| 279 |
output : 'systemd.pc', |
| 280 |
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], |
| 281 |
install : pkgconfigdatadir != 'no', |
| 282 |
install_tag : 'devel', |
| 283 |
install_dir : pkgconfigdatadir) |
| 284 |
|
| 285 |
install_data('org.freedesktop.systemd1.conf', |
| 286 |
install_dir : dbuspolicydir) |
| 287 |
install_data('org.freedesktop.systemd1.service', |
| 288 |
install_dir : dbussystemservicedir) |
| 289 |
|
| 290 |
install_emptydir(systemenvgeneratordir) |
| 291 |
install_emptydir(systemshutdowndir) |
| 292 |
install_emptydir(systemsleepdir) |
| 293 |
install_emptydir(systemgeneratordir) |
| 294 |
install_emptydir(userenvgeneratordir) |
| 295 |
install_emptydir(usergeneratordir) |
| 296 |
|
| 297 |
if install_sysconfdir |
| 298 |
install_emptydir(pkgsysconfdir / 'system') |
| 299 |
install_emptydir(pkgsysconfdir / 'user') |
| 300 |
|
| 301 |
assert(sysconfdir / 'systemd' == pkgsysconfdir) |
| 302 |
install_symlink('user', |
| 303 |
pointing_to : '../../systemd/user', |
| 304 |
install_dir : sysconfdir / 'xdg/systemd') |
| 305 |
endif |
| 306 |
|
| 307 |
assert(fs.parent(sbindir) / 'lib/systemd' == libexecdir) |
| 308 |
install_symlink('init', |
| 309 |
pointing_to : '../lib/systemd/systemd', |
| 310 |
install_dir : sbindir) |
| 311 |
|
| 312 |
############################################################ |
| 313 |
|
| 314 |
core_test_template = test_template + { |
| 315 |
'link_with' : [ |
| 316 |
libcore, |
| 317 |
libshared, |
| 318 |
], |
| 319 |
'include_directories' : core_includes, |
| 320 |
'suite' : 'core', |
| 321 |
} |