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