]>
Commit | Line | Data |
---|---|---|
d4c880d5 | 1 | project('util-linux', 'c', |
e0c1a86b | 2 | version : run_command('tools/git-version-gen', check: true).stdout(), |
c12276dd | 3 | meson_version: '>=0.60.0', |
6240e445 TW |
4 | license : 'GPLv2+', |
5 | default_options : [ | |
6 | 'c_std=c99', | |
7 | 'cpp_std=c++11', | |
8 | ]) | |
d4c880d5 | 9 | |
3e0bbb12 | 10 | fs = import('fs') |
d4c880d5 ZJS |
11 | pkgconfig = import('pkgconfig') |
12 | ||
13 | libblkid_version = '1.1.0' | |
50736e49 | 14 | libblkid_date = '01-Jun-2021' |
d4c880d5 | 15 | libuuid_version = '1.3.0' |
476c8614 | 16 | liblastlog2_version = '2.0.0' |
d4c880d5 ZJS |
17 | libmount_version = '1.1.0' |
18 | libsmartcols_version = '1.1.0' | |
19 | libfdisk_version = '1.1.0' | |
20 | ||
21 | prefixdir = get_option('prefix') | |
22 | if not prefixdir.startswith('/') | |
23 | error('Prefix is not absolute: "@0@"'.format(prefixdir)) | |
24 | endif | |
25 | bindir = join_paths(prefixdir, get_option('bindir')) | |
26 | sbindir = join_paths(prefixdir, get_option('sbindir')) | |
27 | sysconfstaticdir = join_paths(prefixdir, 'lib') | |
12ebed03 | 28 | docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux') |
53b37016 | 29 | mandir = join_paths(prefixdir, get_option('mandir')) |
d4c880d5 | 30 | runstatedir = '/run' |
0eb2a476 | 31 | execprefixdir = prefixdir |
5e67b421 | 32 | sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) |
0eb2a476 KL |
33 | usrbin_exec_dir = join_paths(execprefixdir, bindir) |
34 | usrsbin_exec_dir = join_paths(execprefixdir, sbindir) | |
38bb89ee | 35 | bash_completion = dependency('bash-completion', required : get_option('build-bash-completion')) |
d4c880d5 | 36 | |
308a0979 KZ |
37 | vendordir = get_option('vendordir') |
38 | ||
d4c880d5 ZJS |
39 | add_project_arguments('-D_GNU_SOURCE', language : 'c') |
40 | ||
41 | cc = meson.get_compiler('c') | |
42 | ||
43 | conf = configuration_data() | |
3e43f629 RP |
44 | conf.set_quoted('PACKAGE', meson.project_name()) |
45 | conf.set_quoted('PACKAGE_VERSION', meson.project_version()) | |
d4c880d5 ZJS |
46 | package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version()) |
47 | conf.set_quoted('PACKAGE_STRING', package_string) | |
d4c880d5 | 48 | |
d4c880d5 | 49 | pc_version = [] |
922d025a | 50 | pc_version = meson.project_version().split('-')[0].split('.') |
51 | ||
52 | if pc_version.length() < 3 | |
53 | pc_version += '0' | |
54 | endif | |
55 | ||
d4c880d5 ZJS |
56 | pc_version = '.'.join(pc_version) |
57 | ||
58 | conf.set_quoted('LIBBLKID_VERSION', libblkid_version) | |
59 | conf.set_quoted('LIBBLKID_DATE', libblkid_date) | |
60 | ||
61 | conf.set('bindir', bindir) | |
62 | conf.set('sbindir', sbindir) | |
63 | conf.set('runstatedir', runstatedir) | |
5e67b421 | 64 | conf.set('sysconfdir', sysconfdir) |
d4c880d5 ZJS |
65 | conf.set('usrsbin_execdir', usrsbin_exec_dir) |
66 | conf.set('docdir', docdir) | |
67 | conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir) | |
68 | conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir) | |
69 | conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime') | |
70 | conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :( | |
71 | ||
308a0979 KZ |
72 | conf.set_quoted('_PATH_VENDORDIR', vendordir) |
73 | conf.set('USE_VENDORDIR', vendordir == '' ? false : 1) | |
74 | ||
d4c880d5 ZJS |
75 | build_libblkid = not get_option('build-libblkid').disabled() |
76 | conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false) | |
77 | summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components') | |
78 | ||
79 | build_libuuid = not get_option('build-libuuid').disabled() | |
80 | conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false) | |
81 | summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components') | |
82 | ||
c2e299d0 SS |
83 | build_liblastlog2 = not get_option('build-liblastlog2').disabled() |
84 | conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false) | |
85 | summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components') | |
86 | ||
e23c3262 KZ |
87 | have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0 |
88 | conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false) | |
89 | conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false) | |
90 | ||
7d679f29 | 91 | have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0 |
8bcf89d3 TW |
92 | conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false) |
93 | ||
d4c880d5 ZJS |
94 | build_libmount = not get_option('build-libmount').disabled() |
95 | conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false) | |
375ccf08 | 96 | conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1) |
e23c3262 | 97 | conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false) |
d4c880d5 ZJS |
98 | summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components') |
99 | ||
100 | build_libsmartcols = not get_option('build-libsmartcols').disabled() | |
101 | conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false) | |
102 | summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components') | |
103 | ||
104 | build_libfdisk = not get_option('build-libfdisk').disabled() | |
105 | conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false) | |
106 | summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components') | |
107 | ||
108 | build_uuidd = not get_option('build-uuidd').disabled() | |
109 | conf.set('HAVE_UUIDD', build_uuidd ? 1 : false) | |
110 | summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components') | |
111 | ||
69939195 ZJS |
112 | static_programs = get_option('static-programs') |
113 | need_static_libs = static_programs.length() > 0 # a rough estimate... | |
114 | summary('static programs', static_programs) | |
115 | ||
d4c880d5 ZJS |
116 | LINUX = host_machine.system() in ['linux'] |
117 | BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd'] | |
118 | ||
119 | ############################################################ | |
120 | ||
121 | code = ''' | |
122 | #include <wchar.h> | |
123 | #include <wctype.h> | |
124 | #include <stdio.h> | |
125 | #include <stdlib.h> | |
126 | int main(void) { | |
127 | wchar_t wc; | |
128 | wint_t w; | |
129 | w = fgetwc(stdin); | |
130 | if (w == WEOF) | |
131 | return 1; | |
132 | wc = w; | |
133 | fputwc(wc,stdout); | |
134 | return 0; | |
135 | } | |
136 | ''' | |
137 | have = cc.compiles(code, name : 'wchar_t support') | |
138 | if not have and get_option('widechar').enabled() | |
139 | error('widechar support requested but unavailable') | |
140 | endif | |
141 | if get_option('ncurses').enabled() and get_option('widechar').enabled() | |
142 | error('widechar support is incompatible with non-wide ncurses') | |
143 | endif | |
144 | conf.set('HAVE_WIDECHAR', have ? 1 : false) | |
145 | ||
146 | headers = ''' | |
147 | byteswap.h | |
148 | crypt.h | |
149 | endian.h | |
150 | err.h | |
151 | errno.h | |
152 | fcntl.h | |
153 | getopt.h | |
154 | inttypes.h | |
155 | langinfo.h | |
156 | lastlog.h | |
157 | libutil.h | |
158 | locale.h | |
159 | mntent.h | |
160 | paths.h | |
161 | pty.h | |
162 | shadow.h | |
163 | stdint.h | |
164 | stdio_ext.h | |
165 | stdlib.h | |
166 | string.h | |
167 | strings.h | |
168 | unistd.h | |
169 | utmp.h | |
170 | utmpx.h | |
908ac36f MY |
171 | asm-generic/fcntl.h |
172 | asm/fcntl.h | |
d4c880d5 ZJS |
173 | asm/io.h |
174 | linux/blkzoned.h | |
175 | linux/capability.h | |
176 | linux/cdrom.h | |
177 | linux/compiler.h | |
178 | linux/falloc.h | |
179 | linux/fd.h | |
0e186591 | 180 | linux/fs.h |
647f80e4 KZ |
181 | linux/fiemap.h |
182 | linux/gsmmux.h | |
0e186591 | 183 | linux/if_alg.h |
ae015d71 | 184 | linux/landlock.h |
0e186591 | 185 | linux/kcmp.h |
d4c880d5 | 186 | linux/net_namespace.h |
647f80e4 | 187 | linux/nsfs.h |
241e4a48 | 188 | linux/mount.h |
0e186591 | 189 | linux/pr.h |
d4c880d5 ZJS |
190 | linux/securebits.h |
191 | linux/tiocl.h | |
192 | linux/version.h | |
193 | linux/watchdog.h | |
194 | net/if.h | |
195 | net/if_dl.h | |
196 | netinet/in.h | |
197 | security/openpam.h | |
198 | security/pam_appl.h | |
199 | security/pam_misc.h | |
200 | sys/disk.h | |
201 | sys/disklabel.h | |
202 | sys/endian.h | |
203 | sys/file.h | |
204 | sys/io.h | |
205 | sys/ioccom.h | |
206 | sys/ioctl.h | |
207 | sys/mkdev.h | |
208 | sys/mount.h | |
209 | sys/param.h | |
aa5adf24 | 210 | sys/pidfd.h |
d4c880d5 ZJS |
211 | sys/prctl.h |
212 | sys/resource.h | |
6e92db54 | 213 | sys/sendfile.h |
d4c880d5 ZJS |
214 | sys/signalfd.h |
215 | sys/socket.h | |
216 | sys/sockio.h | |
217 | sys/stat.h | |
0e186591 | 218 | sys/statfs.h |
d4c880d5 ZJS |
219 | sys/swap.h |
220 | sys/syscall.h | |
221 | sys/sysmacros.h | |
222 | sys/time.h | |
223 | sys/timex.h | |
224 | sys/ttydefaults.h | |
225 | sys/types.h | |
226 | sys/ucred.h | |
227 | sys/un.h | |
0e186591 | 228 | sys/vfs.h |
647f80e4 | 229 | sys/xattr.h |
d4c880d5 ZJS |
230 | '''.split() |
231 | ||
232 | lib_m = cc.find_library('m') | |
233 | ||
234 | lib_tinfo = dependency( | |
235 | 'tinfo', | |
236 | required : get_option('tinfo')) | |
237 | ||
238 | lib_ncursesw = dependency( | |
239 | 'ncursesw', | |
240 | required : get_option('ncursesw')) | |
241 | if lib_ncursesw.found() | |
242 | headers += ['ncursesw/ncurses.h', | |
243 | 'ncursesw/term.h', | |
244 | 'ncurses.h', | |
245 | 'term.h'] | |
246 | lib_ncurses = disabler() | |
247 | else | |
248 | lib_ncurses = dependency( | |
249 | 'ncurses', | |
250 | required : get_option('ncurses')) | |
251 | headers += ['ncurses.h', | |
252 | 'term.h'] | |
253 | endif | |
254 | ||
255 | conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found()) | |
256 | conf.set('HAVE_LIBNCURSES', lib_ncurses.found()) | |
257 | conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found()) | |
258 | ||
259 | lib_slang = dependency( | |
260 | 'slang', | |
261 | required : get_option('slang')) | |
262 | if lib_slang.found() | |
263 | headers += ['slang.h', | |
264 | 'slang/slang.h', | |
265 | 'slcurses.h', | |
266 | 'slang/slcurses.h'] | |
267 | endif | |
268 | conf.set('HAVE_SLANG', lib_slang.found()) | |
269 | ||
270 | foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses] | |
271 | if curses_libs.found() | |
6e13cfed KZ |
272 | have = cc.has_function('use_default_colors', dependencies : curses_libs) |
273 | conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false) | |
274 | have = cc.has_function('resizeterm', dependencies : curses_libs) | |
275 | conf.set('HAVE_RESIZETERM', have ? 1 : false) | |
d4c880d5 ZJS |
276 | break |
277 | endif | |
278 | endforeach | |
279 | ||
280 | lib_z = dependency( | |
281 | 'zlib', | |
282 | required : get_option('zlib')) | |
283 | ||
284 | lib_readline = dependency( | |
285 | 'readline', | |
286 | required : get_option('readline')) | |
287 | conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false) | |
288 | ||
69939195 ZJS |
289 | lib_readline_static = dependency( |
290 | 'readline', | |
291 | static : true, | |
292 | required : need_static_libs ? get_option('readline') : disabler()) | |
293 | ||
fc63a3d0 RP |
294 | if meson.version().version_compare('>= 0.59.0') |
295 | lib_intl = dependency( | |
296 | 'intl', | |
297 | required : get_option('nls')) | |
298 | conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false) | |
299 | else | |
300 | if get_option('nls').enabled() | |
301 | error('nls is not supported with meson before 0.59.0') | |
302 | endif | |
303 | lib_intl = dependency('', required : false) | |
304 | endif | |
305 | ||
d4c880d5 ZJS |
306 | lib_user = dependency( |
307 | 'libuser', | |
308 | version : '>= 0.58', | |
309 | required : get_option('libuser')) | |
310 | conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false) | |
311 | ||
312 | lib_util = cc.find_library( | |
313 | 'util', | |
314 | required : get_option('libutil')) | |
315 | conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false) | |
316 | ||
317 | lib_utempter = cc.find_library( | |
318 | 'utempter', | |
319 | required : get_option('libutempter')) | |
320 | conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false) | |
321 | ||
322 | systemd = dependency( | |
323 | 'systemd', | |
324 | required : get_option('systemd')) | |
325 | ||
326 | lib_systemd = dependency( | |
327 | 'libsystemd', | |
328 | required : get_option('systemd')) | |
329 | conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false) | |
0e186591 | 330 | conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false) |
d4c880d5 | 331 | |
87fcd95a TK |
332 | have = cc.has_function( |
333 | 'sd_session_get_username', | |
334 | dependencies : lib_systemd) | |
335 | conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false) | |
336 | ||
d4c880d5 ZJS |
337 | lib_udev = dependency( |
338 | 'libudev', | |
339 | required : get_option('systemd')) | |
340 | conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false) | |
341 | ||
342 | lib_crypt = cc.find_library('crypt') | |
343 | ||
e279e9b2 RP |
344 | lib_pam = cc.find_library('pam', required : get_option('build-login')) |
345 | if not lib_pam.found() | |
346 | lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh')) | |
347 | endif | |
348 | if not lib_pam.found() | |
349 | lib_pam = cc.find_library('pam', required : get_option('build-su')) | |
350 | endif | |
351 | if not lib_pam.found() | |
352 | lib_pam = cc.find_library('pam', required : get_option('build-runuser')) | |
353 | endif | |
d4c880d5 ZJS |
354 | if lib_pam.found() |
355 | lib_pam_misc = cc.find_library('pam_misc') | |
356 | lib_pam = [lib_pam, lib_pam_misc] | |
7bce9496 RP |
357 | else |
358 | lib_pam_misc = declare_dependency() | |
d4c880d5 ZJS |
359 | endif |
360 | ||
361 | lib_cryptsetup = dependency( | |
362 | 'libcryptsetup', | |
363 | required : get_option('cryptsetup')) | |
364 | conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false) | |
365 | ||
e6a4b4a1 | 366 | if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled() |
324aa32c RP |
367 | if meson.version().version_compare('>= 0.62.0') |
368 | lib_dl = dependency('dl') | |
369 | else | |
370 | lib_dl = cc.find_library('dl') | |
371 | endif | |
e6a4b4a1 LB |
372 | conf.set('CRYPTSETUP_VIA_DLOPEN', 1) |
373 | summary('cryptsetup support (dlopen)', | |
374 | 'enabled', | |
375 | section : 'components') | |
376 | else | |
377 | summary('cryptsetup support', | |
378 | lib_cryptsetup.found() ? 'enabled' : 'disabled', | |
379 | section : 'components') | |
380 | endif | |
6e92db54 | 381 | |
d4c880d5 ZJS |
382 | have = cc.has_function( |
383 | 'crypt_activate_by_signed_key', | |
384 | dependencies : lib_cryptsetup) | |
5a6e9adf | 385 | conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false) |
d4c880d5 ZJS |
386 | |
387 | lib_cap_ng = dependency( | |
cd23a433 RP |
388 | 'libcap-ng', |
389 | required : get_option('build-setpriv')) | |
512c91a6 TW |
390 | if not lib_cap_ng.found() |
391 | lib_cap_ng = disabler() | |
392 | endif | |
d4c880d5 ZJS |
393 | |
394 | lib_selinux = dependency( | |
395 | 'libselinux', | |
6e92db54 | 396 | version : '>= 2.5', |
d4c880d5 ZJS |
397 | required : get_option('selinux')) |
398 | conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false) | |
399 | ||
6e92db54 KZ |
400 | lib_magic = dependency( |
401 | 'libmagic', | |
402 | required : get_option('magic')) | |
403 | conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false) | |
404 | ||
405 | lib_econf = dependency( | |
406 | 'libeconf', | |
407 | required : get_option('econf')) | |
408 | conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false) | |
409 | ||
d4c880d5 | 410 | lib_audit = dependency( |
b2ae39f6 | 411 | 'audit', |
d4c880d5 ZJS |
412 | required : get_option('audit')) |
413 | conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false) | |
414 | ||
415 | conf.set('HAVE_SMACK', not get_option('smack').disabled()) | |
416 | ||
417 | foreach header : headers | |
418 | have = cc.has_header(header) | |
419 | conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false) | |
420 | endforeach | |
421 | ||
422 | header = 'linux/btrfs.h' | |
423 | enable_btrfs = cc.has_header(header, | |
424 | required : get_option('btrfs')) | |
425 | conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false) | |
426 | conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false) | |
427 | ||
428 | prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : '' | |
429 | foreach header : [ | |
430 | 'linux/blkpg.h', | |
431 | 'linux/major.h', | |
432 | ] | |
433 | have = cc.has_header(header, | |
434 | prefix : prefix) | |
435 | conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false) | |
436 | endforeach | |
437 | ||
438 | have = cc.has_header('sched.h') | |
439 | conf.set10('HAVE_DECL_CPU_ALLOC', have) | |
440 | # We get -1 if the size cannot be determined | |
4194bb5b | 441 | have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0 |
d4c880d5 ZJS |
442 | conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) |
443 | ||
5afe34ef | 444 | have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE') |
d4c880d5 ZJS |
445 | conf.set10('HAVE_ENVIRON_DECL', have) |
446 | ||
5afe34ef | 447 | have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE') |
d4c880d5 ZJS |
448 | conf.set('HAVE_SIGHANDLER_T', have ? 1 : false) |
449 | ||
f3b9a18e | 450 | have = cc.has_function('strsignal') |
d4c880d5 ZJS |
451 | conf.set10('HAVE_STRSIGNAL_DECL', have) |
452 | ||
453 | have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0 | |
454 | conf.set('HAVE_UNION_SEMUN', have ? 1 : false) | |
455 | ||
0e186591 TW |
456 | have = cc.has_type('loff_t', prefix : '#include <sys/types.h>') |
457 | conf.set('HAVE_LOFF_T', have ? 1 : false) | |
458 | ||
d4c880d5 ZJS |
459 | have = cc.compiles(''' |
460 | #define _GNU_SOURCE 1 | |
461 | #include <langinfo.h> | |
462 | int main(void) { | |
463 | char *str; | |
464 | str = nl_langinfo (ALTMON_1); | |
465 | str = nl_langinfo (ALTMON_2); | |
466 | str = nl_langinfo (ALTMON_3); | |
467 | str = nl_langinfo (ALTMON_4); | |
468 | str = nl_langinfo (ALTMON_5); | |
469 | str = nl_langinfo (ALTMON_6); | |
470 | str = nl_langinfo (ALTMON_7); | |
471 | str = nl_langinfo (ALTMON_8); | |
472 | str = nl_langinfo (ALTMON_9); | |
473 | str = nl_langinfo (ALTMON_10); | |
474 | str = nl_langinfo (ALTMON_11); | |
475 | str = nl_langinfo (ALTMON_12); | |
476 | return 0; | |
477 | } | |
478 | ''', | |
479 | name : 'langinfo.h defines ALTMON_x constants') | |
480 | conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false) | |
481 | ||
482 | have = cc.compiles(''' | |
483 | #define _GNU_SOURCE 1 | |
484 | #include <langinfo.h> | |
485 | int main(void) { | |
486 | char *str; | |
487 | str = nl_langinfo (_NL_ABALTMON_1); | |
488 | str = nl_langinfo (_NL_ABALTMON_2); | |
489 | str = nl_langinfo (_NL_ABALTMON_3); | |
490 | str = nl_langinfo (_NL_ABALTMON_4); | |
491 | str = nl_langinfo (_NL_ABALTMON_5); | |
492 | str = nl_langinfo (_NL_ABALTMON_6); | |
493 | str = nl_langinfo (_NL_ABALTMON_7); | |
494 | str = nl_langinfo (_NL_ABALTMON_8); | |
495 | str = nl_langinfo (_NL_ABALTMON_9); | |
496 | str = nl_langinfo (_NL_ABALTMON_10); | |
497 | str = nl_langinfo (_NL_ABALTMON_11); | |
498 | str = nl_langinfo (_NL_ABALTMON_12); | |
499 | return 0; | |
500 | } | |
501 | ''', | |
502 | name : 'langinfo.h defines _NL_ABALTMON_x constants') | |
503 | conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false) | |
504 | ||
17bc58e0 CH |
505 | have = cc.compiles(''' |
506 | #define _GNU_SOURCE 1 | |
507 | #include <langinfo.h> | |
508 | int main(void) { | |
509 | char *str; | |
510 | str = nl_langinfo (_NL_TIME_WEEK_1STDAY); | |
511 | return 0; | |
512 | } | |
513 | ''', | |
514 | name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant') | |
515 | conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false) | |
516 | ||
d4c880d5 | 517 | funcs = ''' |
c214cbeb | 518 | cachestat |
d4c880d5 | 519 | clearenv |
5bd1462d | 520 | close_range |
d4c880d5 ZJS |
521 | __fpurge |
522 | fpurge | |
523 | __fpending | |
524 | secure_getenv | |
525 | __secure_getenv | |
526 | eaccess | |
527 | err | |
528 | errx | |
529 | explicit_bzero | |
d9b022bd | 530 | fnmatch |
d4c880d5 | 531 | fseeko |
0120be6f KZ |
532 | fsconfig |
533 | fsmount | |
534 | fsopen | |
535 | fspick | |
d4c880d5 | 536 | fsync |
0e186591 | 537 | getttynam |
d4c880d5 ZJS |
538 | utimensat |
539 | getdomainname | |
540 | getdtablesize | |
541 | getexecname | |
542 | getmntinfo | |
543 | getrandom | |
544 | getrlimit | |
545 | getsgnam | |
546 | inotify_init | |
547 | jrand48 | |
ae015d71 TW |
548 | landlock_create_ruleset |
549 | landlock_add_rule | |
550 | landlock_restrict_self | |
d4c880d5 | 551 | lchown |
6124a6a3 TW |
552 | lgetxattr |
553 | llistxattr | |
d4c880d5 | 554 | llseek |
5bd1462d | 555 | newlocale |
d4c880d5 ZJS |
556 | mempcpy |
557 | mkostemp | |
10efb9ea KZ |
558 | move_mount |
559 | mount_setattr | |
d4c880d5 ZJS |
560 | nanosleep |
561 | ntp_gettime | |
10efb9ea | 562 | open_tree |
d4c880d5 ZJS |
563 | personality |
564 | pidfd_open | |
565 | pidfd_send_signal | |
566 | posix_fadvise | |
567 | prctl | |
568 | qsort_r | |
0322c9cd | 569 | reallocarray |
cd094a05 | 570 | renameat2 |
d4c880d5 ZJS |
571 | rpmatch |
572 | scandirat | |
573 | setprogname | |
5bd1462d | 574 | sendfile |
d4c880d5 ZJS |
575 | setns |
576 | setresgid | |
577 | setresuid | |
578 | sched_setattr | |
579 | sched_setscheduler | |
580 | sigqueue | |
581 | srandom | |
30c59d67 | 582 | statx |
d4c880d5 ZJS |
583 | strnchr |
584 | strndup | |
585 | strnlen | |
5bd1462d | 586 | strtod_l |
d4c880d5 ZJS |
587 | sysconf |
588 | sysinfo | |
589 | swapon | |
590 | swapoff | |
591 | timegm | |
592 | unshare | |
593 | usleep | |
5bd1462d TW |
594 | uselocale |
595 | utimensat | |
d4c880d5 ZJS |
596 | vwarnx |
597 | warn | |
598 | warnx | |
599 | prlimit | |
600 | ||
601 | openat | |
602 | fstatat | |
603 | unlinkat | |
604 | ioperm | |
605 | iopl | |
606 | futimens | |
607 | inotify_init1 | |
608 | open_memstream | |
609 | reboot | |
610 | getusershell | |
611 | '''.split() | |
612 | ||
613 | foreach func: funcs | |
614 | have = cc.has_function(func) | |
993556aa | 615 | # For autotools compatibility, use either #define FOO 1 or #undef FOO. |
d4c880d5 ZJS |
616 | # This makes little sense, but is necessary to avoid warnings about |
617 | # redefined macros from Python.h, which uses this convention. | |
618 | conf.set('HAVE_' + func.to_upper(), have ? 1 : false) | |
d4c880d5 ZJS |
619 | endforeach |
620 | ||
621 | have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1] | |
622 | conf.set('AGETTY_RELOAD', have ? 1 : false) | |
623 | if not have | |
624 | warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality') | |
625 | endif | |
626 | ||
627 | have_dirfd = (cc.has_function('dirfd') or | |
628 | cc.has_header_symbol('dirent.h', 'dirfd', | |
629 | prefix : '#include <sys/types.h>')) | |
630 | conf.set('HAVE_DIRFD', have_dirfd ? 1 : false) | |
631 | ||
632 | have_ddfd = cc.has_member('DIR', 'dd_fd', | |
633 | prefix : ''' | |
634 | #include <sys/types.h> | |
635 | #include <dirent.h> | |
636 | ''') | |
637 | conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false) | |
638 | ||
639 | have = cc.has_member('struct tm', 'tm_gmtoff', | |
640 | prefix : ''' | |
641 | #include <time.h> | |
642 | #include <unistd.h> | |
643 | ''') | |
644 | conf.set('HAVE_TM_GMTOFF', have ? 1 : false) | |
645 | ||
10efb9ea | 646 | |
10efb9ea | 647 | |
0120be6f | 648 | have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0 |
e23c3262 | 649 | conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false) |
0120be6f | 650 | |
d4c880d5 ZJS |
651 | have = cc.has_member('struct termios', 'c_line', |
652 | prefix : '#include <termios.h>') | |
653 | conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false) | |
654 | ||
655 | have = cc.has_member('struct stat', 'st_mtim.tv_nsec', | |
656 | prefix : '#include <sys/stat.h>') | |
657 | conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false) | |
658 | ||
2f82c248 | 659 | have = cc.has_member('struct statx', 'stx_mnt_id', |
7d679f29 | 660 | prefix : '#include <sys/stat.h>') |
2f82c248 KZ |
661 | conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false) |
662 | ||
d4c880d5 ZJS |
663 | # replacement for AC_STRUCT_TIMEZONE |
664 | have = cc.has_member('struct tm', 'tm_zone', | |
665 | prefix : '#include <time.h>') | |
666 | conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false) | |
667 | ||
5afe34ef | 668 | have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE') |
d4c880d5 ZJS |
669 | conf.set('HAVE_DECL_TZNAME', have ? 1 : false) |
670 | ||
0e186591 TW |
671 | have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY') |
672 | conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false) | |
673 | ||
674 | have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY') | |
675 | conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false) | |
676 | ||
d4c880d5 ZJS |
677 | code = ''' |
678 | #include <time.h> | |
679 | #if !@0@ | |
680 | extern char *tzname[]; | |
681 | #endif | |
682 | int main(void) { | |
683 | return tzname ? 0 : 1; | |
684 | } | |
685 | '''.format(have ? 1 : 0) | |
e25db916 | 686 | have = cc.compiles(code, name : 'using tzname[]') |
d4c880d5 ZJS |
687 | conf.set('HAVE_TZNAME', have ? 1 : false) |
688 | ||
a31f4c4f TW |
689 | have = cc.sizeof('time_t', prefix : '#include <time.h>') |
690 | if have < 8 | |
691 | add_global_arguments('-D_TIME_BITS=64', language : 'c') | |
692 | have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>') | |
693 | if have < 8 | |
694 | if get_option('allow-32bit-time') | |
695 | warning('Could not make time_t 64bits wide') | |
696 | else | |
697 | error('Could not make time_t 64bits wide') | |
698 | endif | |
699 | endif | |
700 | endif | |
701 | ||
d4c880d5 ZJS |
702 | socket_libs = [] |
703 | if not cc.has_function('socket') | |
704 | socket_libs += cc.find_library('socket', required : true) | |
705 | have = cc.has_function('socket', | |
706 | dependencies : socket_libs) | |
707 | if not have | |
708 | error('socket() function not available') | |
709 | endif | |
710 | endif | |
711 | ||
712 | realtime_libs = [] | |
713 | have = cc.has_function('clock_gettime') | |
714 | if not have | |
715 | realtime_libs += cc.find_library('rt', required : true) | |
716 | have = cc.has_function('clock_gettime', | |
717 | dependencies : realtime_libs) | |
718 | endif | |
e51565b6 | 719 | conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) |
d4c880d5 ZJS |
720 | |
721 | thread_libs = dependency('threads') | |
722 | ||
723 | have = cc.has_function('timer_create') | |
724 | if not have | |
c41e47c1 | 725 | realtime_libs = [cc.find_library('rt', required : true)] |
d4c880d5 ZJS |
726 | have = cc.has_function('timer_create', |
727 | dependencies : realtime_libs) | |
728 | if not have | |
729 | realtime_libs += thread_libs | |
730 | have = cc.has_function('timer_create', | |
731 | dependencies : realtime_libs) | |
732 | endif | |
733 | endif | |
734 | conf.set('HAVE_TIMER_CREATE', have ? 1 : false) | |
735 | if not have | |
736 | have = cc.has_function('setitimer') | |
737 | conf.set('HAVE_SETITIMER', have ? 1 : false) | |
738 | endif | |
739 | ||
740 | rtas_libs = cc.find_library('rtas', required : false) | |
741 | conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false) | |
742 | ||
743 | math_libs = [] | |
77765258 | 744 | if not cc.has_header_symbol('math.h', 'isnan') |
d4c880d5 ZJS |
745 | lib = cc.find_library('m', required : true) |
746 | if (cc.has_function('isnan', dependencies : lib) and | |
747 | cc.has_function('__isnan', dependencies : lib)) | |
748 | math_libs += lib | |
749 | endif | |
750 | endif | |
751 | ||
752 | have = cc.has_header_symbol('errno.h', 'program_invocation_short_name', | |
753 | args : '-D_GNU_SOURCE') | |
754 | conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false) | |
755 | ||
756 | code = ''' | |
757 | extern char *__progname; | |
758 | int main(void) { | |
759 | return (*__progname != 0); | |
760 | } | |
761 | ''' | |
e25db916 | 762 | have = cc.compiles(code, name : 'using __progname') |
d4c880d5 ZJS |
763 | conf.set('HAVE___PROGNAME', have ? 1 : false) |
764 | ||
941e1d55 TW |
765 | have = conf.get('HAVE_PTY_H').to_string() == '1' \ |
766 | and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1' | |
44475360 ZJS |
767 | conf.set('HAVE_PTY', have ? 1 : false) |
768 | ||
a0cf9105 LB |
769 | have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS') |
770 | conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false) | |
771 | ||
d4c880d5 ZJS |
772 | build_plymouth_support = get_option('build-plymouth-support') |
773 | have_tiocglcktrmios = cc.has_header_symbol( | |
774 | 'sys/ioctl.h', 'TIOCGLCKTRMIOS', | |
775 | required : build_plymouth_support.enabled()) | |
776 | have_sock_cloexec = cc.has_header_symbol( | |
777 | 'sys/socket.h', 'SOCK_CLOEXEC', | |
778 | prefix : '#include <sys/types.h>', | |
779 | required : build_plymouth_support.enabled()) | |
780 | have_sock_nonblock = cc.has_header_symbol( | |
781 | 'sys/socket.h', 'SOCK_NONBLOCK', | |
782 | prefix : '#include <sys/types.h>', | |
783 | required : build_plymouth_support.enabled()) | |
784 | have_so_passcred = cc.has_header_symbol( | |
785 | 'sys/socket.h', 'SO_PASSCRED', | |
b24dd22d | 786 | args : ['-D_GNU_SOURCE'], |
d4c880d5 ZJS |
787 | prefix : '#include <sys/types.h>', |
788 | required : build_plymouth_support.enabled()) | |
789 | ||
790 | build_plymouth_support = (not build_plymouth_support.disabled() and | |
791 | have_tiocglcktrmios and | |
792 | have_sock_cloexec and | |
793 | have_sock_nonblock and | |
794 | have_so_passcred) | |
795 | conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false) | |
796 | summary('plymouth support', | |
797 | build_plymouth_support ? 'enabled' : 'disabled', | |
798 | section : 'components') | |
799 | ||
800 | # check for valid fallocate() function | |
801 | # with 32 bits glibc 2.10, fallocate() exists but not fallocate64() | |
802 | # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64() | |
803 | # and program can't be linked. | |
804 | code = ''' | |
805 | #define _GNU_SOURCE | |
806 | #include <unistd.h> | |
807 | #include <fcntl.h> | |
808 | ||
809 | int main(void) { | |
810 | long ret; | |
811 | ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful); | |
812 | return ret == 0 ? 0 : 1; | |
813 | } | |
814 | ''' | |
815 | have = cc.links(code, name : 'fallocate() function') | |
816 | conf.set('HAVE_FALLOCATE', have ? 1 : false) | |
817 | ||
818 | code = ''' | |
819 | #include <unistd.h> | |
820 | #include <fcntl.h> | |
821 | ||
822 | int main(void) { | |
823 | long ret; | |
824 | ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful); | |
825 | return ret == 0 ? 0 : 1; | |
826 | } | |
827 | ''' | |
828 | have = cc.links(code, name : 'posix_fallocate() function') | |
829 | conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false) | |
830 | ||
831 | use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64'] | |
832 | message('Use CMOS clock: @0@'.format(use_hwclock_cmos)) | |
833 | conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false) | |
834 | ||
835 | conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false) | |
836 | conf.set('PG_BELL', get_option('pg-bell') ? 1 : false) | |
e0806c40 | 837 | conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false) |
d4c880d5 | 838 | |
8886d84e TW |
839 | is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__') |
840 | ||
d4c880d5 ZJS |
841 | ############################################################ |
842 | ||
6e92db54 | 843 | |
d4c880d5 ZJS |
844 | fs_search_path = get_option('fs-search-path') |
845 | fs_search_path_extra = get_option('fs-search-path-extra') | |
846 | if fs_search_path_extra != '' | |
847 | fs_search_path = ':'.join(fs_search_path, fs_search_path_extra) | |
848 | endif | |
849 | conf.set_quoted('FS_SEARCH_PATH', fs_search_path) | |
850 | ||
38b15ca2 | 851 | systemdsystemunitdir = '' |
fcbcb0cd | 852 | if systemd.found() |
e2b4f5be | 853 | systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir') |
fcbcb0cd | 854 | endif |
6e92db54 | 855 | |
5e67b421 CH |
856 | sysvinit = get_option('sysvinit').enabled() |
857 | sysvinitrcdir = sysconfdir + '/init.d' | |
858 | ||
ba30b89c | 859 | program_tests = get_option('program-tests') |
860 | ||
d4c880d5 ZJS |
861 | chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found() |
862 | conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false) | |
863 | ||
864 | have = get_option('chsh-only-listed') | |
865 | conf.set('ONLY_LISTED_SHELLS', have ? 1 : false) | |
866 | ||
867 | have = get_option('use-tty-group') | |
868 | conf.set('USE_TTY_GROUP', have ? 1 : false) | |
869 | ||
a4eeda56 KZ |
870 | bison = find_program('bison') |
871 | flex = find_program('flex') | |
872 | ||
d4c880d5 | 873 | build_hwclock = not get_option('build-hwclock').disabled() |
d4c880d5 ZJS |
874 | bison_gen = generator( |
875 | bison, | |
876 | output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'], | |
877 | arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']) | |
878 | ||
879 | meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh' | |
38bb89ee | 880 | meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh' |
d4c880d5 | 881 | |
7da59534 | 882 | configure_file( |
d4c880d5 ZJS |
883 | output : 'config.h', |
884 | configuration : conf) | |
885 | ||
5f2c862a | 886 | add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c') |
d4c880d5 | 887 | |
24b8804b TW |
888 | compiler_flags = [ |
889 | '-fno-common', | |
890 | ||
891 | '-Waddress-of-packed-member', | |
892 | '-Wdiscarded-qualifiers', | |
893 | '-Wembedded-directive', | |
894 | '-Wextra-semi', | |
895 | '-Wformat-security', | |
896 | '-Wimplicit-function-declaration', | |
897 | '-Wmissing-declarations', | |
898 | '-Wmissing-parameter-type', | |
899 | '-Wmissing-prototypes', | |
900 | '-Wnested-externs', | |
901 | '-Wno-missing-field-initializers', | |
9df5ac34 | 902 | '-Wold-style-definition', |
24b8804b TW |
903 | '-Wpointer-arith', |
904 | '-Wredundant-decls', | |
905 | '-Wsign-compare', | |
906 | '-Wstrict-prototypes', | |
907 | '-Wtype-limits', | |
908 | '-Wuninitialized', | |
909 | '-Wunused-but-set-parameter', | |
910 | '-Wunused-but-set-variable', | |
911 | '-Wunused-parameter', | |
912 | '-Wunused-result', | |
913 | '-Wunused-variable', | |
a52f9bdd | 914 | '-Wvla', |
2a91b213 | 915 | '-Walloca', |
24b8804b TW |
916 | ] |
917 | foreach compiler_flag : compiler_flags | |
918 | if cc.has_argument(compiler_flag) | |
919 | add_project_arguments(compiler_flag, language : 'c') | |
920 | endif | |
921 | endforeach | |
922 | ||
53b37016 | 923 | manadocs = [] |
38bb89ee | 924 | manlinks = {} |
aa519054 | 925 | |
38bb89ee | 926 | bashcompletions = [] |
aa519054 | 927 | bashcompletionslinks = {} |
53b37016 | 928 | |
d4c880d5 ZJS |
929 | subdir('include') |
930 | subdir('lib') | |
931 | subdir('libblkid') | |
932 | subdir('libmount') | |
933 | subdir('libsmartcols') | |
934 | subdir('libuuid') | |
c2e299d0 | 935 | subdir('liblastlog2') |
d4c880d5 | 936 | subdir('libfdisk') |
c2e299d0 | 937 | subdir('pam_lastlog2') |
d4c880d5 ZJS |
938 | subdir('login-utils') |
939 | subdir('sys-utils') | |
940 | subdir('disk-utils') | |
941 | subdir('misc-utils') | |
942 | subdir('text-utils') | |
943 | subdir('term-utils') | |
944 | subdir('po') | |
945 | ||
946 | includes = [dir_include, | |
947 | dir_libblkid, | |
948 | dir_libsmartcols, | |
949 | dir_libmount, | |
950 | dir_libfdisk, | |
951 | dir_libuuid, | |
c2e299d0 | 952 | dir_liblastlog2, |
d4c880d5 ZJS |
953 | dir_sys_utils] |
954 | ||
955 | exes = [] | |
956 | ||
957 | opt = not get_option('build-chfn-chsh').disabled() | |
958 | exe = executable( | |
959 | 'chfn', | |
960 | chfn_sources, | |
961 | chfn_chsh_sources, | |
962 | include_directories : includes, | |
0333c40b | 963 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
964 | dependencies : chfn_chsh_deps, |
965 | install_dir : usrbin_exec_dir, | |
60d457f5 | 966 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
967 | install : opt, |
968 | build_by_default : opt) | |
38bb89ee | 969 | |
d4c880d5 ZJS |
970 | exe2 = executable( |
971 | 'chsh', | |
972 | 'login-utils/chsh.c', | |
4b724469 | 973 | 'lib/shells.c', |
d4c880d5 ZJS |
974 | chfn_chsh_sources, |
975 | include_directories : includes, | |
976 | link_with : lib_common, | |
977 | dependencies : chfn_chsh_deps, | |
978 | install_dir : usrbin_exec_dir, | |
a13574b1 | 979 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
980 | install : opt, |
981 | build_by_default : opt) | |
982 | if opt and not is_disabler(exe) | |
983 | exes += [exe, exe2] | |
38bb89ee TW |
984 | manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc'] |
985 | bashcompletions += ['chfn', 'chsh'] | |
d4c880d5 ZJS |
986 | endif |
987 | ||
988 | exe = executable( | |
989 | 'test_islocal', | |
990 | test_islocal_sources, | |
991 | include_directories : includes, | |
ba30b89c | 992 | c_args : '-DTEST_PROGRAM', |
993 | build_by_default : program_tests) | |
d4c880d5 ZJS |
994 | exes += exe |
995 | ||
d4c880d5 ZJS |
996 | exe = executable( |
997 | 'test-consoles', | |
998 | test_consoles_sources, | |
999 | c_args : ['-DTEST_PROGRAM'], | |
1000 | include_directories : includes, | |
ba30b89c | 1001 | link_with : lib_common, |
1002 | build_by_default : program_tests) | |
d4c880d5 ZJS |
1003 | exes += exe |
1004 | ||
1005 | opt = not get_option('build-last').disabled() | |
1006 | exe = executable( | |
1007 | 'last', | |
1008 | last_sources, | |
1009 | include_directories : includes, | |
1010 | link_with : [lib_common], | |
1011 | install_dir : usrbin_exec_dir, | |
1012 | install : opt, | |
1013 | build_by_default : opt) | |
1014 | if opt and not is_disabler(exe) | |
1015 | exes += exe | |
1016 | meson.add_install_script(meson_make_symlink, | |
1017 | 'last', | |
1018 | join_paths(usrbin_exec_dir, 'lastb')) | |
38bb89ee TW |
1019 | manadocs += ['login-utils/last.1.adoc'] |
1020 | manlinks += {'lastb.1': 'last.1'} | |
1021 | bashcompletions += ['last'] | |
aa519054 | 1022 | bashcompletionslinks += {'lastb': 'last'} |
d4c880d5 ZJS |
1023 | endif |
1024 | ||
1025 | opt = not get_option('build-nologin').disabled() | |
1026 | exe = executable( | |
1027 | 'nologin', | |
1028 | 'login-utils/nologin.c', | |
1029 | include_directories : includes, | |
1030 | install_dir : sbindir, | |
308a0979 | 1031 | link_with : [lib_common], |
d4c880d5 ZJS |
1032 | install : opt, |
1033 | build_by_default : opt) | |
1034 | if opt and not is_disabler(exe) | |
1035 | exes += exe | |
38bb89ee | 1036 | manadocs += ['login-utils/nologin.8.adoc'] |
d4c880d5 ZJS |
1037 | endif |
1038 | ||
1039 | opt = not get_option('build-utmpdump').disabled() | |
1040 | exe = executable( | |
1041 | 'utmpdump', | |
1042 | 'login-utils/utmpdump.c', | |
1043 | include_directories : includes, | |
1044 | link_with : [lib_common], | |
1045 | install_dir : usrbin_exec_dir, | |
1046 | install : opt, | |
1047 | build_by_default : opt) | |
1048 | if opt and not is_disabler(exe) | |
1049 | exes += exe | |
38bb89ee TW |
1050 | manadocs += ['login-utils/utmpdump.1.adoc'] |
1051 | bashcompletions += ['utmpdump'] | |
d4c880d5 ZJS |
1052 | endif |
1053 | ||
1054 | opt = not get_option('build-su').disabled() | |
1055 | exe = executable( | |
1056 | 'su', | |
1057 | 'login-utils/su.c', | |
1058 | 'login-utils/su-common.c', | |
1059 | 'login-utils/su-common.h', | |
4b724469 | 1060 | 'lib/shells.c', |
d4c880d5 ZJS |
1061 | pty_session_c, |
1062 | monotonic_c, | |
1063 | include_directories : includes, | |
0333c40b | 1064 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1065 | dependencies : [lib_pam, |
1066 | lib_pam_misc, | |
1067 | lib_util, | |
1068 | realtime_libs], | |
fb8c224e | 1069 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1070 | install : opt, |
1071 | build_by_default : opt) | |
1072 | if opt and not is_disabler(exe) | |
1073 | exes += exe | |
38bb89ee TW |
1074 | manadocs += ['login-utils/su.1.adoc'] |
1075 | bashcompletions += ['su'] | |
d4c880d5 ZJS |
1076 | endif |
1077 | ||
1078 | opt = not get_option('build-newgrp').disabled() | |
1079 | exe = executable( | |
1080 | 'newgrp', | |
1081 | 'login-utils/newgrp.c', | |
1082 | include_directories : includes, | |
1083 | dependencies : [lib_crypt], | |
1084 | install_dir : usrbin_exec_dir, | |
cb3dee5a | 1085 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1086 | install : opt, |
1087 | build_by_default : opt) | |
1088 | if opt and not is_disabler(exe) | |
1089 | exes += exe | |
38bb89ee | 1090 | manadocs += ['login-utils/newgrp.1.adoc'] |
f265b432 | 1091 | bashcompletions += ['newgrp'] |
d4c880d5 ZJS |
1092 | endif |
1093 | ||
1094 | opt = not get_option('build-lslogins').disabled() | |
1095 | exe = executable( | |
1096 | 'lslogins', | |
1097 | 'login-utils/lslogins.c', | |
d4c880d5 ZJS |
1098 | include_directories : includes, |
1099 | link_with : [lib_common, | |
0333c40b TW |
1100 | lib_smartcols, |
1101 | logindefs_c], | |
d4c880d5 ZJS |
1102 | dependencies : [lib_selinux, |
1103 | lib_systemd], | |
1104 | install_dir : usrbin_exec_dir, | |
1105 | install : opt, | |
1106 | build_by_default : opt) | |
1107 | if opt and not is_disabler(exe) | |
1108 | exes += exe | |
38bb89ee TW |
1109 | manadocs += ['login-utils/lslogins.1.adoc'] |
1110 | bashcompletions += ['lslogins'] | |
d4c880d5 ZJS |
1111 | endif |
1112 | ||
1113 | opt = not get_option('build-vipw').disabled() | |
1114 | exe = executable( | |
1115 | 'vipw', | |
1116 | 'login-utils/vipw.c', | |
1117 | 'login-utils/setpwnam.h', | |
1118 | include_directories : includes, | |
1119 | link_with : [lib_common], | |
1120 | dependencies : [lib_selinux], | |
1121 | install_dir : usrbin_exec_dir, | |
1122 | install : opt, | |
1123 | build_by_default : opt) | |
1124 | if opt and not is_disabler(exe) | |
1125 | exes += exe | |
1126 | meson.add_install_script(meson_make_symlink, | |
1127 | 'vipw', | |
1128 | join_paths(usrbin_exec_dir, 'vigr')) | |
38bb89ee | 1129 | manadocs += ['login-utils/vipw.8.adoc'] |
f6fb7fa7 CH |
1130 | meson.add_install_script(meson_make_symlink, |
1131 | 'vipw.8', | |
1132 | join_paths(mandir, 'man8/vigr.8')) | |
d4c880d5 ZJS |
1133 | endif |
1134 | ||
1135 | opt = not get_option('build-runuser').disabled() | |
1136 | exe = executable( | |
1137 | 'runuser', | |
1138 | 'login-utils/runuser.c', | |
1139 | 'login-utils/su-common.c', | |
1140 | 'login-utils/su-common.h', | |
4b724469 | 1141 | 'lib/shells.c', |
d4c880d5 ZJS |
1142 | pty_session_c, |
1143 | monotonic_c, | |
1144 | include_directories : includes, | |
0333c40b | 1145 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1146 | dependencies : [lib_pam, |
1147 | lib_pam_misc, | |
1148 | lib_util, | |
1149 | realtime_libs], | |
1150 | install_dir : sbindir, | |
1151 | install : opt, | |
1152 | build_by_default : opt) | |
1153 | if opt and not is_disabler(exe) | |
1154 | exes += exe | |
38bb89ee | 1155 | manadocs += ['login-utils/runuser.1.adoc'] |
aa519054 | 1156 | bashcompletionslinks += {'runuser': 'su'} |
d4c880d5 ZJS |
1157 | endif |
1158 | ||
1159 | ############################################################ | |
1160 | ||
8886d84e TW |
1161 | if is_glibc |
1162 | exe = executable( | |
1163 | 'col', | |
1164 | col_sources, | |
1165 | include_directories : includes, | |
1166 | link_with : lib_common, | |
1167 | install_dir : usrbin_exec_dir, | |
1168 | install : true) | |
1169 | exes += exe | |
1170 | manadocs += ['text-utils/col.1.adoc'] | |
1171 | bashcompletions += ['col'] | |
1172 | endif | |
d4c880d5 ZJS |
1173 | |
1174 | exe = executable( | |
1175 | 'colcrt', | |
1176 | colcrt_sources, | |
1177 | include_directories : includes, | |
1178 | install_dir : usrbin_exec_dir, | |
1179 | install : true) | |
1180 | exes += exe | |
38bb89ee TW |
1181 | manadocs += ['text-utils/colcrt.1.adoc'] |
1182 | bashcompletions += ['colcrt'] | |
d4c880d5 ZJS |
1183 | |
1184 | exe = executable( | |
1185 | 'colrm', | |
1186 | colrm_sources, | |
1187 | include_directories : includes, | |
1188 | link_with : lib_common, | |
1189 | install_dir : usrbin_exec_dir, | |
1190 | install : true) | |
1191 | exes += exe | |
38bb89ee TW |
1192 | manadocs += ['text-utils/colrm.1.adoc'] |
1193 | bashcompletions += ['colrm'] | |
d4c880d5 ZJS |
1194 | |
1195 | exe = executable( | |
1196 | 'rev', | |
1197 | rev_sources, | |
1198 | include_directories : includes, | |
1199 | install_dir : usrbin_exec_dir, | |
1200 | install : true) | |
1201 | exes += exe | |
38bb89ee TW |
1202 | manadocs += ['text-utils/rev.1.adoc'] |
1203 | bashcompletions += ['rev'] | |
d4c880d5 ZJS |
1204 | |
1205 | exe = executable( | |
1206 | 'column', | |
1207 | column_sources, | |
1208 | include_directories : includes, | |
1209 | link_with : [lib_common, | |
1210 | lib_smartcols], | |
1211 | install_dir : usrbin_exec_dir, | |
1212 | install : true) | |
1213 | if not is_disabler(exe) | |
1214 | exes += exe | |
38bb89ee TW |
1215 | manadocs += ['text-utils/column.1.adoc'] |
1216 | bashcompletions += ['column'] | |
d4c880d5 ZJS |
1217 | endif |
1218 | ||
1219 | opt = not get_option('build-line').disabled() | |
1220 | exe = executable( | |
1221 | 'line', | |
1222 | line_sources, | |
1223 | include_directories : includes, | |
1224 | install_dir : usrbin_exec_dir, | |
1225 | install : opt, | |
1226 | build_by_default : opt) | |
1227 | if opt and not is_disabler(exe) | |
1228 | exes += exe | |
38bb89ee | 1229 | manadocs += ['text-utils/line.1.adoc'] |
d4c880d5 ZJS |
1230 | endif |
1231 | ||
1232 | opt = not get_option('build-pg').disabled() | |
1233 | exe = executable( | |
1234 | 'pg', | |
1235 | pg_sources, | |
1236 | link_with : lib_common, | |
1237 | include_directories : includes, | |
1238 | dependencies : [lib_tinfo, | |
1239 | curses_libs], | |
1240 | install_dir : usrbin_exec_dir, | |
1241 | install : opt, | |
1242 | build_by_default : opt) | |
1243 | if opt and not is_disabler(exe) | |
1244 | exes += exe | |
38bb89ee TW |
1245 | manadocs += ['text-utils/pg.1.adoc'] |
1246 | bashcompletions += ['pg'] | |
d4c880d5 ZJS |
1247 | endif |
1248 | ||
1249 | opt = not get_option('build-ul').disabled() | |
1250 | exe = executable( | |
1251 | 'ul', | |
1252 | ul_sources, | |
1253 | include_directories : includes, | |
1254 | dependencies : [lib_tinfo, | |
1255 | curses_libs], | |
1256 | install_dir : usrbin_exec_dir, | |
1257 | install : opt, | |
1258 | build_by_default : opt) | |
1259 | if opt and not is_disabler(exe) | |
1260 | exes += exe | |
38bb89ee TW |
1261 | manadocs += ['text-utils/ul.1.adoc'] |
1262 | bashcompletions += ['ul'] | |
d4c880d5 ZJS |
1263 | endif |
1264 | ||
1265 | opt = not get_option('build-more').disabled() | |
1266 | exe = executable( | |
1267 | 'more', | |
1268 | more_sources, | |
308a0979 | 1269 | link_with : [lib_common], |
d4c880d5 ZJS |
1270 | include_directories : includes, |
1271 | dependencies : [lib_tinfo, | |
6e92db54 KZ |
1272 | curses_libs, |
1273 | lib_magic], | |
d4c880d5 ZJS |
1274 | install : opt, |
1275 | build_by_default : opt) | |
1276 | exe2 = executable( | |
1277 | 'test_more', | |
1278 | more_sources, | |
308a0979 | 1279 | link_with : [lib_common], |
d4c880d5 ZJS |
1280 | include_directories : includes, |
1281 | c_args : '-DTEST_PROGRAM', | |
1282 | dependencies : [lib_tinfo, | |
6e92db54 KZ |
1283 | curses_libs, |
1284 | lib_magic], | |
ba30b89c | 1285 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
1286 | exes += exe |
1287 | if opt and not is_disabler(exe) | |
1288 | exes += [exe, exe2] | |
38bb89ee TW |
1289 | manadocs += ['text-utils/more.1.adoc'] |
1290 | bashcompletions += ['more'] | |
d4c880d5 ZJS |
1291 | endif |
1292 | ||
1293 | exe = executable( | |
1294 | 'hexdump', | |
1295 | hexdump_sources, | |
1296 | include_directories : includes, | |
1297 | link_with : [lib_common, | |
1298 | lib_tcolors], | |
1299 | install_dir : usrbin_exec_dir, | |
1300 | install : true) | |
1301 | if not is_disabler(exe) | |
1302 | exes += exe | |
53b37016 | 1303 | manadocs += ['text-utils/hexdump.1.adoc'] |
38bb89ee | 1304 | bashcompletions += ['hexdump'] |
d4c880d5 ZJS |
1305 | endif |
1306 | ||
1307 | opt = not get_option('build-lsmem').disabled() | |
1308 | exe = executable( | |
1309 | 'lsmem', | |
1310 | lsmem_sources, | |
1311 | include_directories : includes, | |
1312 | link_with : [lib_common, | |
1313 | lib_smartcols], | |
1314 | install_dir : usrbin_exec_dir, | |
1315 | install : opt, | |
1316 | build_by_default : opt) | |
1317 | if opt and not is_disabler(exe) | |
1318 | exes += exe | |
53b37016 | 1319 | manadocs += ['sys-utils/lsmem.1.adoc'] |
38bb89ee | 1320 | bashcompletions += ['lsmem'] |
d4c880d5 ZJS |
1321 | endif |
1322 | ||
1323 | opt = not get_option('build-chmem').disabled() | |
1324 | exe = executable( | |
1325 | 'chmem', | |
1326 | chmem_sources, | |
1327 | include_directories : includes, | |
1328 | link_with : [lib_common], | |
1329 | install_dir : usrbin_exec_dir, | |
1330 | install : opt, | |
1331 | build_by_default : opt) | |
1332 | if opt and not is_disabler(exe) | |
1333 | exes += exe | |
53b37016 | 1334 | manadocs += ['sys-utils/chmem.8.adoc'] |
38bb89ee | 1335 | bashcompletions += ['chmem'] |
d4c880d5 ZJS |
1336 | endif |
1337 | ||
1338 | exe = executable( | |
1339 | 'choom', | |
1340 | choom_sources, | |
1341 | include_directories : includes, | |
1342 | link_with : [lib_common], | |
1343 | install_dir : usrbin_exec_dir, | |
1344 | install : true) | |
1345 | exes += exe | |
53b37016 | 1346 | manadocs += ['sys-utils/choom.1.adoc'] |
d4c880d5 ZJS |
1347 | |
1348 | exe = executable( | |
1349 | 'ipcmk', | |
1350 | ipcmk_sources, | |
1351 | include_directories : includes, | |
1352 | link_with : [lib_common], | |
1353 | install_dir : usrbin_exec_dir, | |
1354 | install : true) | |
1355 | exes += exe | |
53b37016 | 1356 | manadocs += ['sys-utils/ipcmk.1.adoc'] |
38bb89ee | 1357 | bashcompletions += ['ipcmk'] |
d4c880d5 ZJS |
1358 | |
1359 | exe = executable( | |
1360 | 'ipcrm', | |
1361 | ipcrm_sources, | |
1362 | include_directories : includes, | |
1363 | link_with : [lib_common], | |
1364 | install_dir : usrbin_exec_dir, | |
1365 | install : true) | |
1366 | exes += exe | |
53b37016 | 1367 | manadocs += ['sys-utils/ipcrm.1.adoc'] |
38bb89ee | 1368 | bashcompletions += ['ipcrm'] |
d4c880d5 ZJS |
1369 | |
1370 | opt = not get_option('build-ipcs').disabled() | |
1371 | exe = executable( | |
1372 | 'ipcs', | |
1373 | ipcs_sources, | |
1374 | include_directories : includes, | |
1375 | link_with : [lib_common], | |
1376 | install_dir : usrbin_exec_dir, | |
1377 | install : opt, | |
1378 | build_by_default : opt) | |
1379 | if opt and not is_disabler(exe) | |
1380 | exes += exe | |
53b37016 | 1381 | manadocs += ['sys-utils/ipcs.1.adoc'] |
38bb89ee | 1382 | bashcompletions += ['ipcs'] |
d4c880d5 ZJS |
1383 | endif |
1384 | ||
1385 | opt = not get_option('build-rfkill').disabled() | |
1386 | exe = executable( | |
1387 | 'rfkill', | |
1388 | rfkill_sources, | |
1389 | include_directories : includes, | |
1390 | link_with : [lib_common, | |
1391 | lib_smartcols], | |
1392 | install_dir : usrsbin_exec_dir, | |
1393 | install : opt, | |
1394 | build_by_default : opt) | |
1395 | if opt and not is_disabler(exe) | |
1396 | exes += exe | |
53b37016 | 1397 | manadocs += ['sys-utils/rfkill.8.adoc'] |
38bb89ee | 1398 | bashcompletions += ['rfkill'] |
d4c880d5 ZJS |
1399 | endif |
1400 | ||
1401 | exe = executable( | |
1402 | 'renice', | |
1403 | renice_sources, | |
1404 | include_directories : includes, | |
1405 | link_with : [lib_common, | |
1406 | lib_smartcols], | |
1407 | install_dir : usrbin_exec_dir, | |
1408 | install : true) | |
1409 | if not is_disabler(exe) | |
1410 | exes += exe | |
53b37016 | 1411 | manadocs += ['sys-utils/renice.1.adoc'] |
38bb89ee | 1412 | bashcompletions += ['renice'] |
d4c880d5 ZJS |
1413 | endif |
1414 | ||
f092076f DDM |
1415 | exe = executable( |
1416 | 'setpgid', | |
1417 | setpgid_sources, | |
1418 | include_directories: includes, | |
1419 | link_with : [lib_common, | |
1420 | lib_smartcols], | |
1421 | install_dir : usrbin_exec_dir, | |
1422 | install : true) | |
1423 | if opt and not is_disabler(exe) | |
1424 | exes += exe | |
1425 | manadocs += ['sys-utils/setpgid.1.adoc'] | |
1426 | bashcompletions += ['setpgid'] | |
1427 | endif | |
1428 | ||
d4c880d5 ZJS |
1429 | exe = executable( |
1430 | 'setsid', | |
1431 | setsid_sources, | |
1432 | include_directories : includes, | |
1433 | link_with : [lib_common, | |
1434 | lib_smartcols], | |
1435 | install_dir : usrbin_exec_dir, | |
1436 | install : true) | |
1437 | if opt and not is_disabler(exe) | |
1438 | exes += exe | |
53b37016 | 1439 | manadocs += ['sys-utils/setsid.1.adoc'] |
38bb89ee | 1440 | bashcompletions += ['setsid'] |
d4c880d5 ZJS |
1441 | endif |
1442 | ||
1443 | exe = executable( | |
1444 | 'readprofile', | |
1445 | readprofile_sources, | |
1446 | include_directories : includes, | |
1447 | link_with : [lib_common, | |
1448 | lib_smartcols], | |
1449 | install_dir : usrsbin_exec_dir, | |
1450 | install : true) | |
1451 | if not is_disabler(exe) | |
1452 | exes += exe | |
53b37016 | 1453 | manadocs += ['sys-utils/readprofile.8.adoc'] |
38bb89ee | 1454 | bashcompletions += ['readprofile'] |
d4c880d5 ZJS |
1455 | endif |
1456 | ||
1457 | opt = not get_option('build-tunelp').disabled() | |
1458 | exe = executable( | |
1459 | 'tunelp', | |
1460 | tunelp_sources, | |
1461 | include_directories : includes, | |
1462 | link_with : [lib_common], | |
1463 | install_dir : usrsbin_exec_dir, | |
1464 | install : opt, | |
1465 | build_by_default : opt) | |
1466 | if opt and not is_disabler(exe) | |
1467 | exes += exe | |
53b37016 | 1468 | manadocs += ['sys-utils/tunelp.8.adoc'] |
38bb89ee | 1469 | bashcompletions += ['tunelp'] |
d4c880d5 ZJS |
1470 | endif |
1471 | ||
1472 | exe = executable( | |
1473 | 'fstrim', | |
1474 | fstrim_sources, | |
1475 | include_directories : includes, | |
1476 | link_with : [lib_common, | |
1477 | lib_mount], | |
1478 | install_dir : sbindir, | |
1479 | install : true) | |
1480 | if not is_disabler(exe) | |
1481 | exes += exe | |
53b37016 | 1482 | manadocs += ['sys-utils/fstrim.8.adoc'] |
38bb89ee | 1483 | bashcompletions += ['fstrim'] |
d4c880d5 ZJS |
1484 | endif |
1485 | ||
1486 | exe = executable( | |
1487 | 'dmesg', | |
1488 | dmesg_sources, | |
1489 | include_directories : includes, | |
1490 | link_with : [lib_common, | |
1491 | lib_tcolors], | |
1492 | install : true) | |
1493 | if not is_disabler(exe) | |
1494 | exes += exe | |
53b37016 | 1495 | manadocs += ['sys-utils/dmesg.1.adoc'] |
38bb89ee | 1496 | bashcompletions += ['dmesg'] |
d4c880d5 ZJS |
1497 | endif |
1498 | ||
1499 | exe = executable( | |
1500 | 'test_dmesg', | |
1501 | dmesg_sources, | |
1502 | include_directories : dir_include, | |
1503 | c_args : '-DTEST_DMESG', | |
1504 | link_with : [lib_common, | |
ba30b89c | 1505 | lib_tcolors], |
1506 | build_by_default : program_tests) | |
d4c880d5 ZJS |
1507 | if not is_disabler(exe) |
1508 | exes += exe | |
1509 | endif | |
1510 | ||
1511 | exe = executable( | |
1512 | 'ctrlaltdel', | |
1513 | ctrlaltdel_sources, | |
1514 | include_directories : includes, | |
1515 | link_with : [lib_common], | |
1516 | install_dir : sbindir, | |
1517 | install : true) | |
1518 | exes += exe | |
53b37016 | 1519 | manadocs += ['sys-utils/ctrlaltdel.8.adoc'] |
38bb89ee | 1520 | bashcompletions += ['ctrlaltdel'] |
d4c880d5 ZJS |
1521 | |
1522 | exe = executable( | |
1523 | 'fsfreeze', | |
1524 | fsfreeze_sources, | |
1525 | include_directories : includes, | |
1526 | install_dir : sbindir, | |
1527 | install : true) | |
1528 | exes += exe | |
53b37016 | 1529 | manadocs += ['sys-utils/fsfreeze.8.adoc'] |
38bb89ee | 1530 | bashcompletions += ['fsfreeze'] |
d4c880d5 ZJS |
1531 | |
1532 | exe = executable( | |
1533 | 'blkdiscard', | |
1534 | blkdiscard_sources, | |
1535 | include_directories : includes, | |
308a0979 KZ |
1536 | link_with : [lib_common, |
1537 | lib_blkid], | |
d4c880d5 ZJS |
1538 | install_dir : sbindir, |
1539 | install : true) | |
1540 | exes += exe | |
53b37016 | 1541 | manadocs += ['sys-utils/blkdiscard.8.adoc'] |
38bb89ee | 1542 | bashcompletions += ['blkdiscard'] |
d4c880d5 ZJS |
1543 | |
1544 | exe = executable( | |
1545 | 'blkzone', | |
1546 | blkzone_sources, | |
1547 | include_directories : includes, | |
1548 | link_with : [lib_common], | |
1549 | install_dir : sbindir, | |
1550 | install : true) | |
1551 | exes += exe | |
53b37016 | 1552 | manadocs += ['sys-utils/blkzone.8.adoc'] |
38bb89ee | 1553 | bashcompletions += ['blkzone'] |
d4c880d5 | 1554 | |
61c2946d TW |
1555 | exe = executable( |
1556 | 'blkpr', | |
1557 | blkpr_sources, | |
1558 | include_directories : includes, | |
1559 | link_with : [lib_common], | |
1560 | install_dir : sbindir, | |
1561 | install : true) | |
1562 | exes += exe | |
1563 | manadocs += ['sys-utils/blkpr.8.adoc'] | |
1564 | ||
d4c880d5 ZJS |
1565 | exe = executable( |
1566 | 'ldattach', | |
1567 | ldattach_sources, | |
1568 | include_directories : includes, | |
1569 | link_with : [lib_common], | |
1570 | install_dir : usrsbin_exec_dir, | |
1571 | install : true) | |
1572 | exes += exe | |
53b37016 | 1573 | manadocs += ['sys-utils/ldattach.8.adoc'] |
38bb89ee | 1574 | bashcompletions += ['ldattach'] |
d4c880d5 ZJS |
1575 | |
1576 | exe = executable( | |
1577 | 'rtcwake', | |
1578 | rtcwake_sources, | |
1579 | include_directories : includes, | |
1580 | link_with : [lib_common], | |
1581 | install_dir : usrsbin_exec_dir, | |
1582 | install : true) | |
1583 | exes += exe | |
53b37016 | 1584 | manadocs += ['sys-utils/rtcwake.8.adoc'] |
38bb89ee | 1585 | bashcompletions += ['rtcwake'] |
d4c880d5 ZJS |
1586 | |
1587 | exe = executable( | |
1588 | 'setarch', | |
1589 | setarch_sources, | |
1590 | include_directories : includes, | |
035fc2d9 | 1591 | link_with : [lib_common], |
d4c880d5 ZJS |
1592 | install_dir : usrbin_exec_dir, |
1593 | install : true) | |
1594 | exes += exe | |
53b37016 | 1595 | manadocs += ['sys-utils/setarch.8.adoc'] |
38bb89ee | 1596 | bashcompletions += ['setarch'] |
d4c880d5 ZJS |
1597 | |
1598 | setarch_links = ['uname26', 'linux32', 'linux64'] | |
1599 | setarch_links_arch = { | |
1600 | 's390x' : ['s390', 's390x'], | |
1601 | 'x86' : ['i386'], | |
1602 | 'x86_64' : ['i386', 'x86_64'], | |
1603 | 'ppc64' : ['ppc', 'ppc64', 'ppc32'], | |
1604 | 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'], | |
1605 | 'mips64' : ['mips', 'mips64', 'mips32'], | |
1606 | 'ia64' : ['i386', 'ia64'], | |
1607 | 'hppa' : ['parisc', 'parisc64', 'parisc32'], | |
1608 | } | |
1609 | setarch_links += setarch_links_arch.get(host_machine.cpu_family(), []) | |
1610 | ||
1611 | foreach link: setarch_links | |
1612 | meson.add_install_script(meson_make_symlink, | |
1613 | 'setarch', | |
1614 | join_paths(usrbin_exec_dir, link)) | |
38bb89ee | 1615 | manlinks += {link + '.8': 'setarch.8'} |
d4c880d5 ZJS |
1616 | endforeach |
1617 | ||
1618 | opt = not get_option('build-eject').disabled() | |
1619 | exe = executable( | |
1620 | 'eject', | |
1621 | eject_sources, | |
1622 | include_directories : includes, | |
1623 | link_with : [lib_common, | |
1624 | lib_mount], | |
1625 | install_dir : usrbin_exec_dir, | |
1626 | install : opt, | |
1627 | build_by_default : opt) | |
1628 | if opt and not is_disabler(exe) | |
1629 | exe = exe | |
53b37016 | 1630 | manadocs += ['sys-utils/eject.1.adoc'] |
38bb89ee | 1631 | bashcompletions += ['eject'] |
d4c880d5 ZJS |
1632 | endif |
1633 | ||
1634 | opt = not get_option('build-losetup').disabled() | |
1635 | exe = executable( | |
1636 | 'losetup', | |
1637 | losetup_sources, | |
1638 | include_directories : includes, | |
1639 | link_with : [lib_common, | |
1640 | lib_smartcols], | |
1641 | install_dir : sbindir, | |
1642 | install : opt, | |
1643 | build_by_default : opt) | |
1644 | if opt and not is_disabler(exe) | |
53b37016 | 1645 | manadocs += ['sys-utils/losetup.8.adoc'] |
d4c880d5 | 1646 | exes += exe |
38bb89ee | 1647 | bashcompletions += ['losetup'] |
d4c880d5 ZJS |
1648 | endif |
1649 | ||
69939195 ZJS |
1650 | opt = opt and 'losetup' in static_programs |
1651 | exe = executable( | |
1652 | 'losetup.static', | |
1653 | losetup_sources, | |
1654 | include_directories : includes, | |
1655 | link_args : ['--static'], | |
1656 | link_with : [lib_common, | |
1657 | lib_smartcols.get_static_lib()], | |
1658 | install_dir : sbindir, | |
1659 | install : opt, | |
1660 | build_by_default : opt) | |
1661 | if opt and not is_disabler(exe) | |
1662 | exes += exe | |
1663 | endif | |
1664 | ||
d4c880d5 ZJS |
1665 | opt = not get_option('build-zramctl').disabled() |
1666 | exe = executable( | |
1667 | 'zramctl', | |
1668 | zramctl_sources, | |
1669 | include_directories : includes, | |
1670 | link_with : [lib_common, | |
1671 | lib_smartcols], | |
1672 | install_dir : sbindir, | |
1673 | install : opt, | |
1674 | build_by_default : opt) | |
1675 | if opt and not is_disabler(exe) | |
1676 | exes += exe | |
53b37016 | 1677 | manadocs += ['sys-utils/zramctl.8.adoc'] |
38bb89ee | 1678 | bashcompletions += ['zramctl'] |
d4c880d5 ZJS |
1679 | endif |
1680 | ||
1681 | exe = executable( | |
1682 | 'prlimit', | |
1683 | prlimit_sources, | |
1684 | include_directories : includes, | |
1685 | link_with : [lib_common, | |
1686 | lib_smartcols], | |
1687 | install_dir : usrbin_exec_dir, | |
1688 | install : true) | |
1689 | if not is_disabler(exe) | |
1690 | exes += exe | |
53b37016 | 1691 | manadocs += ['sys-utils/prlimit.1.adoc'] |
38bb89ee | 1692 | bashcompletions += ['prlimit'] |
d4c880d5 ZJS |
1693 | endif |
1694 | ||
1695 | exe = executable( | |
1696 | 'lsns', | |
1697 | lsns_sources, | |
1698 | include_directories : includes, | |
1699 | link_with : [lib_common, | |
1700 | lib_smartcols, | |
1701 | lib_mount], | |
1702 | install_dir : usrbin_exec_dir, | |
1703 | install : true) | |
1704 | if not is_disabler(exe) | |
1705 | exes += exe | |
53b37016 | 1706 | manadocs += ['sys-utils/lsns.8.adoc'] |
38bb89ee | 1707 | bashcompletions += ['lsns'] |
d4c880d5 ZJS |
1708 | endif |
1709 | ||
1710 | opt = not get_option('build-mount').disabled() | |
1711 | exe = executable( | |
1712 | 'mount', | |
1713 | mount_sources, | |
1714 | include_directories : includes, | |
1715 | link_with : [lib_common, | |
1716 | lib_smartcols, | |
1717 | lib_mount], | |
1718 | dependencies : lib_selinux, | |
8f49b369 | 1719 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1720 | install : opt, |
1721 | build_by_default : opt) | |
1722 | exe2 = executable( | |
1723 | 'umount', | |
1724 | umount_sources, | |
1725 | include_directories : includes, | |
1726 | link_with : [lib_common, | |
1727 | lib_mount], | |
1cb3c90c | 1728 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1729 | install : opt, |
1730 | build_by_default : opt) | |
1731 | if opt and not is_disabler(exe) | |
1732 | exes += [exe, exe2] | |
53b37016 KZ |
1733 | manadocs += ['sys-utils/fstab.5.adoc', |
1734 | 'sys-utils/mount.8.adoc', | |
1735 | 'sys-utils/umount.8.adoc'] | |
38bb89ee | 1736 | bashcompletions += ['mount', 'umount'] |
d4c880d5 ZJS |
1737 | endif |
1738 | ||
69939195 ZJS |
1739 | opt2 = opt and 'mount' in static_programs |
1740 | exe = executable( | |
1741 | 'mount.static', | |
1742 | mount_sources, | |
1743 | include_directories : includes, | |
1744 | link_args : ['--static'], | |
1745 | link_with : [lib_common, | |
1746 | lib_smartcols_static, | |
1747 | lib_mount_static], | |
1748 | install : opt2, | |
1749 | build_by_default : opt2) | |
1750 | if opt2 and not is_disabler(exe) | |
1751 | exes += exe | |
1752 | endif | |
1753 | ||
1754 | opt2 = opt and 'umount' in static_programs | |
1755 | exe = executable( | |
1756 | 'umount.static', | |
1757 | umount_sources, | |
1758 | include_directories : includes, | |
1759 | link_args : ['--static'], | |
1760 | link_with : [lib_common, | |
1761 | lib_mount_static], | |
1762 | install : opt2, | |
1763 | build_by_default : opt2) | |
1764 | if opt2 and not is_disabler(exe) | |
1765 | exes += exe | |
1766 | endif | |
1767 | ||
d4c880d5 ZJS |
1768 | # setuid? |
1769 | ||
1770 | exe = executable( | |
1771 | 'swapon', | |
1772 | swapon_sources, | |
1773 | include_directories : includes, | |
1774 | link_with : [lib_common, | |
1775 | lib_blkid, | |
1776 | lib_mount, | |
1777 | lib_smartcols], | |
1778 | install_dir : sbindir, | |
1779 | install : true) | |
1780 | if not is_disabler(exe) | |
1781 | exes += exe | |
53b37016 | 1782 | manadocs += ['sys-utils/swapon.8.adoc'] |
38bb89ee | 1783 | bashcompletions += ['swapon'] |
d4c880d5 ZJS |
1784 | endif |
1785 | ||
1786 | exe = executable( | |
1787 | 'swapoff', | |
1788 | swapoff_sources, | |
1789 | include_directories : includes, | |
1790 | link_with : [lib_common, | |
1791 | lib_blkid, | |
1792 | lib_mount], | |
1793 | install_dir : sbindir, | |
1794 | install : true) | |
1795 | if not is_disabler(exe) | |
1796 | exes += exe | |
38bb89ee TW |
1797 | manlinks += {'swapoff.8': 'swapon.8'} |
1798 | bashcompletions += ['swapoff'] | |
d4c880d5 ZJS |
1799 | endif |
1800 | ||
1801 | exe = executable( | |
1802 | 'lscpu', | |
1803 | lscpu_sources, | |
1804 | include_directories : includes, | |
1805 | link_with : [lib_common, | |
1806 | lib_smartcols], | |
1807 | dependencies : [rtas_libs], | |
1808 | install_dir : usrbin_exec_dir, | |
1809 | install : true) | |
1810 | if not is_disabler(exe) | |
1811 | exes += exe | |
53b37016 | 1812 | manadocs += ['sys-utils/lscpu.1.adoc'] |
38bb89ee | 1813 | bashcompletions += ['lscpu'] |
d4c880d5 ZJS |
1814 | endif |
1815 | ||
1816 | exe = executable( | |
1817 | 'chcpu', | |
1818 | chcpu_sources, | |
1819 | include_directories : includes, | |
1820 | link_with : [lib_common], | |
1821 | install_dir : sbindir, | |
1822 | install : true) | |
1823 | exes += exe | |
53b37016 | 1824 | manadocs += ['sys-utils/chcpu.8.adoc'] |
38bb89ee | 1825 | bashcompletions += ['chcpu'] |
d4c880d5 ZJS |
1826 | |
1827 | exe = executable( | |
1828 | 'wdctl', | |
1829 | wdctl_sources, | |
1830 | include_directories : includes, | |
1831 | link_with : [lib_common, | |
1832 | lib_smartcols], | |
1833 | install : true) | |
1834 | if not is_disabler(exe) | |
1835 | exes += exe | |
53b37016 | 1836 | manadocs += ['sys-utils/wdctl.8.adoc'] |
38bb89ee | 1837 | bashcompletions += ['wdctl'] |
d4c880d5 ZJS |
1838 | endif |
1839 | ||
1840 | opt = not get_option('build-mountpoint').disabled() | |
1841 | exe = executable( | |
1842 | 'mountpoint', | |
1843 | mountpoint_sources, | |
1844 | include_directories : includes, | |
1845 | link_with : [lib_mount], | |
1846 | install : opt, | |
1847 | build_by_default : opt) | |
1848 | if opt and not is_disabler(exe) | |
1849 | exes += exe | |
53b37016 | 1850 | manadocs += ['sys-utils/mountpoint.1.adoc'] |
38bb89ee | 1851 | bashcompletions += ['mountpoint'] |
d4c880d5 ZJS |
1852 | endif |
1853 | ||
1854 | opt = not get_option('build-fallocate').disabled() | |
1855 | exe = executable( | |
1856 | 'fallocate', | |
1857 | fallocate_sources, | |
1858 | include_directories : includes, | |
1859 | link_with : [lib_common], | |
1860 | install_dir : usrbin_exec_dir, | |
1861 | install : opt, | |
1862 | build_by_default : opt) | |
1863 | if opt and not is_disabler(exe) | |
1864 | exes += exe | |
53b37016 | 1865 | manadocs += ['sys-utils/fallocate.1.adoc'] |
38bb89ee | 1866 | bashcompletions += ['fallocate'] |
d4c880d5 ZJS |
1867 | endif |
1868 | ||
1869 | opt = not get_option('build-pivot_root').disabled() | |
1870 | exe = executable( | |
1871 | 'pivot_root', | |
1872 | pivot_root_sources, | |
1873 | include_directories : includes, | |
1874 | install_dir : sbindir, | |
1875 | install : opt, | |
1876 | build_by_default : opt) | |
1877 | if opt and not is_disabler(exe) | |
1878 | exes += exe | |
53b37016 | 1879 | manadocs += ['sys-utils/pivot_root.8.adoc'] |
38bb89ee | 1880 | bashcompletions += ['pivot_root'] |
d4c880d5 ZJS |
1881 | endif |
1882 | ||
1883 | opt = not get_option('build-switch_root').disabled() | |
1884 | if opt and not have_dirfd and not have_ddfd | |
1885 | error('neither dirfd nor ddfd are available') | |
1886 | endif | |
1887 | exe = executable( | |
1888 | 'switch_root', | |
1889 | switch_root_sources, | |
1890 | include_directories : includes, | |
1891 | install_dir : sbindir, | |
1892 | install : opt, | |
1893 | build_by_default : opt) | |
1894 | if opt and not is_disabler(exe) | |
1895 | exes += exe | |
53b37016 | 1896 | manadocs += ['sys-utils/switch_root.8.adoc'] |
d4c880d5 ZJS |
1897 | endif |
1898 | ||
1899 | opt = not get_option('build-unshare').disabled() | |
1900 | exe = executable( | |
1901 | 'unshare', | |
1902 | unshare_sources, | |
1903 | include_directories : includes, | |
1904 | link_with : [lib_common], | |
1905 | install_dir : usrbin_exec_dir, | |
1906 | install : opt, | |
1907 | build_by_default : opt) | |
1908 | if opt and not is_disabler(exe) | |
1909 | exes += exe | |
53b37016 | 1910 | manadocs += ['sys-utils/unshare.1.adoc'] |
38bb89ee | 1911 | bashcompletions += ['unshare'] |
d4c880d5 ZJS |
1912 | endif |
1913 | ||
69939195 ZJS |
1914 | opt = opt and 'unshare' in static_programs |
1915 | exe = executable( | |
1916 | 'unshare.static', | |
1917 | unshare_sources, | |
1918 | include_directories : includes, | |
1919 | link_with : [lib_common], | |
1920 | install_dir : usrbin_exec_dir, | |
1921 | install : opt, | |
1922 | build_by_default : opt) | |
1923 | if opt and not is_disabler(exe) | |
1924 | exes += exe | |
1925 | endif | |
1926 | ||
d4c880d5 ZJS |
1927 | opt = not get_option('build-nsenter').disabled() |
1928 | exe = executable( | |
1929 | 'nsenter', | |
1930 | nsenter_sources, | |
1931 | include_directories : includes, | |
1932 | link_with : [lib_common], | |
1933 | dependencies : [lib_selinux], | |
1934 | install_dir : usrbin_exec_dir, | |
1935 | install : opt, | |
1936 | build_by_default : opt) | |
1937 | if opt and not is_disabler(exe) | |
1938 | exes += exe | |
53b37016 | 1939 | manadocs += ['sys-utils/nsenter.1.adoc'] |
38bb89ee | 1940 | bashcompletions += ['nsenter'] |
d4c880d5 ZJS |
1941 | endif |
1942 | ||
69939195 ZJS |
1943 | opt = opt and 'nsenter' in static_programs |
1944 | exe = executable( | |
1945 | 'nsenter.static', | |
1946 | nsenter_sources, | |
1947 | include_directories : includes, | |
1948 | link_with : [lib_common], | |
1949 | dependencies : [lib_selinux], | |
1950 | install_dir : usrbin_exec_dir, | |
1951 | install : opt, | |
1952 | build_by_default : opt) | |
1953 | if opt and not is_disabler(exe) | |
1954 | exes += exe | |
1955 | endif | |
1956 | ||
cd23a433 | 1957 | opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found() |
d4c880d5 ZJS |
1958 | exe = executable( |
1959 | 'setpriv', | |
1960 | setpriv_sources, | |
1961 | include_directories : includes, | |
1962 | link_with : [lib_common], | |
1963 | dependencies : [lib_cap_ng], | |
1964 | install_dir : usrbin_exec_dir, | |
1965 | install : opt, | |
1966 | build_by_default : opt) | |
1967 | if opt and not is_disabler(exe) | |
1968 | exes += exe | |
53b37016 | 1969 | manadocs += ['sys-utils/setpriv.1.adoc'] |
38bb89ee | 1970 | bashcompletions += ['setpriv'] |
d4c880d5 ZJS |
1971 | endif |
1972 | ||
1973 | exe = executable( | |
1974 | 'flock', | |
1975 | flock_sources, | |
1976 | include_directories : includes, | |
1977 | link_with : [lib_common], | |
1978 | dependencies : realtime_libs, | |
1979 | install_dir : usrbin_exec_dir, | |
1980 | install : true) | |
1981 | exes += exe | |
53b37016 | 1982 | manadocs += ['sys-utils/flock.1.adoc'] |
38bb89ee | 1983 | bashcompletions += ['flock'] |
d4c880d5 | 1984 | |
645577c7 KZ |
1985 | opt = not get_option('build-lsirq').disabled() |
1986 | exe = executable( | |
1987 | 'lsirq', | |
1988 | lsirq_sources, | |
1989 | include_directories : includes, | |
1990 | link_with : [lib_common, | |
1991 | lib_smartcols], | |
1992 | install_dir : usrbin_exec_dir, | |
1993 | install : opt, | |
1994 | build_by_default : opt) | |
1995 | if opt and not is_disabler(exe) | |
1996 | exes += exe | |
53b37016 | 1997 | manadocs += ['sys-utils/lsirq.1.adoc'] |
38bb89ee | 1998 | bashcompletions += ['lsirq'] |
645577c7 KZ |
1999 | endif |
2000 | ||
2001 | opt = not get_option('build-irqtop').disabled() | |
2002 | exe = executable( | |
2003 | 'irqtop', | |
2004 | irqtop_sources, | |
2005 | include_directories : includes, | |
2006 | dependencies : [realtime_libs, curses_libs], | |
2007 | link_with : [lib_common, | |
2008 | lib_smartcols, | |
2009 | lib_tcolors], | |
2010 | install_dir : usrbin_exec_dir, | |
2011 | install : opt, | |
2012 | build_by_default : opt) | |
2013 | if opt and not is_disabler(exe) | |
2014 | exes += exe | |
53b37016 | 2015 | manadocs += ['sys-utils/irqtop.1.adoc'] |
38bb89ee | 2016 | bashcompletions += ['irqtop'] |
645577c7 KZ |
2017 | endif |
2018 | ||
d4c880d5 ZJS |
2019 | opt = not get_option('build-ipcs').disabled() |
2020 | exe = executable( | |
2021 | 'lsipc', | |
2022 | lsipc_sources, | |
2023 | include_directories : includes, | |
2024 | link_with : [lib_common, | |
2025 | lib_smartcols], | |
2026 | install_dir : usrbin_exec_dir, | |
2027 | install : opt, | |
2028 | build_by_default : opt) | |
2029 | if opt and not is_disabler(exe) | |
2030 | exes += exe | |
53b37016 | 2031 | manadocs += ['sys-utils/lsipc.1.adoc'] |
38bb89ee | 2032 | bashcompletions += ['lsipc'] |
d4c880d5 ZJS |
2033 | endif |
2034 | ||
2035 | opt = build_hwclock | |
2036 | exe = executable( | |
2037 | 'hwclock', | |
2038 | hwclock_sources, | |
2039 | include_directories : includes, | |
2040 | link_with : [lib_common], | |
2041 | dependencies : [lib_m, | |
2042 | lib_audit], | |
2043 | install_dir : sbindir, | |
2044 | install : opt, | |
2045 | build_by_default : opt) | |
2046 | if opt and not is_disabler(exe) | |
2047 | exes += exe | |
38bb89ee TW |
2048 | manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc'] |
2049 | bashcompletions += ['hwclock'] | |
d4c880d5 ZJS |
2050 | endif |
2051 | ||
2052 | exe = executable( | |
2053 | 'mkfs', | |
2054 | mkfs_sources, | |
2055 | include_directories : includes, | |
2056 | install_dir : sbindir, | |
2057 | install : true) | |
2058 | exes += exe | |
53b37016 | 2059 | manadocs += ['disk-utils/mkfs.8.adoc'] |
38bb89ee | 2060 | bashcompletions += ['mkfs'] |
d4c880d5 ZJS |
2061 | |
2062 | opt = not get_option('build-bfs').disabled() | |
2063 | exe = executable( | |
2064 | 'mkfs.bfs', | |
2065 | mkfs_bfs_sources, | |
2066 | include_directories : includes, | |
2067 | link_with : [lib_common], | |
2068 | install_dir : sbindir, | |
2069 | install : opt, | |
2070 | build_by_default : opt) | |
2071 | if opt and not is_disabler(exe) | |
2072 | exes += exe | |
53b37016 | 2073 | manadocs += ['disk-utils/mkfs.bfs.8.adoc'] |
38bb89ee | 2074 | bashcompletions += ['mkfs.bfs'] |
d4c880d5 ZJS |
2075 | endif |
2076 | ||
2077 | exe = executable( | |
2078 | 'isosize', | |
2079 | isosize_sources, | |
2080 | include_directories : includes, | |
2081 | link_with : [lib_common], | |
2082 | install_dir : usrbin_exec_dir, | |
2083 | install : true) | |
2084 | exes += exe | |
53b37016 | 2085 | manadocs += ['disk-utils/isosize.8.adoc'] |
38bb89ee | 2086 | bashcompletions += ['isosize'] |
d4c880d5 ZJS |
2087 | |
2088 | exe = executable( | |
2089 | 'mkswap', | |
2090 | mkswap_sources, | |
2091 | include_directories : includes, | |
2092 | link_with : [lib_common, | |
2093 | lib_blkid, | |
2094 | lib_uuid], | |
2095 | dependencies: [lib_selinux], | |
2096 | install_dir : sbindir, | |
2097 | install : true) | |
2098 | if opt and not is_disabler(exe) | |
2099 | exes += exe | |
53b37016 | 2100 | manadocs += ['disk-utils/mkswap.8.adoc'] |
38bb89ee | 2101 | bashcompletions += ['mkswap'] |
d4c880d5 ZJS |
2102 | endif |
2103 | ||
2104 | exe = executable( | |
2105 | 'swaplabel', | |
2106 | swaplabel_sources, | |
2107 | include_directories : includes, | |
2108 | link_with : [lib_common, | |
2109 | lib_blkid, | |
2110 | lib_uuid], | |
2111 | install_dir : sbindir, | |
2112 | install : true) | |
2113 | if opt and not is_disabler(exe) | |
2114 | exes += exe | |
53b37016 | 2115 | manadocs += ['disk-utils/swaplabel.8.adoc'] |
38bb89ee | 2116 | bashcompletions += ['swaplabel'] |
d4c880d5 ZJS |
2117 | endif |
2118 | ||
2119 | opt = not get_option('build-fsck').disabled() | |
2120 | exe = executable( | |
2121 | 'fsck', | |
2122 | fsck_sources, | |
2123 | include_directories : includes, | |
2124 | link_with : [lib_common, | |
2125 | lib_blkid, | |
2126 | lib_mount], | |
2127 | dependencies : realtime_libs, | |
2128 | install_dir : sbindir, | |
2129 | install : opt, | |
2130 | build_by_default : opt) | |
2131 | if opt and not is_disabler(exe) | |
2132 | exes += exe | |
53b37016 | 2133 | manadocs += ['disk-utils/fsck.8.adoc'] |
38bb89ee | 2134 | bashcompletions += ['fsck'] |
d4c880d5 ZJS |
2135 | endif |
2136 | ||
2137 | opt = not get_option('build-minix').disabled() | |
2138 | exe = executable( | |
2139 | 'mkfs.minix', | |
2140 | mkfs_minix_sources, | |
2141 | include_directories : includes, | |
2142 | link_with : [lib_common], | |
2143 | install_dir : sbindir, | |
2144 | install : opt, | |
2145 | build_by_default : opt) | |
2146 | exe2 = executable( | |
2147 | 'test_mkfs_minix', | |
2148 | mkfs_minix_sources, | |
2149 | include_directories : includes, | |
2150 | c_args : '-DTEST_SCRIPT', | |
2151 | link_with : [lib_common], | |
ba30b89c | 2152 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
2153 | exe3 = executable( |
2154 | 'fsck.minix', | |
2155 | fsck_minix_sources, | |
2156 | include_directories : includes, | |
2157 | link_with : [lib_common], | |
2158 | install_dir : sbindir, | |
2159 | install : opt, | |
2160 | build_by_default : opt) | |
2161 | if opt and not is_disabler(exe) | |
2162 | exes += [exe, exe2, exe3] | |
53b37016 | 2163 | manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc'] |
38bb89ee | 2164 | bashcompletions += ['mkfs.minix', 'fsck.minix'] |
d4c880d5 ZJS |
2165 | endif |
2166 | ||
2167 | opt = not get_option('build-cramfs').disabled() | |
2168 | exe = executable( | |
2169 | 'mkfs.cramfs', | |
2170 | mkfs_cramfs_sources, | |
2171 | include_directories : includes, | |
2172 | link_with : [lib_common], | |
2173 | dependencies : [lib_z], | |
2174 | install_dir : sbindir, | |
2175 | install : opt, | |
2176 | build_by_default : opt) | |
2177 | exe2 = executable( | |
2178 | 'fsck.cramfs', | |
2179 | fsck_cramfs_sources, | |
2180 | include_directories : includes, | |
2181 | link_with : [lib_common], | |
2182 | dependencies : [lib_z], | |
2183 | install_dir : sbindir, | |
2184 | install : opt, | |
2185 | build_by_default : opt) | |
2186 | if not is_disabler(exe) | |
2187 | exes += [exe, exe2] | |
53b37016 | 2188 | manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc'] |
38bb89ee | 2189 | bashcompletions += ['mkfs.cramfs', 'fsck.cramfs'] |
d4c880d5 ZJS |
2190 | endif |
2191 | ||
2192 | opt = not get_option('build-raw').disabled() | |
dff176e2 | 2193 | if opt |
433e4b77 | 2194 | cc.has_header('linux/raw.h', required: opt) |
dff176e2 | 2195 | endif |
d4c880d5 ZJS |
2196 | exe = executable( |
2197 | 'raw', | |
2198 | raw_sources, | |
2199 | include_directories : includes, | |
2200 | install_dir : sbindir, | |
2201 | install : opt, | |
2202 | build_by_default : opt) | |
2203 | if opt and not is_disabler(exe) | |
2204 | exes += exe | |
53b37016 | 2205 | manadocs += ['disk-utils/raw.8.adoc'] |
38bb89ee | 2206 | bashcompletions += ['raw'] |
d4c880d5 ZJS |
2207 | endif |
2208 | ||
2209 | opt = not get_option('build-fdformat').disabled() | |
2210 | exe = executable( | |
2211 | 'fdformat', | |
2212 | fdformat_sources, | |
2213 | include_directories : includes, | |
2214 | link_with : [lib_common], | |
2215 | install_dir : usrsbin_exec_dir, | |
2216 | install : opt, | |
2217 | build_by_default : opt) | |
2218 | if opt and not is_disabler(exe) | |
2219 | exes += exe | |
53b37016 | 2220 | manadocs += ['disk-utils/fdformat.8.adoc'] |
d4c880d5 ZJS |
2221 | endif |
2222 | ||
2223 | exe = executable( | |
2224 | 'blockdev', | |
2225 | blockdev_sources, | |
2226 | include_directories : includes, | |
2227 | link_with : [lib_common], | |
2228 | install_dir : sbindir, | |
2229 | install : true) | |
53b37016 | 2230 | manadocs += ['disk-utils/blockdev.8.adoc'] |
38bb89ee | 2231 | bashcompletions += ['blockdev'] |
d4c880d5 ZJS |
2232 | |
2233 | opt = not get_option('build-fdisks').disabled() | |
2234 | if opt and not have_dirfd and not have_ddfd | |
2235 | error('neither dirfd nor ddfd are available') | |
2236 | endif | |
2237 | exe = executable( | |
2238 | 'fdisk', | |
2239 | fdisk_sources, | |
2240 | include_directories : includes, | |
2241 | link_with : [lib_common, | |
2242 | lib_fdisk, | |
2243 | lib_smartcols, | |
2244 | lib_tcolors], | |
2245 | dependencies : [lib_readline], | |
2246 | install_dir : sbindir, | |
2247 | install : opt, | |
2248 | build_by_default : opt) | |
2249 | if opt and not is_disabler(exe) | |
2250 | exes += exe | |
38bb89ee | 2251 | bashcompletions += ['fdisk'] |
d4c880d5 ZJS |
2252 | endif |
2253 | ||
69939195 ZJS |
2254 | opt2 = opt and 'fdisk' in static_programs |
2255 | exe = executable( | |
2256 | 'fdisk.static', | |
2257 | fdisk_sources, | |
2258 | link_args : ['--static'], | |
2259 | include_directories : includes, | |
2260 | link_with : [lib_common, | |
2261 | lib_tcolors, | |
2262 | lib_fdisk_static, | |
2263 | lib_smartcols.get_static_lib()], | |
2264 | dependencies : [lib_readline_static], | |
2265 | install_dir : sbindir, | |
2266 | install : opt2, | |
2267 | build_by_default : opt2) | |
2268 | if opt2 and not is_disabler(exe) | |
2269 | exes += exe | |
2270 | endif | |
d4c880d5 ZJS |
2271 | |
2272 | exe = executable( | |
2273 | 'sfdisk', | |
2274 | sfdisk_sources, | |
2275 | include_directories : includes, | |
2276 | link_with : [lib_common, | |
2277 | lib_fdisk, | |
2278 | lib_smartcols, | |
2279 | lib_tcolors], | |
2280 | dependencies : [lib_readline], | |
2281 | install_dir : sbindir, | |
2282 | install : opt, | |
2283 | build_by_default : opt) | |
2284 | if opt and not is_disabler(exe) | |
2285 | exes += exe | |
38bb89ee | 2286 | bashcompletions += ['sfdisk'] |
d4c880d5 ZJS |
2287 | endif |
2288 | ||
69939195 ZJS |
2289 | opt2 = opt and 'sfdisk' in static_programs |
2290 | exe = executable( | |
2291 | 'sfdisk.static', | |
2292 | sfdisk_sources, | |
2293 | include_directories : includes, | |
2294 | link_with : [lib_common, | |
2295 | lib_tcolors, | |
2296 | lib_fdisk_static, | |
2297 | lib_smartcols.get_static_lib()], | |
2298 | dependencies : [lib_readline_static], | |
2299 | install_dir : sbindir, | |
2300 | install : opt2, | |
2301 | build_by_default : opt2) | |
2302 | if opt2 and not is_disabler(exe) | |
2303 | exes += exe | |
2304 | endif | |
d4c880d5 ZJS |
2305 | |
2306 | exe = executable( | |
2307 | 'cfdisk', | |
2308 | cfdisk_sources, | |
2309 | include_directories : includes, | |
2310 | link_with : [lib_common, | |
2311 | lib_fdisk, | |
2312 | lib_smartcols, | |
2313 | lib_tcolors, | |
2314 | lib_mount], | |
2315 | dependencies : [curses_libs], | |
2316 | install_dir : sbindir, | |
2317 | install : opt, | |
2318 | build_by_default : opt) | |
2319 | if opt and not is_disabler(exe) | |
2320 | exes += exe | |
53b37016 KZ |
2321 | manadocs += ['disk-utils/fdisk.8.adoc', |
2322 | 'disk-utils/sfdisk.8.adoc', | |
2323 | 'disk-utils/cfdisk.8.adoc'] | |
38bb89ee | 2324 | bashcompletions += ['cfdisk'] |
d4c880d5 ZJS |
2325 | endif |
2326 | ||
2327 | opt = not get_option('build-partx').disabled() | |
2328 | exe = executable( | |
2329 | 'addpart', | |
2330 | addpart_sources, | |
2331 | include_directories : includes, | |
2332 | link_with : [lib_common], | |
2333 | install_dir : usrsbin_exec_dir, | |
2334 | install : opt, | |
2335 | build_by_default : opt) | |
2336 | exe2 = executable( | |
2337 | 'delpart', | |
2338 | delpart_sources, | |
2339 | include_directories : includes, | |
2340 | link_with : [lib_common], | |
2341 | install_dir : usrsbin_exec_dir, | |
2342 | install : opt, | |
2343 | build_by_default : opt) | |
2344 | exe3 = executable( | |
2345 | 'resizepart', | |
2346 | resizepart_sources, | |
2347 | include_directories : includes, | |
2348 | link_with : [lib_common], | |
2349 | install_dir : usrsbin_exec_dir, | |
2350 | install : opt, | |
2351 | build_by_default : opt) | |
2352 | exe4 = executable( | |
2353 | 'partx', | |
2354 | partx_sources, | |
2355 | include_directories : includes, | |
2356 | link_with : [lib_common, | |
2357 | lib_blkid, | |
2358 | lib_smartcols], | |
2359 | install_dir : usrsbin_exec_dir, | |
2360 | install : opt, | |
2361 | build_by_default : opt) | |
2362 | if opt | |
2363 | exes += [exe, exe2, exe3, exe4] | |
53b37016 KZ |
2364 | manadocs += ['disk-utils/addpart.8.adoc', |
2365 | 'disk-utils/delpart.8.adoc', | |
2366 | 'disk-utils/resizepart.8.adoc', | |
2367 | 'disk-utils/partx.8.adoc'] | |
38bb89ee | 2368 | bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx'] |
d4c880d5 ZJS |
2369 | endif |
2370 | ||
2371 | ############################################################ | |
2372 | ||
2373 | exe = executable( | |
2374 | 'script', | |
2375 | script_sources, | |
2376 | include_directories : includes, | |
2377 | link_with : [lib_common], | |
2378 | dependencies : [lib_util, | |
2379 | lib_utempter, | |
2380 | realtime_libs, | |
2381 | math_libs], | |
2382 | install_dir : usrbin_exec_dir, | |
2383 | install : true) | |
2384 | exes += exe | |
53b37016 | 2385 | manadocs += ['term-utils/script.1.adoc'] |
38bb89ee | 2386 | bashcompletions += ['script'] |
d4c880d5 ZJS |
2387 | |
2388 | exe = executable( | |
2389 | 'test_script', | |
2390 | script_sources, | |
2391 | include_directories : includes, | |
2392 | c_args : '-DTEST_SCRIPT', | |
2393 | link_with : [lib_common], | |
2394 | dependencies : [lib_util, | |
2395 | lib_utempter, | |
2396 | realtime_libs, | |
ba30b89c | 2397 | math_libs], |
2398 | build_by_default : program_tests) | |
d4c880d5 ZJS |
2399 | exes += exe |
2400 | ||
2401 | exe = executable( | |
2402 | 'scriptlive', | |
2403 | scriptlive_sources, | |
2404 | include_directories : includes, | |
2405 | link_with : [lib_common], | |
2406 | dependencies : [lib_util, | |
2407 | realtime_libs, | |
2408 | math_libs], | |
2409 | install_dir : usrbin_exec_dir, | |
2410 | install : true) | |
2411 | exes += exe | |
53b37016 | 2412 | manadocs += ['term-utils/scriptlive.1.adoc'] |
38bb89ee | 2413 | bashcompletions += ['scriptlive'] |
d4c880d5 ZJS |
2414 | |
2415 | exe = executable( | |
2416 | 'scriptreplay', | |
2417 | scriptreplay_sources, | |
2418 | include_directories : includes, | |
2419 | link_with : [lib_common], | |
2420 | dependencies : [math_libs], | |
2421 | install_dir : usrbin_exec_dir, | |
2422 | install : true) | |
2423 | exes += exe | |
53b37016 | 2424 | manadocs += ['term-utils/scriptreplay.1.adoc'] |
38bb89ee | 2425 | bashcompletions += ['scriptreplay'] |
d4c880d5 ZJS |
2426 | |
2427 | opt = not get_option('build-agetty').disabled() | |
2428 | exe = executable( | |
2429 | 'agetty', | |
2430 | agetty_sources, | |
2431 | include_directories : includes, | |
0333c40b | 2432 | link_with : [lib_common, logindefs_c], |
87fcd95a | 2433 | dependencies : [BSD ? lib_util : [], lib_systemd], |
d4c880d5 ZJS |
2434 | install_dir : sbindir, |
2435 | install : opt, | |
2436 | build_by_default : opt) | |
2437 | if opt | |
2438 | exes += exe | |
53b37016 | 2439 | manadocs += ['term-utils/agetty.8.adoc'] |
d4c880d5 ZJS |
2440 | endif |
2441 | ||
2442 | opt = not get_option('build-setterm').disabled() | |
2443 | exe = executable( | |
2444 | 'setterm', | |
2445 | setterm_sources, | |
2446 | include_directories : includes, | |
2447 | link_with : [lib_common], | |
2448 | dependencies : [curses_libs], | |
2449 | install_dir : usrbin_exec_dir, | |
2450 | install : opt, | |
2451 | build_by_default : opt) | |
2452 | if opt | |
2453 | exes += exe | |
53b37016 | 2454 | manadocs += ['term-utils/setterm.1.adoc'] |
38bb89ee | 2455 | bashcompletions += ['setterm'] |
d4c880d5 ZJS |
2456 | endif |
2457 | ||
2458 | opt = not get_option('build-mesg').disabled() | |
2459 | exe = executable( | |
2460 | 'mesg', | |
2461 | mesg_sources, | |
2462 | include_directories : includes, | |
2463 | link_with : [lib_common], | |
2464 | install_dir : usrbin_exec_dir, | |
2465 | install : opt, | |
2466 | build_by_default : opt) | |
2467 | if opt | |
2468 | exes += exe | |
53b37016 | 2469 | manadocs += ['term-utils/mesg.1.adoc'] |
38bb89ee | 2470 | bashcompletions += ['mesg'] |
d4c880d5 ZJS |
2471 | endif |
2472 | ||
2473 | opt = not get_option('build-wall').disabled() | |
2474 | exe = executable( | |
2475 | 'wall', | |
2476 | wall_sources, | |
2477 | include_directories : includes, | |
2478 | link_with : [lib_common], | |
87fcd95a | 2479 | dependencies : [lib_systemd], |
d4c880d5 | 2480 | install_dir : usrbin_exec_dir, |
5f3359c5 | 2481 | install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], |
d4c880d5 ZJS |
2482 | install : opt, |
2483 | build_by_default : opt) | |
2484 | if opt | |
2485 | exes += exe | |
53b37016 | 2486 | manadocs += ['term-utils/wall.1.adoc'] |
38bb89ee | 2487 | bashcompletions += ['wall'] |
d4c880d5 ZJS |
2488 | endif |
2489 | ||
2490 | # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall | |
2491 | # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall | |
2492 | ||
2493 | opt = not get_option('build-write').disabled() | |
2494 | exe = executable( | |
2495 | 'write', | |
2496 | write_sources, | |
2497 | include_directories : includes, | |
2498 | link_with : [lib_common], | |
87fcd95a | 2499 | dependencies : [lib_systemd], |
d4c880d5 | 2500 | install_dir : usrbin_exec_dir, |
00f115d8 | 2501 | install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], |
d4c880d5 ZJS |
2502 | install : opt, |
2503 | build_by_default : opt) | |
2504 | if opt | |
2505 | exes += exe | |
53b37016 | 2506 | manadocs += ['term-utils/write.1.adoc'] |
e1cd4002 | 2507 | bashcompletions += ['write'] |
d4c880d5 ZJS |
2508 | endif |
2509 | ||
2510 | # chgrp tty $(DESTDIR)$(usrbin_execdir)/write | |
2511 | # chmod g+s $(DESTDIR)$(usrbin_execdir)/write | |
2512 | ||
2513 | opt = not get_option('build-login').disabled() | |
2514 | exe = executable( | |
2515 | 'login', | |
2516 | login_sources, | |
2517 | include_directories : includes, | |
0333c40b | 2518 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
2519 | dependencies : [lib_pam, |
2520 | lib_audit, | |
2521 | lib_selinux], | |
2522 | install : opt, | |
2523 | build_by_default : opt) | |
2524 | if not is_disabler(exe) | |
2525 | exes += exe | |
53b37016 | 2526 | manadocs += ['login-utils/login.1.adoc'] |
d4c880d5 ZJS |
2527 | endif |
2528 | ||
2529 | opt = not get_option('build-sulogin').disabled() | |
2530 | exe = executable( | |
2531 | 'sulogin', | |
2532 | sulogin_sources, | |
2533 | include_directories : includes, | |
2534 | link_with : [lib_common], | |
2535 | dependencies : [lib_crypt, | |
2536 | lib_selinux], | |
2537 | install_dir : sbindir, | |
2538 | install : opt, | |
2539 | build_by_default : opt) | |
2540 | if not is_disabler(exe) | |
2541 | exes += exe | |
53b37016 | 2542 | manadocs += ['login-utils/sulogin.8.adoc'] |
d4c880d5 ZJS |
2543 | endif |
2544 | ||
2545 | exe = executable( | |
2546 | 'cal', | |
2547 | cal_sources, | |
2548 | include_directories : includes, | |
2549 | link_with : [lib_common, | |
2550 | lib_tcolors], | |
2551 | dependencies : [curses_libs], | |
2552 | install_dir : usrbin_exec_dir, | |
2553 | install : true) | |
2554 | exes += exe | |
53b37016 | 2555 | manadocs += ['misc-utils/cal.1.adoc'] |
38bb89ee | 2556 | bashcompletions += ['cal'] |
d4c880d5 ZJS |
2557 | |
2558 | opt = not get_option('build-logger').disabled() | |
2559 | exe = executable( | |
2560 | 'logger', | |
2561 | logger_sources, | |
2562 | include_directories : includes, | |
dbb9999f | 2563 | link_with : [lib_common], |
d4c880d5 ZJS |
2564 | dependencies : [lib_systemd], |
2565 | install_dir : usrbin_exec_dir, | |
2566 | install : opt, | |
2567 | build_by_default : opt) | |
2568 | if opt and not is_disabler(exe) | |
2569 | exes += exe | |
53b37016 | 2570 | manadocs += ['misc-utils/logger.1.adoc'] |
38bb89ee | 2571 | bashcompletions += ['logger'] |
d4c880d5 ZJS |
2572 | endif |
2573 | ||
2574 | exe = executable( | |
2575 | 'test_logger', | |
2576 | logger_sources, | |
2577 | include_directories : includes, | |
2578 | c_args : '-DTEST_LOGGER', | |
dbb9999f | 2579 | link_with : [lib_common], |
ba30b89c | 2580 | dependencies : [lib_systemd], |
2581 | build_by_default: program_tests) | |
d4c880d5 ZJS |
2582 | if not is_disabler(exe) |
2583 | exes += exe | |
2584 | endif | |
2585 | ||
2586 | exe = executable( | |
2587 | 'look', | |
2588 | look_sources, | |
2589 | include_directories : includes, | |
2590 | install_dir : usrbin_exec_dir, | |
2591 | install : true) | |
2592 | exes += exe | |
53b37016 | 2593 | manadocs += ['misc-utils/look.1.adoc'] |
38bb89ee | 2594 | bashcompletions += ['look'] |
d4c880d5 ZJS |
2595 | |
2596 | exe = executable( | |
2597 | 'mcookie', | |
2598 | mcookie_sources, | |
2599 | include_directories : includes, | |
2600 | link_with : [lib_common], | |
2601 | install_dir : usrbin_exec_dir, | |
2602 | install : true) | |
2603 | exes += exe | |
53b37016 | 2604 | manadocs += ['misc-utils/mcookie.1.adoc'] |
38bb89ee | 2605 | bashcompletions += ['mcookie'] |
d4c880d5 | 2606 | |
c2e299d0 SS |
2607 | if build_liblastlog2 |
2608 | exe = executable( | |
2609 | 'lastlog2', | |
2610 | lastlog2_sources, | |
2611 | include_directories : includes, | |
2612 | link_with : [lib_common, lib_lastlog2], | |
2613 | install_dir : usrbin_exec_dir, | |
2614 | install : true) | |
2615 | exes += exe | |
2616 | manadocs += ['misc-utils/lastlog2.8.adoc'] | |
2617 | bashcompletions += ['lastlog2'] | |
2618 | manadocs += ['liblastlog2/man/lastlog2.3.adoc', | |
2619 | 'liblastlog2/man/ll2_write_entry.3.adoc', | |
2620 | 'liblastlog2/man/ll2_read_entry.3.adoc', | |
2621 | 'liblastlog2/man/ll2_import_lastlog.3.adoc', | |
2622 | 'liblastlog2/man/ll2_read_all.3.adoc', | |
2623 | 'liblastlog2/man/ll2_remove_entry.3.adoc', | |
2624 | 'liblastlog2/man/ll2_rename_user.3.adoc', | |
2625 | 'liblastlog2/man/ll2_update_login_time.3.adoc' | |
2626 | ] | |
2627 | endif | |
2628 | ||
d4c880d5 ZJS |
2629 | exe = executable( |
2630 | 'namei', | |
2631 | namei_sources, | |
2632 | include_directories : includes, | |
c07f7b4e | 2633 | dependencies : [lib_selinux], |
d4c880d5 ZJS |
2634 | install_dir : usrbin_exec_dir, |
2635 | install : true) | |
2636 | exes += exe | |
53b37016 | 2637 | manadocs += ['misc-utils/namei.1.adoc'] |
38bb89ee | 2638 | bashcompletions += ['namei'] |
d4c880d5 ZJS |
2639 | |
2640 | exe = executable( | |
2641 | 'whereis', | |
2642 | whereis_sources, | |
2643 | include_directories : includes, | |
2644 | link_with : [lib_common], | |
2645 | install_dir : usrbin_exec_dir, | |
2646 | install : true) | |
2647 | exes += exe | |
53b37016 | 2648 | manadocs += ['misc-utils/whereis.1.adoc'] |
38bb89ee | 2649 | bashcompletions += ['whereis'] |
d4c880d5 ZJS |
2650 | |
2651 | exe = executable( | |
2652 | 'lslocks', | |
2653 | lslocks_sources, | |
2654 | include_directories : includes, | |
2655 | link_with : [lib_common, | |
2656 | lib_mount, | |
2657 | lib_smartcols], | |
2658 | install_dir : usrbin_exec_dir, | |
2659 | install : true) | |
2660 | if not is_disabler(exe) | |
2661 | exes += exe | |
53b37016 | 2662 | manadocs += ['misc-utils/lslocks.8.adoc'] |
38bb89ee | 2663 | bashcompletions += ['lslocks'] |
d4c880d5 ZJS |
2664 | endif |
2665 | ||
2666 | exe = executable( | |
2667 | 'lsblk', | |
2668 | lsblk_sources, | |
2669 | include_directories : includes, | |
2670 | link_with : [lib_common, | |
2671 | lib_blkid, | |
2672 | lib_mount, | |
c3317cdc | 2673 | lib_tcolors, |
d4c880d5 ZJS |
2674 | lib_smartcols], |
2675 | dependencies : lib_udev, | |
2676 | install : true) | |
2677 | if not is_disabler(exe) | |
2678 | exes += exe | |
53b37016 | 2679 | manadocs += ['misc-utils/lsblk.8.adoc'] |
38bb89ee | 2680 | bashcompletions += ['lsblk'] |
d4c880d5 ZJS |
2681 | endif |
2682 | ||
e3dedb01 MY |
2683 | mq_libs = [] |
2684 | mq_libs += cc.find_library('rt', required : true) | |
2685 | ||
ee194909 KZ |
2686 | exe = executable( |
2687 | 'lsfd', | |
2688 | lsfd_sources, | |
2689 | include_directories : includes, | |
2690 | link_with : [lib_common, | |
2691 | lib_smartcols], | |
e3dedb01 | 2692 | dependencies : mq_libs, |
ee194909 KZ |
2693 | install_dir : usrbin_exec_dir, |
2694 | install : true) | |
2695 | if not is_disabler(exe) | |
2696 | exes += exe | |
2697 | manadocs += ['misc-utils/lsfd.1.adoc'] | |
2698 | endif | |
2699 | ||
d4c880d5 ZJS |
2700 | exe = executable( |
2701 | 'uuidgen', | |
2702 | uuidgen_sources, | |
2703 | include_directories : includes, | |
06d3a851 KZ |
2704 | link_with : [lib_common, |
2705 | lib_uuid], | |
d4c880d5 ZJS |
2706 | install_dir : usrbin_exec_dir, |
2707 | install : true) | |
2708 | if not is_disabler(exe) | |
2709 | exes += exe | |
53b37016 | 2710 | manadocs += ['misc-utils/uuidgen.1.adoc'] |
38bb89ee | 2711 | bashcompletions += ['uuidgen'] |
d4c880d5 ZJS |
2712 | endif |
2713 | ||
2714 | exe = executable( | |
2715 | 'uuidparse', | |
2716 | uuidparse_sources, | |
2717 | include_directories : includes, | |
2718 | link_with : [lib_common, | |
2719 | lib_uuid, | |
2720 | lib_smartcols], | |
2721 | install_dir : usrbin_exec_dir, | |
2722 | install : true) | |
2723 | if not is_disabler(exe) | |
2724 | exes += exe | |
53b37016 | 2725 | manadocs += ['misc-utils/uuidparse.1.adoc'] |
38bb89ee | 2726 | bashcompletions += ['uuidparse'] |
d4c880d5 ZJS |
2727 | endif |
2728 | ||
2729 | opt = build_uuidd | |
2730 | exe = executable( | |
2731 | 'uuidd', | |
2732 | uuidd_sources, | |
2733 | include_directories : includes, | |
2734 | link_with : [lib_common, | |
2735 | lib_uuid], | |
2736 | dependencies : [realtime_libs, | |
2737 | lib_systemd], | |
2738 | install_dir : usrsbin_exec_dir, | |
2739 | install : opt, | |
2740 | build_by_default : opt) | |
2741 | exe2 = executable( | |
2742 | 'test_uuidd', | |
2743 | test_uuidd_sources, | |
2744 | include_directories : includes, | |
2745 | link_with : [lib_common, | |
2746 | lib_uuid], | |
2747 | dependencies : thread_libs, | |
ba30b89c | 2748 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
2749 | if not is_disabler(exe) |
2750 | exes += [exe, exe2] | |
53b37016 | 2751 | manadocs += ['misc-utils/uuidd.8.adoc'] |
38bb89ee | 2752 | bashcompletions += ['uuidd'] |
d4c880d5 ZJS |
2753 | endif |
2754 | ||
2755 | opt = build_libblkid | |
2756 | exe = executable( | |
2757 | 'blkid', | |
2758 | blkid_sources, | |
2759 | include_directories : includes, | |
2760 | link_with : [lib_common, | |
2761 | lib_blkid], | |
2762 | install_dir : sbindir, | |
2763 | install : opt, | |
2764 | build_by_default : opt) | |
2765 | if opt and not is_disabler(exe) | |
2766 | exes += exe | |
53b37016 | 2767 | manadocs += ['misc-utils/blkid.8.adoc'] |
38bb89ee | 2768 | bashcompletions += ['blkid'] |
d4c880d5 ZJS |
2769 | endif |
2770 | ||
69939195 ZJS |
2771 | opt = opt and 'blkid' in static_programs |
2772 | exe = executable( | |
2773 | 'blkid.static', | |
2774 | blkid_sources, | |
2775 | include_directories : includes, | |
2776 | link_with : [lib_common, | |
2777 | lib_blkid_static], | |
2778 | install_dir : sbindir, | |
2779 | install : opt, | |
2780 | build_by_default : opt) | |
2781 | if opt and not is_disabler(exe) | |
2782 | exes += exe | |
2783 | endif | |
d4c880d5 ZJS |
2784 | |
2785 | exe = executable( | |
2786 | 'sample-mkfs', | |
2787 | 'libblkid/samples/mkfs.c', | |
2788 | include_directories : includes, | |
2789 | link_with : lib_blkid) | |
2790 | if not is_disabler(exe) | |
2791 | exes += exe | |
2792 | endif | |
2793 | ||
2794 | exe = executable( | |
2795 | 'sample-partitions', | |
2796 | 'libblkid/samples/partitions.c', | |
2797 | include_directories : includes, | |
2798 | link_with : lib_blkid) | |
2799 | if not is_disabler(exe) | |
2800 | exes += exe | |
2801 | endif | |
2802 | ||
2803 | exe = executable( | |
2804 | 'sample-superblocks', | |
2805 | 'libblkid/samples/superblocks.c', | |
2806 | include_directories : includes, | |
2807 | link_with : lib_blkid) | |
2808 | if not is_disabler(exe) | |
2809 | exes += exe | |
2810 | endif | |
2811 | ||
2812 | exe = executable( | |
2813 | 'sample-topology', | |
2814 | 'libblkid/samples/topology.c', | |
2815 | include_directories : includes, | |
2816 | link_with : lib_blkid) | |
2817 | if not is_disabler(exe) | |
2818 | exes += exe | |
2819 | endif | |
2820 | ||
97e673a0 TW |
2821 | exe = executable( |
2822 | 'test_blkid_fuzz_sample', | |
2823 | 'libblkid/src/fuzz.c', | |
2824 | include_directories: includes, | |
ba30b89c | 2825 | link_with: lib_blkid, |
2826 | build_by_default: program_tests) | |
97e673a0 TW |
2827 | if not is_disabler(exe) |
2828 | exes += exe | |
2829 | endif | |
2830 | ||
d4c880d5 ZJS |
2831 | ############################################################ |
2832 | ||
2833 | exe = executable( | |
2834 | 'findfs', | |
2835 | findfs_sources, | |
2836 | include_directories : includes, | |
2837 | link_with : [lib_blkid], | |
2838 | install_dir : sbindir, | |
2839 | install : true) | |
2840 | if not is_disabler(exe) | |
2841 | exes += exe | |
53b37016 | 2842 | manadocs += ['misc-utils/findfs.8.adoc'] |
38bb89ee | 2843 | bashcompletions += ['findfs'] |
d4c880d5 ZJS |
2844 | endif |
2845 | ||
2846 | exe = executable( | |
2847 | 'wipefs', | |
2848 | wipefs_sources, | |
2849 | include_directories : includes, | |
2850 | link_with : [lib_common, | |
2851 | lib_blkid, | |
2852 | lib_smartcols], | |
2853 | install_dir : sbindir, | |
2854 | install : true) | |
2855 | if not is_disabler(exe) | |
2856 | exes += exe | |
53b37016 | 2857 | manadocs += ['misc-utils/wipefs.8.adoc'] |
38bb89ee | 2858 | bashcompletions += ['wipefs'] |
d4c880d5 ZJS |
2859 | endif |
2860 | ||
2861 | exe = executable( | |
2862 | 'findmnt', | |
2863 | findmnt_sources, | |
2864 | include_directories : includes, | |
2865 | link_with : [lib_common, | |
2866 | lib_blkid, | |
2867 | lib_mount, | |
2868 | lib_smartcols], | |
2869 | dependencies : [lib_udev], | |
2870 | install : true) | |
2871 | if not is_disabler(exe) | |
2872 | exes += exe | |
53b37016 | 2873 | manadocs += ['misc-utils/findmnt.8.adoc'] |
38bb89ee | 2874 | bashcompletions += ['findmnt'] |
d4c880d5 ZJS |
2875 | endif |
2876 | ||
2877 | exe = executable( | |
2878 | 'kill', | |
2879 | kill_sources, | |
2880 | include_directories : includes, | |
2881 | link_with : [lib_common], | |
2882 | install : true) | |
2883 | if not is_disabler(exe) | |
2884 | exes += exe | |
53b37016 | 2885 | manadocs += ['misc-utils/kill.1.adoc'] |
d4c880d5 ZJS |
2886 | endif |
2887 | ||
2888 | opt = not get_option('build-rename').disabled() | |
2889 | exe = executable( | |
2890 | 'rename', | |
2891 | rename_sources, | |
2892 | include_directories : includes, | |
2893 | install_dir : usrbin_exec_dir, | |
2894 | install : opt, | |
2895 | build_by_default : opt) | |
2896 | if opt and not is_disabler(exe) | |
2897 | exes += exe | |
53b37016 | 2898 | manadocs += ['misc-utils/rename.1.adoc'] |
38bb89ee | 2899 | bashcompletions += ['rename'] |
d4c880d5 ZJS |
2900 | endif |
2901 | ||
2902 | exe = executable( | |
2903 | 'getopt', | |
2904 | getopt_sources, | |
2905 | include_directories : includes, | |
308a0979 | 2906 | link_with : [lib_common], |
d4c880d5 ZJS |
2907 | install_dir : usrbin_exec_dir, |
2908 | install : true) | |
2909 | exes += exe | |
53b37016 | 2910 | manadocs += ['misc-utils/getopt.1.adoc'] |
38bb89ee | 2911 | bashcompletions += ['getopt'] |
d4c880d5 ZJS |
2912 | |
2913 | exe = executable( | |
2914 | 'fincore', | |
2915 | fincore_sources, | |
2916 | include_directories : includes, | |
2917 | link_with : [lib_common, | |
2918 | lib_smartcols], | |
2919 | install_dir : usrbin_exec_dir, | |
2920 | install : true) | |
2921 | if not is_disabler(exe) | |
2922 | exes += exe | |
53b37016 | 2923 | manadocs += ['misc-utils/fincore.1.adoc'] |
38bb89ee | 2924 | bashcompletions += ['fincore'] |
d4c880d5 ZJS |
2925 | endif |
2926 | ||
2927 | exe = executable( | |
2928 | 'hardlink', | |
2929 | hardlink_sources, | |
2930 | include_directories : includes, | |
2931 | link_with : [lib_common], | |
d4c880d5 ZJS |
2932 | install_dir : usrbin_exec_dir, |
2933 | install : true) | |
2934 | if not is_disabler(exe) | |
2935 | exes += exe | |
53b37016 | 2936 | manadocs += ['misc-utils/hardlink.1.adoc'] |
38bb89ee | 2937 | bashcompletions += ['hardlink'] |
d4c880d5 ZJS |
2938 | endif |
2939 | ||
c221578e NS |
2940 | opt = not get_option('build-pipesz').disabled() |
2941 | exe = executable( | |
2942 | 'pipesz', | |
2943 | pipesz_sources, | |
2944 | include_directories : includes, | |
2945 | link_with : [lib_common], | |
2946 | install_dir : usrbin_exec_dir, | |
2947 | install : true) | |
2948 | if opt and not is_disabler(exe) | |
2949 | exes += exe | |
62c27bd0 | 2950 | manadocs += ['misc-utils/pipesz.1.adoc'] |
80af57ed | 2951 | bashcompletions += ['pipesz'] |
c221578e NS |
2952 | endif |
2953 | ||
d4c880d5 ZJS |
2954 | exe = executable( |
2955 | 'test_cal', | |
2956 | cal_sources, | |
2957 | include_directories : includes, | |
2958 | c_args : '-DTEST_CAL', | |
2959 | link_with : [lib_common, | |
2960 | lib_tcolors], | |
ba30b89c | 2961 | dependencies : [curses_libs], |
2962 | build_by_default: program_tests) | |
d4c880d5 ZJS |
2963 | if not is_disabler(exe) |
2964 | exes += exe | |
2965 | endif | |
2966 | ||
64bc8ab5 MY |
2967 | exe = executable( |
2968 | 'fadvise', | |
2969 | fadvise_sources, | |
2970 | include_directories : includes, | |
2971 | link_with : [lib_common], | |
2972 | install_dir : usrbin_exec_dir, | |
2973 | install : true) | |
2974 | if not is_disabler(exe) | |
2975 | exes += exe | |
2976 | manadocs += ['misc-utils/fadvise.1.adoc'] | |
2977 | bashcompletions += ['fadvise'] | |
2978 | endif | |
2979 | ||
941e1d55 | 2980 | if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1' |
334939a1 ZJS |
2981 | exe = executable( |
2982 | 'waitpid', | |
2983 | waitpid_sources, | |
2984 | include_directories : includes, | |
2985 | link_with : [lib_common], | |
2986 | install_dir : usrbin_exec_dir, | |
2987 | install : true) | |
2988 | if not is_disabler(exe) | |
2989 | exes += exe | |
2990 | manadocs += ['misc-utils/waitpid.1.adoc'] | |
2991 | bashcompletions += ['waitpid'] | |
2992 | endif | |
550d32c4 TW |
2993 | endif |
2994 | ||
69e542bd TW |
2995 | syscalls_h = custom_target('syscalls.h', |
2996 | input : 'tools/all_syscalls', | |
2997 | output : 'syscalls.h', | |
922d025a | 2998 | command : ['tools/all_syscalls', cc.cmd_array()] |
69e542bd TW |
2999 | ) |
3000 | ||
3e0bbb12 TW |
3001 | if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE') |
3002 | exe = executable( | |
3003 | 'enosys', | |
3004 | 'misc-utils/enosys.c', syscalls_h, | |
3005 | include_directories : includes, | |
3006 | link_with : [lib_common], | |
3007 | install_dir : usrbin_exec_dir, | |
3008 | install : true) | |
3009 | if not is_disabler(exe) | |
3010 | exes += exe | |
3011 | manadocs += ['misc-utils/enosys.1.adoc'] | |
3012 | bashcompletions += ['enosys'] | |
3013 | endif | |
cba52cc1 TW |
3014 | endif |
3015 | ||
e9ddea79 TW |
3016 | exe = executable( |
3017 | 'lsclocks', | |
3018 | lsclocks_sources, | |
3019 | include_directories : includes, | |
3020 | link_with : [lib_common, lib_smartcols], | |
3021 | install_dir : usrbin_exec_dir, | |
3022 | install : true) | |
3023 | if not is_disabler(exe) | |
3024 | exes += exe | |
3025 | manadocs += ['misc-utils/lsclocks.1.adoc'] | |
3026 | bashcompletions += ['lsclocks'] | |
3027 | endif | |
3028 | ||
cd094a05 MY |
3029 | if conf.get('HAVE_RENAMEAT2').to_string() == '1' |
3030 | exe = executable( | |
3031 | 'exch', | |
3032 | exch_sources, | |
3033 | include_directories : includes, | |
3034 | link_with : [lib_common], | |
3035 | install_dir : usrbin_exec_dir, | |
3036 | install : true) | |
3037 | if not is_disabler(exe) | |
3038 | exes += exe | |
3039 | manadocs += ['misc-utils/exch.1.adoc'] | |
3040 | bashcompletions += ['exch'] | |
3041 | endif | |
3042 | endif | |
3043 | ||
d4c880d5 ZJS |
3044 | ############################################################ |
3045 | ||
3046 | opt = not get_option('build-schedutils').disabled() | |
3047 | exe = executable( | |
3048 | 'chrt', | |
3049 | 'schedutils/chrt.c', | |
3050 | include_directories : includes, | |
3051 | link_with : lib_common, | |
3052 | install_dir : usrbin_exec_dir, | |
3053 | install : opt, | |
3054 | build_by_default : opt) | |
3055 | ||
3056 | exe2 = executable( | |
3057 | 'ionice', | |
3058 | 'schedutils/ionice.c', | |
3059 | include_directories : includes, | |
3060 | link_with : lib_common, | |
3061 | install_dir : usrbin_exec_dir, | |
3062 | install : opt, | |
3063 | build_by_default : opt) | |
3064 | ||
3065 | exe3 = executable( | |
3066 | 'taskset', | |
3067 | 'schedutils/taskset.c', | |
3068 | include_directories : includes, | |
3069 | link_with : lib_common, | |
3070 | install_dir : usrbin_exec_dir, | |
3071 | install : opt, | |
3072 | build_by_default : opt) | |
3073 | ||
6e92db54 KZ |
3074 | exe4 = executable( |
3075 | 'uclampset', | |
3076 | 'schedutils/uclampset.c', | |
3077 | include_directories : includes, | |
3078 | link_with : lib_common, | |
3079 | install_dir : usrbin_exec_dir, | |
3080 | install : opt, | |
3081 | build_by_default : opt) | |
3082 | ||
d4c880d5 | 3083 | if opt and not is_disabler(exe) |
6e92db54 | 3084 | exes += [exe, exe2, exe3, exe4] |
53b37016 KZ |
3085 | manadocs += ['schedutils/chrt.1.adoc', |
3086 | 'schedutils/ionice.1.adoc', | |
3087 | 'schedutils/taskset.1.adoc', | |
3088 | 'schedutils/uclampset.1.adoc'] | |
38bb89ee | 3089 | bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset'] |
d4c880d5 ZJS |
3090 | endif |
3091 | ||
3092 | ############################################################ | |
3093 | ||
3094 | # TODO: when autotools compat is not needed, s/_/-/g in file names? | |
3095 | ||
3096 | exe = executable( | |
3097 | 'test_ttyutils', | |
3098 | 'lib/ttyutils.c', | |
3099 | c_args : ['-DTEST_PROGRAM_TTYUTILS'], | |
3100 | include_directories : dir_include, | |
ba30b89c | 3101 | link_with : lib_common, |
3102 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3103 | exes += exe |
3104 | ||
3105 | exe = executable( | |
3106 | 'test_blkdev', | |
3107 | 'lib/blkdev.c', | |
3108 | c_args : ['-DTEST_PROGRAM_BLKDEV'], | |
3109 | include_directories : dir_include, | |
ba30b89c | 3110 | link_with : lib_common, |
3111 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3112 | exes += exe |
3113 | ||
3114 | exe = executable( | |
3115 | 'test_ismounted', | |
3116 | 'lib/ismounted.c', | |
3117 | c_args : ['-DTEST_PROGRAM_ISMOUNTED'], | |
3118 | include_directories : dir_include, | |
ba30b89c | 3119 | link_with : lib_common, |
3120 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3121 | exes += exe |
3122 | ||
3123 | exe = executable( | |
3124 | 'test_mangle', | |
3125 | 'lib/mangle.c', | |
3126 | c_args : ['-DTEST_PROGRAM_MANGLE'], | |
ba30b89c | 3127 | include_directories : dir_include, |
3128 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3129 | exes += exe |
3130 | ||
3131 | exe = executable( | |
3132 | 'test_strutils', | |
3133 | 'lib/strutils.c', | |
3134 | c_args : ['-DTEST_PROGRAM_STRUTILS'], | |
ba30b89c | 3135 | include_directories : dir_include, |
3136 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3137 | exes += exe |
3138 | ||
3139 | exe = executable( | |
3140 | 'test_colors', | |
3141 | 'lib/colors.c', | |
3142 | 'lib/color-names.c', | |
3143 | c_args : ['-DTEST_PROGRAM_COLORS'], | |
3144 | include_directories : dir_include, | |
ba30b89c | 3145 | link_with : [lib_common, lib_tcolors], |
3146 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3147 | exes += exe |
3148 | ||
3149 | exe = executable( | |
3150 | 'test_randutils', | |
3151 | 'lib/randutils.c', | |
3152 | c_args : ['-DTEST_PROGRAM_RANDUTILS'], | |
ba30b89c | 3153 | include_directories : dir_include, |
3154 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3155 | exes += exe |
3156 | ||
941e1d55 TW |
3157 | if conf.get('HAVE_OPENAT').to_string() == '1' \ |
3158 | and conf.get('HAVE_DIRFD').to_string() == '1' | |
d6418774 ZJS |
3159 | exe = executable( |
3160 | 'test_procfs', | |
3161 | 'lib/procfs.c', | |
3162 | c_args : ['-DTEST_PROGRAM_PROCFS'], | |
3163 | include_directories : dir_include, | |
ba30b89c | 3164 | link_with : lib_common, |
3165 | build_by_default: program_tests) | |
d6418774 | 3166 | exes += exe |
d4c880d5 | 3167 | |
d6418774 ZJS |
3168 | exe = executable( |
3169 | 'test_path', | |
3170 | 'lib/path.c', | |
3171 | 'lib/fileutils.c', | |
3172 | have_cpu_set_t ? 'lib/cpuset.c' : [], | |
3173 | c_args : ['-DTEST_PROGRAM_PATH'], | |
3174 | include_directories : dir_include, | |
ba30b89c | 3175 | link_with : lib_common, |
3176 | build_by_default: program_tests) | |
d6418774 ZJS |
3177 | exes += exe |
3178 | endif | |
d4c880d5 | 3179 | |
941e1d55 | 3180 | if conf.get('HAVE_PTY').to_string() == '1' |
44475360 ZJS |
3181 | exe = executable( |
3182 | 'test_pty', | |
3183 | pty_session_c, | |
3184 | monotonic_c, | |
3185 | c_args : ['-DTEST_PROGRAM_PTY'], | |
3186 | include_directories : dir_include, | |
3187 | link_with : [lib_common], | |
3188 | dependencies : [lib_m, | |
3189 | realtime_libs, | |
ba30b89c | 3190 | lib_util], |
3191 | build_by_default: program_tests) | |
44475360 ZJS |
3192 | exes += exe |
3193 | endif | |
d4c880d5 | 3194 | |
d6418774 ZJS |
3195 | if LINUX |
3196 | exe = executable( | |
3197 | 'test_cpuset', | |
3198 | 'lib/cpuset.c', | |
3199 | c_args : ['-DTEST_PROGRAM_CPUSET'], | |
ba30b89c | 3200 | include_directories : dir_include, |
3201 | build_by_default: program_tests) | |
d6418774 ZJS |
3202 | exes += exe |
3203 | endif | |
d4c880d5 ZJS |
3204 | |
3205 | exe = executable( | |
3206 | 'test_sysfs', | |
3207 | 'lib/sysfs.c', | |
3208 | 'lib/path.c', | |
35d26ae8 | 3209 | 'lib/buffer.c', |
fb8493fd | 3210 | 'lib/mbsalign.c', |
d4c880d5 ZJS |
3211 | 'lib/fileutils.c', |
3212 | have_cpu_set_t ? 'lib/cpuset.c' : [], | |
3213 | c_args : ['-DTEST_PROGRAM_SYSFS'], | |
ba30b89c | 3214 | include_directories : dir_include, |
3215 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3216 | exes += exe |
3217 | ||
3218 | exe = executable( | |
3219 | 'test_pager', | |
3220 | 'lib/pager.c', | |
3221 | c_args : ['-DTEST_PROGRAM_PAGER'], | |
ba30b89c | 3222 | include_directories : dir_include, |
3223 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3224 | exes += exe |
3225 | ||
3226 | exe = executable( | |
3227 | 'test_linux_version', | |
3228 | 'lib/linux_version.c', | |
3229 | c_args : ['-DTEST_PROGRAM_LINUXVERSION'], | |
ba30b89c | 3230 | include_directories : dir_include, |
3231 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3232 | exes += exe |
3233 | ||
3234 | exe = executable( | |
3235 | 'test_fileutils', | |
3236 | 'lib/fileutils.c', | |
3237 | c_args : ['-DTEST_PROGRAM_FILEUTILS'], | |
ba30b89c | 3238 | include_directories : dir_include, |
3239 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3240 | exes += exe |
3241 | ||
3242 | exe = executable( | |
3243 | 'test_canonicalize', | |
3244 | 'lib/canonicalize.c', | |
3245 | c_args : ['-DTEST_PROGRAM_CANONICALIZE'], | |
ba30b89c | 3246 | include_directories : dir_include, |
3247 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3248 | exes += exe |
3249 | ||
3250 | exe = executable( | |
3251 | 'test_timeutils', | |
3252 | 'lib/timeutils.c', | |
3253 | 'lib/strutils.c', | |
3254 | c_args : ['-DTEST_PROGRAM_TIMEUTILS'], | |
ba30b89c | 3255 | include_directories : dir_include, |
3256 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3257 | exes += exe |
3258 | ||
3259 | exe = executable( | |
3260 | 'test_pwdutils', | |
3261 | 'lib/pwdutils.c', | |
3262 | c_args : ['-DTEST_PROGRAM'], | |
3263 | include_directories : dir_include, | |
ba30b89c | 3264 | link_with : lib_common, |
3265 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3266 | exes += exe |
3267 | ||
866d922b KZ |
3268 | exe = executable( |
3269 | 'test_logindefs', | |
3270 | 'lib/logindefs.c', | |
3271 | c_args : ['-DTEST_PROGRAM'], | |
3272 | include_directories : dir_include, | |
ba30b89c | 3273 | link_with : [lib_common, logindefs_c], |
3274 | build_by_default: program_tests) | |
866d922b KZ |
3275 | exes += exe |
3276 | ||
3277 | ||
d4c880d5 ZJS |
3278 | ############################################################ |
3279 | ||
3280 | exe = executable( | |
3281 | 'test_uuid_parser', | |
3282 | 'libuuid/src/test_uuid.c', | |
3283 | include_directories : [dir_include, dir_libuuid], | |
3284 | link_with : lib_uuid, | |
ba30b89c | 3285 | dependencies : socket_libs, |
3286 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3287 | if not is_disabler(exe) |
3288 | exes += exe | |
3289 | endif | |
3290 | ||
3291 | ############################################################ | |
3292 | ||
2a472ae8 | 3293 | libfdisk_tests_cflags = ['-DTEST_PROGRAM'] |
69939195 | 3294 | libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid] |
d4c880d5 ZJS |
3295 | |
3296 | exe = executable( | |
3297 | 'test_fdisk_ask', | |
3298 | 'libfdisk/src/ask.c', | |
3299 | c_args : libfdisk_tests_cflags, | |
3300 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3301 | link_with : libfdisk_tests_ldadd, |
3302 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3303 | if not is_disabler(exe) |
3304 | exes += exe | |
3305 | endif | |
3306 | ||
3307 | exe = executable( | |
3308 | 'test_fdisk_gpt', | |
3309 | 'libfdisk/src/gpt.c', | |
3310 | c_args : libfdisk_tests_cflags, | |
3311 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3312 | link_with : libfdisk_tests_ldadd, |
3313 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3314 | if not is_disabler(exe) |
3315 | exes += exe | |
3316 | endif | |
3317 | ||
3318 | exe = executable( | |
3319 | 'test_fdisk_utils', | |
3320 | 'libfdisk/src/utils.c', | |
3321 | c_args : libfdisk_tests_cflags, | |
3322 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3323 | link_with : libfdisk_tests_ldadd, |
3324 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3325 | if not is_disabler(exe) |
3326 | exes += exe | |
3327 | endif | |
3328 | ||
3329 | exe = executable( | |
3330 | 'test_fdisk_script', | |
3331 | 'libfdisk/src/script.c', | |
3332 | c_args : libfdisk_tests_cflags, | |
3333 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3334 | link_with : libfdisk_tests_ldadd, |
3335 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3336 | if not is_disabler(exe) |
3337 | exes += exe | |
3338 | endif | |
3339 | ||
3340 | exe = executable( | |
3341 | 'test_fdisk_version', | |
3342 | 'libfdisk/src/version.c', | |
3343 | c_args : libfdisk_tests_cflags, | |
3344 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3345 | link_with : libfdisk_tests_ldadd, |
3346 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3347 | if not is_disabler(exe) |
3348 | exes += exe | |
3349 | endif | |
3350 | ||
3351 | exe = executable( | |
3352 | 'test_fdisk_item', | |
3353 | 'libfdisk/src/item.c', | |
3354 | c_args : libfdisk_tests_cflags, | |
3355 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3356 | link_with : libfdisk_tests_ldadd, |
3357 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3358 | if not is_disabler(exe) |
3359 | exes += exe | |
3360 | endif | |
3361 | ||
d4c880d5 ZJS |
3362 | sample_fdisk_ldadd = [lib_common, lib_fdisk] |
3363 | ||
3364 | exe = executable( | |
3365 | 'sample-fdisk-mkpart', | |
3366 | 'libfdisk/samples/mkpart.c', | |
d4c880d5 ZJS |
3367 | include_directories : lib_fdisk_includes, |
3368 | link_with : sample_fdisk_ldadd) | |
3369 | if not is_disabler(exe) | |
3370 | exes += exe | |
3371 | endif | |
3372 | ||
3373 | exe = executable( | |
3374 | 'sample-fdisk-mkpart-fullspec', | |
3375 | 'libfdisk/samples/mkpart-fullspec.c', | |
d4c880d5 ZJS |
3376 | include_directories : lib_fdisk_includes, |
3377 | link_with : sample_fdisk_ldadd) | |
3378 | if not is_disabler(exe) | |
3379 | exes += exe | |
3380 | endif | |
3381 | ||
3382 | ############################################################ | |
3383 | ||
a76299c1 TW |
3384 | exe = executable( |
3385 | 'test_cap', | |
3386 | 'tests/helpers/test_cap.c', | |
3387 | include_directories : includes, | |
3388 | dependencies : [lib_cap_ng], | |
3389 | build_by_default: program_tests) | |
512c91a6 TW |
3390 | if not is_disabler(exe) |
3391 | exes += exe | |
3392 | endif | |
a76299c1 | 3393 | |
d4c880d5 ZJS |
3394 | exe = executable( |
3395 | 'test_mbsencode', | |
3396 | 'tests/helpers/test_mbsencode.c', | |
3397 | include_directories : includes, | |
ba30b89c | 3398 | link_with : lib_common, |
3399 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3400 | exes += exe |
3401 | ||
3402 | exe = executable( | |
3403 | 'test_byteswap', | |
3404 | 'tests/helpers/test_byteswap.c', | |
ba30b89c | 3405 | include_directories : includes, |
3406 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3407 | exes += exe |
3408 | ||
3409 | exe = executable( | |
3410 | 'test_md5', | |
3411 | 'tests/helpers/test_md5.c', | |
3412 | md5_c, | |
ba30b89c | 3413 | include_directories : includes, |
3414 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3415 | exes += exe |
3416 | ||
3417 | exe = executable( | |
3418 | 'test_sha1', | |
3419 | 'tests/helpers/test_sha1.c', | |
3420 | sha1_c, | |
ba30b89c | 3421 | include_directories : includes, |
3422 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3423 | exes += exe |
3424 | ||
3425 | exe = executable( | |
3426 | 'test_pathnames', | |
3427 | 'tests/helpers/test_pathnames.c', | |
ba30b89c | 3428 | include_directories : includes, |
3429 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3430 | exes += exe |
3431 | ||
3432 | exe = executable( | |
3433 | 'test_strerror', | |
3434 | 'tests/helpers/test_strerror.c', | |
ba30b89c | 3435 | include_directories : includes, |
3436 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3437 | exes += exe |
3438 | ||
3439 | exe = executable( | |
3440 | 'test_sysinfo', | |
3441 | 'tests/helpers/test_sysinfo.c', | |
ba30b89c | 3442 | include_directories : includes, |
3443 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3444 | exes += exe |
3445 | ||
3446 | exe = executable( | |
3447 | 'test_sigreceive', | |
3448 | 'tests/helpers/test_sigreceive.c', | |
3449 | include_directories : includes, | |
ba30b89c | 3450 | link_with : lib_common, |
3451 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3452 | exes += exe |
3453 | ||
3454 | exe = executable( | |
3455 | 'test_tiocsti', | |
3456 | 'tests/helpers/test_tiocsti.c', | |
ba30b89c | 3457 | include_directories : includes, |
3458 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3459 | exes += exe |
3460 | ||
3461 | exe = executable( | |
3462 | 'test_uuid_namespace', | |
3463 | 'tests/helpers/test_uuid_namespace.c', | |
3464 | predefined_c, | |
3465 | unpack_c, | |
3466 | unparse_c, | |
ba30b89c | 3467 | include_directories : includes, |
3468 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3469 | exes += exe |
3470 | ||
d6418774 ZJS |
3471 | if LINUX |
3472 | exe = executable( | |
3473 | 'test_mkfds', | |
3474 | 'tests/helpers/test_mkfds.c', | |
b2033a32 | 3475 | 'tests/helpers/test_mkfds.h', |
38ffd1e3 | 3476 | 'tests/helpers/test_mkfds_ppoll.c', |
d6418774 | 3477 | include_directories : includes, |
ba30b89c | 3478 | dependencies : mq_libs, |
3479 | build_by_default: program_tests) | |
d6418774 ZJS |
3480 | exes += exe |
3481 | endif | |
f7b41ef8 | 3482 | |
42900563 TW |
3483 | exe = executable( |
3484 | 'test_enosys', | |
3485 | 'tests/helpers/test_enosys.c', | |
ba30b89c | 3486 | include_directories : includes, |
3487 | build_by_default: program_tests) | |
42900563 TW |
3488 | exes += exe |
3489 | ||
d4c880d5 ZJS |
3490 | ############################################################ |
3491 | ||
941e1d55 | 3492 | if conf.get('HAVE_OPENAT').to_string() == '1' |
d6418774 ZJS |
3493 | exe = executable( |
3494 | 'sample-scols-tree', | |
3495 | 'libsmartcols/samples/tree.c', | |
3496 | include_directories : includes, | |
ba30b89c | 3497 | link_with : [lib_smartcols, lib_common], |
3498 | build_by_default: program_tests) | |
d6418774 ZJS |
3499 | if not is_disabler(exe) |
3500 | exes += exe | |
3501 | endif | |
d4c880d5 ZJS |
3502 | endif |
3503 | ||
3504 | exe = executable( | |
3505 | 'sample-scols-title', | |
3506 | 'libsmartcols/samples/title.c', | |
3507 | include_directories : includes, | |
3508 | link_with : [lib_smartcols, lib_common]) | |
3509 | if not is_disabler(exe) | |
3510 | exes += exe | |
3511 | endif | |
3512 | ||
3513 | exe = executable( | |
3514 | 'sample-scols-wrap', | |
3515 | 'libsmartcols/samples/wrap.c', | |
3516 | include_directories : includes, | |
3517 | link_with : [lib_smartcols, lib_common]) | |
3518 | if not is_disabler(exe) | |
3519 | exes += exe | |
3520 | endif | |
3521 | ||
3522 | exe = executable( | |
3523 | 'sample-scols-continuous', | |
3524 | 'libsmartcols/samples/continuous.c', | |
3525 | include_directories : includes, | |
3526 | link_with : [lib_smartcols, lib_common]) | |
3527 | if not is_disabler(exe) | |
3528 | exes += exe | |
3529 | endif | |
3530 | ||
be597292 TW |
3531 | exe = executable( |
3532 | 'sample-scols-continuous-json', | |
3533 | 'libsmartcols/samples/continuous-json.c', | |
3534 | include_directories : includes, | |
3535 | link_with : [lib_smartcols, lib_common]) | |
3536 | if not is_disabler(exe) | |
3537 | exes += exe | |
3538 | endif | |
3539 | ||
d4c880d5 ZJS |
3540 | exe = executable( |
3541 | 'sample-scols-maxout', | |
3542 | 'libsmartcols/samples/maxout.c', | |
3543 | include_directories : includes, | |
3544 | link_with : [lib_smartcols, lib_common]) | |
3545 | if not is_disabler(exe) | |
3546 | exes += exe | |
3547 | endif | |
3548 | ||
3549 | exe = executable( | |
3550 | 'sample-scols-fromfile', | |
3551 | 'libsmartcols/samples/fromfile.c', | |
3552 | include_directories : includes, | |
3553 | link_with : [lib_smartcols, lib_common]) | |
3554 | if not is_disabler(exe) | |
3555 | exes += exe | |
3556 | endif | |
3557 | ||
3558 | exe = executable( | |
3559 | 'sample-scols-grouping-simple', | |
3560 | 'libsmartcols/samples/grouping-simple.c', | |
3561 | include_directories : includes, | |
3562 | link_with : [lib_smartcols, lib_common]) | |
3563 | if not is_disabler(exe) | |
3564 | exes += exe | |
3565 | endif | |
3566 | ||
3567 | exe = executable( | |
3568 | 'sample-scols-grouping-overlay', | |
3569 | 'libsmartcols/samples/grouping-overlay.c', | |
3570 | include_directories : includes, | |
3571 | link_with : [lib_smartcols, lib_common]) | |
3572 | if not is_disabler(exe) | |
3573 | exes += exe | |
3574 | endif | |
48afece8 TW |
3575 | |
3576 | exe = executable( | |
3577 | 'test_boilerplate', | |
3578 | 'Documentation/boilerplate.c', | |
3579 | include_directories : includes, | |
3580 | build_by_default: program_tests) | |
3581 | if not is_disabler(exe) | |
3582 | exes += exe | |
3583 | endif | |
d4c880d5 ZJS |
3584 | |
3585 | ############################################################ | |
3586 | ||
3587 | # Let the test runner know whether we're running under asan and export | |
3588 | # some paths. We use a file on disk so that it is possible to run the | |
3589 | # test scripts from commandline without setting any variables. | |
3590 | configure_file(output : 'meson.conf', | |
3591 | capture : true, | |
3592 | command : ['echo', | |
3593 | '''asan=@0@ | |
3594 | PYTHON=@1@ | |
3595 | '''.format(get_option('b_sanitize')=='address' ? 'yes' : '', | |
e2cd7446 | 3596 | python.full_path())]) |
d4c880d5 ZJS |
3597 | |
3598 | run_sh = find_program('tests/run.sh') | |
3599 | run_target( | |
3600 | 'check', | |
3601 | command : [run_sh, | |
3602 | '--srcdir=' + meson.current_source_dir(), | |
3603 | '--builddir=' + meson.current_build_dir(), | |
3604 | '--parallel', | |
3605 | '--nonroot'], | |
3606 | depends : exes) | |
53b37016 KZ |
3607 | |
3608 | ||
3609 | manadocs += ['lib/terminal-colors.d.5.adoc'] | |
3610 | manadocs += ['libblkid/libblkid.3.adoc'] | |
3611 | ||
3612 | if build_libuuid | |
3613 | manadocs += [ | |
3614 | 'libuuid/man/uuid.3.adoc', | |
3615 | 'libuuid/man/uuid_clear.3.adoc', | |
3616 | 'libuuid/man/uuid_compare.3.adoc', | |
3617 | 'libuuid/man/uuid_copy.3.adoc', | |
3618 | 'libuuid/man/uuid_generate.3.adoc', | |
3619 | 'libuuid/man/uuid_is_null.3.adoc', | |
3620 | 'libuuid/man/uuid_parse.3.adoc', | |
3621 | 'libuuid/man/uuid_time.3.adoc', | |
3622 | 'libuuid/man/uuid_unparse.3.adoc'] | |
38bb89ee TW |
3623 | manlinks += { |
3624 | 'uuid_generate_random.3': 'uuid_generate.3', | |
3625 | 'uuid_generate_time.3': 'uuid_generate.3', | |
3626 | 'uuid_generate_time_safe.3': 'uuid_generate.3', | |
3627 | } | |
53b37016 KZ |
3628 | endif |
3629 | ||
00b8a51f | 3630 | asciidoctor = find_program('asciidoctor', required : false) |
53b37016 KZ |
3631 | if asciidoctor.found() |
3632 | foreach adoc : manadocs | |
3633 | name = adoc.split('/')[-1] | |
3634 | page = name.split('.adoc')[0] | |
3635 | section = page.split('.')[-1] | |
3636 | mandirn = join_paths(mandir, 'man' + section) | |
3637 | input = adoc | |
3638 | ||
3639 | custom_target( | |
3640 | page, | |
3641 | command : [ asciidoctor, | |
3642 | '-b', 'manpage', | |
3643 | '-a', 'VERSION=' + meson.project_version(), | |
38bb89ee | 3644 | '-a', 'release-version=' + meson.project_version(), |
53b37016 | 3645 | '-a', 'ADJTIME_PATH=/etc/adjtime', |
38bb89ee | 3646 | '-a', 'package-docdir=' + docdir, |
53b37016 KZ |
3647 | '--base-dir=' + meson.current_source_dir(), |
3648 | '--destination-dir=' + meson.current_build_dir(), | |
adcab835 TW |
3649 | '--load-path', '@SOURCE_ROOT@/tools', |
3650 | '--require', 'asciidoctor-includetracker', | |
53b37016 KZ |
3651 | '@INPUT@'], |
3652 | input : input, | |
3653 | output : [page], | |
adcab835 | 3654 | depfile : page + '.deps', |
53b37016 KZ |
3655 | install: true, |
3656 | install_dir : mandirn) | |
3657 | endforeach | |
38bb89ee TW |
3658 | |
3659 | foreach link_name, target : manlinks | |
3660 | link_section = link_name.split('.')[-1] | |
3661 | target_section = target.split('.')[-1] | |
3662 | meson.add_install_script(meson_make_manpage_stub, | |
3663 | join_paths('man' + target_section, target), | |
3664 | join_paths(mandir, 'man' + link_section, link_name)) | |
3665 | endforeach | |
3666 | endif | |
3667 | ||
3668 | if bash_completion.found() | |
3669 | foreach completion : bashcompletions | |
3670 | install_data( | |
3671 | join_paths('bash-completion', completion), | |
caa85688 | 3672 | install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir') |
38bb89ee TW |
3673 | ) |
3674 | endforeach | |
aa519054 KZ |
3675 | foreach link_name, target : bashcompletionslinks |
3676 | meson.add_install_script(meson_make_symlink, | |
3677 | target, | |
caa85688 | 3678 | join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name)) |
aa519054 | 3679 | endforeach |
53b37016 | 3680 | endif |