]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/meson.build
meson: only build src/shared/tests.c if tests are enabled
[thirdparty/systemd.git] / src / shared / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2
3 shared_sources = files('''
4 acl-util.h
5 acpi-fpdt.c
6 acpi-fpdt.h
7 apparmor-util.c
8 apparmor-util.h
9 ask-password-api.c
10 ask-password-api.h
11 base-filesystem.c
12 base-filesystem.h
13 boot-timestamps.c
14 boot-timestamps.h
15 bootspec.c
16 bootspec.h
17 bus-unit-util.c
18 bus-unit-util.h
19 bus-util.c
20 bus-util.h
21 cgroup-show.c
22 cgroup-show.h
23 clean-ipc.c
24 clean-ipc.h
25 condition.c
26 condition.h
27 conf-parser.c
28 conf-parser.h
29 dev-setup.c
30 dev-setup.h
31 dissect-image.c
32 dissect-image.h
33 dns-domain.c
34 dns-domain.h
35 dropin.c
36 dropin.h
37 efivars.c
38 efivars.h
39 fdset.c
40 fdset.h
41 firewall-util.h
42 fstab-util.c
43 fstab-util.h
44 generator.c
45 generator.h
46 gpt.h
47 id128-print.c
48 id128-print.h
49 ima-util.c
50 ima-util.h
51 import-util.c
52 import-util.h
53 initreq.h
54 install.c
55 install.h
56 install-printf.c
57 install-printf.h
58 journal-util.c
59 journal-util.h
60 logs-show.c
61 logs-show.h
62 loop-util.c
63 loop-util.h
64 machine-image.c
65 machine-image.h
66 machine-pool.c
67 machine-pool.h
68 module-util.h
69 nsflags.c
70 nsflags.h
71 output-mode.c
72 output-mode.h
73 path-lookup.c
74 path-lookup.h
75 ptyfwd.c
76 ptyfwd.h
77 resolve-util.c
78 resolve-util.h
79 seccomp-util.h
80 sleep-config.c
81 sleep-config.h
82 spawn-ask-password-agent.c
83 spawn-ask-password-agent.h
84 spawn-polkit-agent.c
85 spawn-polkit-agent.h
86 specifier.c
87 specifier.h
88 switch-root.c
89 switch-root.h
90 sysctl-util.c
91 sysctl-util.h
92 tomoyo-util.c
93 tomoyo-util.h
94 udev-util.h
95 udev-util.c
96 uid-range.c
97 uid-range.h
98 utmp-wtmp.h
99 vlan-util.c
100 vlan-util.h
101 volatile-util.c
102 volatile-util.h
103 watchdog.c
104 watchdog.h
105 wireguard-netlink.h
106 '''.split())
107
108 if get_option('tests') != 'false'
109 shared_sources += files('tests.c', 'tests.h')
110 endif
111
112 test_tables_h = files('test-tables.h')
113 shared_sources += test_tables_h
114
115 if conf.get('HAVE_ACL') == 1
116 shared_sources += files('acl-util.c')
117 endif
118
119 if conf.get('ENABLE_UTMP') == 1
120 shared_sources += files('utmp-wtmp.c')
121 endif
122
123 if conf.get('HAVE_SECCOMP') == 1
124 shared_sources += files('seccomp-util.c')
125 endif
126
127 if conf.get('HAVE_LIBIPTC') == 1
128 shared_sources += files('firewall-util.c')
129 endif
130
131 if conf.get('HAVE_KMOD') == 1
132 shared_sources += files('module-util.c')
133 endif
134
135 libshared_name = 'systemd-shared-@0@'.format(meson.project_version())
136
137 libshared_deps = [threads,
138 librt,
139 libcap,
140 libacl,
141 libcryptsetup,
142 libgcrypt,
143 libiptc,
144 libkmod,
145 libseccomp,
146 libselinux,
147 libidn,
148 libxz,
149 liblz4,
150 libblkid]
151
152 libshared_sym_path = '@0@/libshared.sym'.format(meson.current_source_dir())
153
154 libshared_static = static_library(
155 libshared_name,
156 shared_sources,
157 include_directories : includes,
158 dependencies : libshared_deps,
159 c_args : ['-fvisibility=default'])
160
161 libshared = shared_library(
162 libshared_name,
163 libudev_sources,
164 include_directories : includes,
165 link_args : ['-shared',
166 '-Wl,--version-script=' + libshared_sym_path],
167 link_whole : [libshared_static,
168 libbasic,
169 libbasic_gcrypt,
170 libsystemd_static,
171 libjournal_client],
172 c_args : ['-fvisibility=default'],
173 dependencies : libshared_deps,
174 install : true,
175 install_dir : rootlibexecdir)