]> git.ipfire.org Git - thirdparty/util-linux.git/blob - meson.build
Merge branch 'meson-fix-crypt-dep' of https://github.com/jwillikers/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', 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 realtime_libs = []
737 have = cc.has_function('clock_gettime')
738 if not have
739 realtime_libs += cc.find_library('rt', required : true)
740 have = cc.has_function('clock_gettime',
741 dependencies : realtime_libs)
742 endif
743 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
744
745 thread_libs = dependency('threads')
746
747 have = cc.has_function('timer_create')
748 if not have
749 realtime_libs = [cc.find_library('rt', required : true)]
750 have = cc.has_function('timer_create',
751 dependencies : realtime_libs)
752 if not have
753 realtime_libs += thread_libs
754 have = cc.has_function('timer_create',
755 dependencies : realtime_libs)
756 endif
757 endif
758 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
759 if not have
760 have = cc.has_function('setitimer')
761 conf.set('HAVE_SETITIMER', have ? 1 : false)
762 endif
763
764 rtas_libs = cc.find_library('rtas', required : false)
765 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
766
767 math_libs = []
768 if not cc.has_header_symbol('math.h', 'isnan')
769 lib = cc.find_library('m', required : true)
770 if (cc.has_function('isnan', dependencies : lib) and
771 cc.has_function('__isnan', dependencies : lib))
772 math_libs += lib
773 endif
774 endif
775
776 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
777 args : '-D_GNU_SOURCE')
778 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
779
780 code = '''
781 extern char *__progname;
782 int main(void) {
783 return (*__progname != 0);
784 }
785 '''
786 have = cc.compiles(code, name : 'using __progname')
787 conf.set('HAVE___PROGNAME', have ? 1 : false)
788
789 have = conf.get('HAVE_PTY_H').to_string() == '1' \
790 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
791 conf.set('HAVE_PTY', have ? 1 : false)
792
793 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
794 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
795
796 build_plymouth_support = get_option('build-plymouth-support')
797 have_tiocglcktrmios = cc.has_header_symbol(
798 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
799 required : build_plymouth_support.enabled())
800 have_sock_cloexec = cc.has_header_symbol(
801 'sys/socket.h', 'SOCK_CLOEXEC',
802 prefix : '#include <sys/types.h>',
803 required : build_plymouth_support.enabled())
804 have_sock_nonblock = cc.has_header_symbol(
805 'sys/socket.h', 'SOCK_NONBLOCK',
806 prefix : '#include <sys/types.h>',
807 required : build_plymouth_support.enabled())
808 have_so_passcred = cc.has_header_symbol(
809 'sys/socket.h', 'SO_PASSCRED',
810 args : ['-D_GNU_SOURCE'],
811 prefix : '#include <sys/types.h>',
812 required : build_plymouth_support.enabled())
813
814 build_plymouth_support = (not build_plymouth_support.disabled() and
815 have_tiocglcktrmios and
816 have_sock_cloexec and
817 have_sock_nonblock and
818 have_so_passcred)
819 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
820 summary('plymouth support',
821 build_plymouth_support ? 'enabled' : 'disabled',
822 section : 'components')
823
824 # check for valid fallocate() function
825 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
826 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
827 # and program can't be linked.
828 code = '''
829 #define _GNU_SOURCE
830 #include <unistd.h>
831 #include <fcntl.h>
832
833 int main(void) {
834 long ret;
835 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
836 return ret == 0 ? 0 : 1;
837 }
838 '''
839 have = cc.links(code, name : 'fallocate() function')
840 conf.set('HAVE_FALLOCATE', have ? 1 : false)
841
842 code = '''
843 #include <unistd.h>
844 #include <fcntl.h>
845
846 int main(void) {
847 long ret;
848 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
849 return ret == 0 ? 0 : 1;
850 }
851 '''
852 have = cc.links(code, name : 'posix_fallocate() function')
853 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
854
855 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
856 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
857 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
858
859 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
860 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
861 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
862
863 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
864
865 ############################################################
866
867
868 fs_search_path = get_option('fs-search-path')
869 fs_search_path_extra = get_option('fs-search-path-extra')
870 if fs_search_path_extra != ''
871 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
872 endif
873 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
874
875 systemdsystemunitdir = ''
876 if systemd.found()
877 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
878 endif
879
880 sysvinit = get_option('sysvinit').enabled()
881 sysvinitrcdir = sysconfdir + '/init.d'
882
883 program_tests = get_option('program-tests')
884
885 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
886 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
887
888 have = get_option('chsh-only-listed')
889 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
890
891 have = get_option('use-tty-group')
892 conf.set('USE_TTY_GROUP', have ? 1 : false)
893
894 bison = find_program('bison')
895 flex = find_program('flex')
896
897 build_hwclock = not get_option('build-hwclock').disabled()
898 bison_gen = generator(
899 bison,
900 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
901 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
902
903 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
904 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
905
906 configure_file(
907 output : 'config.h',
908 configuration : conf)
909
910 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
911
912 compiler_flags = [
913 '-fno-common',
914
915 '-Waddress-of-packed-member',
916 '-Wdiscarded-qualifiers',
917 '-Wembedded-directive',
918 '-Wextra-semi',
919 '-Wformat-security',
920 '-Wimplicit-function-declaration',
921 '-Wmissing-declarations',
922 '-Wmissing-parameter-type',
923 '-Wmissing-prototypes',
924 '-Wnested-externs',
925 '-Wno-missing-field-initializers',
926 '-Wold-style-definition',
927 '-Wpointer-arith',
928 '-Wredundant-decls',
929 '-Wsign-compare',
930 '-Wstrict-prototypes',
931 '-Wtype-limits',
932 '-Wuninitialized',
933 '-Wunused-but-set-parameter',
934 '-Wunused-but-set-variable',
935 '-Wunused-parameter',
936 '-Wunused-result',
937 '-Wunused-variable',
938 '-Wvla',
939 '-Walloca',
940 ]
941 foreach compiler_flag : compiler_flags
942 if cc.has_argument(compiler_flag)
943 add_project_arguments(compiler_flag, language : 'c')
944 endif
945 endforeach
946
947 manadocs = []
948 manlinks = {}
949
950 bashcompletions = []
951 bashcompletionslinks = {}
952
953 subdir('include')
954 subdir('lib')
955 subdir('libblkid')
956 subdir('libmount')
957 subdir('libsmartcols')
958 subdir('libuuid')
959 subdir('liblastlog2')
960 subdir('libfdisk')
961 subdir('pam_lastlog2')
962 subdir('login-utils')
963 subdir('sys-utils')
964 subdir('disk-utils')
965 subdir('misc-utils')
966 subdir('text-utils')
967 subdir('term-utils')
968 subdir('po')
969
970 includes = [dir_include,
971 dir_libblkid,
972 dir_libsmartcols,
973 dir_libmount,
974 dir_libfdisk,
975 dir_libuuid,
976 dir_liblastlog2,
977 dir_sys_utils]
978
979 exes = []
980
981 opt = not get_option('build-chfn-chsh').disabled()
982 exe = executable(
983 'chfn',
984 chfn_sources,
985 chfn_chsh_sources,
986 include_directories : includes,
987 link_with : [lib_common, logindefs_c],
988 dependencies : chfn_chsh_deps,
989 install_dir : usrbin_exec_dir,
990 install_mode : 'rwsr-xr-x',
991 install : opt,
992 build_by_default : opt)
993
994 exe2 = executable(
995 'chsh',
996 'login-utils/chsh.c',
997 'lib/shells.c',
998 chfn_chsh_sources,
999 include_directories : includes,
1000 link_with : lib_common,
1001 dependencies : chfn_chsh_deps,
1002 install_dir : usrbin_exec_dir,
1003 install_mode : 'rwsr-xr-x',
1004 install : opt,
1005 build_by_default : opt)
1006 if opt and not is_disabler(exe)
1007 exes += [exe, exe2]
1008 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1009 bashcompletions += ['chfn', 'chsh']
1010 endif
1011
1012 exe = executable(
1013 'test_islocal',
1014 test_islocal_sources,
1015 include_directories : includes,
1016 c_args : '-DTEST_PROGRAM',
1017 build_by_default : program_tests)
1018 exes += exe
1019
1020 exe = executable(
1021 'test-consoles',
1022 test_consoles_sources,
1023 c_args : ['-DTEST_PROGRAM'],
1024 include_directories : includes,
1025 link_with : lib_common,
1026 build_by_default : program_tests)
1027 exes += exe
1028
1029 opt = not get_option('build-last').disabled()
1030 exe = executable(
1031 'last',
1032 last_sources,
1033 include_directories : includes,
1034 link_with : [lib_common],
1035 install_dir : usrbin_exec_dir,
1036 install : opt,
1037 build_by_default : opt)
1038 if opt and not is_disabler(exe)
1039 exes += exe
1040 meson.add_install_script(meson_make_symlink,
1041 'last',
1042 join_paths(usrbin_exec_dir, 'lastb'))
1043 manadocs += ['login-utils/last.1.adoc']
1044 manlinks += {'lastb.1': 'last.1'}
1045 bashcompletions += ['last']
1046 bashcompletionslinks += {'lastb': 'last'}
1047 endif
1048
1049 opt = not get_option('build-nologin').disabled()
1050 exe = executable(
1051 'nologin',
1052 'login-utils/nologin.c',
1053 include_directories : includes,
1054 install_dir : sbindir,
1055 link_with : [lib_common],
1056 install : opt,
1057 build_by_default : opt)
1058 if opt and not is_disabler(exe)
1059 exes += exe
1060 manadocs += ['login-utils/nologin.8.adoc']
1061 endif
1062
1063 opt = not get_option('build-utmpdump').disabled()
1064 exe = executable(
1065 'utmpdump',
1066 'login-utils/utmpdump.c',
1067 include_directories : includes,
1068 link_with : [lib_common],
1069 install_dir : usrbin_exec_dir,
1070 install : opt,
1071 build_by_default : opt)
1072 if opt and not is_disabler(exe)
1073 exes += exe
1074 manadocs += ['login-utils/utmpdump.1.adoc']
1075 bashcompletions += ['utmpdump']
1076 endif
1077
1078 opt = not get_option('build-su').disabled()
1079 exe = executable(
1080 'su',
1081 'login-utils/su.c',
1082 'login-utils/su-common.c',
1083 'login-utils/su-common.h',
1084 'lib/shells.c',
1085 pty_session_c,
1086 monotonic_c,
1087 include_directories : includes,
1088 link_with : [lib_common, logindefs_c],
1089 dependencies : [lib_pam,
1090 lib_pam_misc,
1091 lib_util,
1092 realtime_libs],
1093 install_mode : 'rwsr-xr-x',
1094 install : opt,
1095 build_by_default : opt)
1096 if opt and not is_disabler(exe)
1097 exes += exe
1098 manadocs += ['login-utils/su.1.adoc']
1099 bashcompletions += ['su']
1100 endif
1101
1102 opt = not get_option('build-newgrp').disabled()
1103 exe = executable(
1104 'newgrp',
1105 'login-utils/newgrp.c',
1106 include_directories : includes,
1107 dependencies : [lib_crypt],
1108 install_dir : usrbin_exec_dir,
1109 install_mode : 'rwsr-xr-x',
1110 install : opt,
1111 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1113 exes += exe
1114 manadocs += ['login-utils/newgrp.1.adoc']
1115 bashcompletions += ['newgrp']
1116 endif
1117
1118 opt = not get_option('build-lslogins').disabled()
1119 exe = executable(
1120 'lslogins',
1121 'login-utils/lslogins.c',
1122 include_directories : includes,
1123 link_with : [lib_common,
1124 lib_smartcols,
1125 logindefs_c] +
1126 (build_liblastlog2 ? [lib_lastlog2] : []),
1127 dependencies : [lib_selinux,
1128 lib_systemd],
1129 install_dir : usrbin_exec_dir,
1130 install : opt,
1131 build_by_default : opt)
1132 if opt and not is_disabler(exe)
1133 exes += exe
1134 manadocs += ['login-utils/lslogins.1.adoc']
1135 bashcompletions += ['lslogins']
1136 endif
1137
1138 opt = not get_option('build-vipw').disabled()
1139 exe = executable(
1140 'vipw',
1141 'login-utils/vipw.c',
1142 'login-utils/setpwnam.h',
1143 include_directories : includes,
1144 link_with : [lib_common],
1145 dependencies : [lib_selinux],
1146 install_dir : usrbin_exec_dir,
1147 install : opt,
1148 build_by_default : opt)
1149 if opt and not is_disabler(exe)
1150 exes += exe
1151 meson.add_install_script(meson_make_symlink,
1152 'vipw',
1153 join_paths(usrbin_exec_dir, 'vigr'))
1154 manadocs += ['login-utils/vipw.8.adoc']
1155 meson.add_install_script(meson_make_symlink,
1156 'vipw.8',
1157 join_paths(mandir, 'man8/vigr.8'))
1158 endif
1159
1160 opt = not get_option('build-runuser').disabled()
1161 exe = executable(
1162 'runuser',
1163 'login-utils/runuser.c',
1164 'login-utils/su-common.c',
1165 'login-utils/su-common.h',
1166 'lib/shells.c',
1167 pty_session_c,
1168 monotonic_c,
1169 include_directories : includes,
1170 link_with : [lib_common, logindefs_c],
1171 dependencies : [lib_pam,
1172 lib_pam_misc,
1173 lib_util,
1174 realtime_libs],
1175 install_dir : sbindir,
1176 install : opt,
1177 build_by_default : opt)
1178 if opt and not is_disabler(exe)
1179 exes += exe
1180 manadocs += ['login-utils/runuser.1.adoc']
1181 bashcompletionslinks += {'runuser': 'su'}
1182 endif
1183
1184 ############################################################
1185
1186 if is_glibc
1187 exe = executable(
1188 'col',
1189 col_sources,
1190 include_directories : includes,
1191 link_with : lib_common,
1192 install_dir : usrbin_exec_dir,
1193 install : true)
1194 exes += exe
1195 manadocs += ['text-utils/col.1.adoc']
1196 bashcompletions += ['col']
1197 endif
1198
1199 exe = executable(
1200 'colcrt',
1201 colcrt_sources,
1202 include_directories : includes,
1203 install_dir : usrbin_exec_dir,
1204 install : true)
1205 exes += exe
1206 manadocs += ['text-utils/colcrt.1.adoc']
1207 bashcompletions += ['colcrt']
1208
1209 exe = executable(
1210 'colrm',
1211 colrm_sources,
1212 include_directories : includes,
1213 link_with : lib_common,
1214 install_dir : usrbin_exec_dir,
1215 install : true)
1216 exes += exe
1217 manadocs += ['text-utils/colrm.1.adoc']
1218 bashcompletions += ['colrm']
1219
1220 exe = executable(
1221 'rev',
1222 rev_sources,
1223 include_directories : includes,
1224 install_dir : usrbin_exec_dir,
1225 install : true)
1226 exes += exe
1227 manadocs += ['text-utils/rev.1.adoc']
1228 bashcompletions += ['rev']
1229
1230 exe = executable(
1231 'column',
1232 column_sources,
1233 include_directories : includes,
1234 link_with : [lib_common,
1235 lib_smartcols],
1236 install_dir : usrbin_exec_dir,
1237 install : true)
1238 if not is_disabler(exe)
1239 exes += exe
1240 manadocs += ['text-utils/column.1.adoc']
1241 bashcompletions += ['column']
1242 endif
1243
1244 opt = not get_option('build-line').disabled()
1245 exe = executable(
1246 'line',
1247 line_sources,
1248 include_directories : includes,
1249 install_dir : usrbin_exec_dir,
1250 install : opt,
1251 build_by_default : opt)
1252 if opt and not is_disabler(exe)
1253 exes += exe
1254 manadocs += ['text-utils/line.1.adoc']
1255 endif
1256
1257 opt = not get_option('build-pg').disabled()
1258 exe = executable(
1259 'pg',
1260 pg_sources,
1261 link_with : lib_common,
1262 include_directories : includes,
1263 dependencies : [lib_tinfo,
1264 curses_libs],
1265 install_dir : usrbin_exec_dir,
1266 install : opt,
1267 build_by_default : opt)
1268 if opt and not is_disabler(exe)
1269 exes += exe
1270 manadocs += ['text-utils/pg.1.adoc']
1271 bashcompletions += ['pg']
1272 endif
1273
1274 opt = not get_option('build-ul').disabled()
1275 exe = executable(
1276 'ul',
1277 ul_sources,
1278 include_directories : includes,
1279 dependencies : [lib_tinfo,
1280 curses_libs],
1281 install_dir : usrbin_exec_dir,
1282 install : opt,
1283 build_by_default : opt)
1284 if opt and not is_disabler(exe)
1285 exes += exe
1286 manadocs += ['text-utils/ul.1.adoc']
1287 bashcompletions += ['ul']
1288 endif
1289
1290 opt = not get_option('build-more').disabled()
1291 exe = executable(
1292 'more',
1293 more_sources,
1294 link_with : [lib_common],
1295 include_directories : includes,
1296 dependencies : [lib_tinfo,
1297 curses_libs,
1298 lib_magic],
1299 install : opt,
1300 build_by_default : opt)
1301 exe2 = executable(
1302 'test_more',
1303 more_sources,
1304 link_with : [lib_common],
1305 include_directories : includes,
1306 c_args : '-DTEST_PROGRAM',
1307 dependencies : [lib_tinfo,
1308 curses_libs,
1309 lib_magic],
1310 build_by_default : opt and program_tests)
1311 exes += exe
1312 if opt and not is_disabler(exe)
1313 exes += [exe, exe2]
1314 manadocs += ['text-utils/more.1.adoc']
1315 bashcompletions += ['more']
1316 endif
1317
1318 exe = executable(
1319 'hexdump',
1320 hexdump_sources,
1321 include_directories : includes,
1322 link_with : [lib_common,
1323 lib_tcolors],
1324 install_dir : usrbin_exec_dir,
1325 install : true)
1326 if not is_disabler(exe)
1327 exes += exe
1328 manadocs += ['text-utils/hexdump.1.adoc']
1329 bashcompletions += ['hexdump']
1330 endif
1331
1332 opt = not get_option('build-lsmem').disabled()
1333 exe = executable(
1334 'lsmem',
1335 lsmem_sources,
1336 include_directories : includes,
1337 link_with : [lib_common,
1338 lib_smartcols],
1339 install_dir : usrbin_exec_dir,
1340 install : opt,
1341 build_by_default : opt)
1342 if opt and not is_disabler(exe)
1343 exes += exe
1344 manadocs += ['sys-utils/lsmem.1.adoc']
1345 bashcompletions += ['lsmem']
1346 endif
1347
1348 opt = not get_option('build-chmem').disabled()
1349 exe = executable(
1350 'chmem',
1351 chmem_sources,
1352 include_directories : includes,
1353 link_with : [lib_common],
1354 install_dir : usrbin_exec_dir,
1355 install : opt,
1356 build_by_default : opt)
1357 if opt and not is_disabler(exe)
1358 exes += exe
1359 manadocs += ['sys-utils/chmem.8.adoc']
1360 bashcompletions += ['chmem']
1361 endif
1362
1363 exe = executable(
1364 'choom',
1365 choom_sources,
1366 include_directories : includes,
1367 link_with : [lib_common],
1368 install_dir : usrbin_exec_dir,
1369 install : true)
1370 exes += exe
1371 manadocs += ['sys-utils/choom.1.adoc']
1372
1373 exe = executable(
1374 'ipcmk',
1375 ipcmk_sources,
1376 include_directories : includes,
1377 link_with : [lib_common],
1378 install_dir : usrbin_exec_dir,
1379 install : true)
1380 exes += exe
1381 manadocs += ['sys-utils/ipcmk.1.adoc']
1382 bashcompletions += ['ipcmk']
1383
1384 exe = executable(
1385 'ipcrm',
1386 ipcrm_sources,
1387 include_directories : includes,
1388 link_with : [lib_common],
1389 install_dir : usrbin_exec_dir,
1390 install : true)
1391 exes += exe
1392 manadocs += ['sys-utils/ipcrm.1.adoc']
1393 bashcompletions += ['ipcrm']
1394
1395 opt = not get_option('build-ipcs').disabled()
1396 exe = executable(
1397 'ipcs',
1398 ipcs_sources,
1399 include_directories : includes,
1400 link_with : [lib_common],
1401 install_dir : usrbin_exec_dir,
1402 install : opt,
1403 build_by_default : opt)
1404 if opt and not is_disabler(exe)
1405 exes += exe
1406 manadocs += ['sys-utils/ipcs.1.adoc']
1407 bashcompletions += ['ipcs']
1408 endif
1409
1410 opt = not get_option('build-rfkill').disabled()
1411 exe = executable(
1412 'rfkill',
1413 rfkill_sources,
1414 include_directories : includes,
1415 link_with : [lib_common,
1416 lib_smartcols],
1417 install_dir : usrsbin_exec_dir,
1418 install : opt,
1419 build_by_default : opt)
1420 if opt and not is_disabler(exe)
1421 exes += exe
1422 manadocs += ['sys-utils/rfkill.8.adoc']
1423 bashcompletions += ['rfkill']
1424 endif
1425
1426 exe = executable(
1427 'renice',
1428 renice_sources,
1429 include_directories : includes,
1430 link_with : [lib_common,
1431 lib_smartcols],
1432 install_dir : usrbin_exec_dir,
1433 install : true)
1434 if not is_disabler(exe)
1435 exes += exe
1436 manadocs += ['sys-utils/renice.1.adoc']
1437 bashcompletions += ['renice']
1438 endif
1439
1440 exe = executable(
1441 'setpgid',
1442 setpgid_sources,
1443 include_directories: includes,
1444 link_with : [lib_common,
1445 lib_smartcols],
1446 install_dir : usrbin_exec_dir,
1447 install : true)
1448 if opt and not is_disabler(exe)
1449 exes += exe
1450 manadocs += ['sys-utils/setpgid.1.adoc']
1451 bashcompletions += ['setpgid']
1452 endif
1453
1454 exe = executable(
1455 'setsid',
1456 setsid_sources,
1457 include_directories : includes,
1458 link_with : [lib_common,
1459 lib_smartcols],
1460 install_dir : usrbin_exec_dir,
1461 install : true)
1462 if opt and not is_disabler(exe)
1463 exes += exe
1464 manadocs += ['sys-utils/setsid.1.adoc']
1465 bashcompletions += ['setsid']
1466 endif
1467
1468 exe = executable(
1469 'readprofile',
1470 readprofile_sources,
1471 include_directories : includes,
1472 link_with : [lib_common,
1473 lib_smartcols],
1474 install_dir : usrsbin_exec_dir,
1475 install : true)
1476 if not is_disabler(exe)
1477 exes += exe
1478 manadocs += ['sys-utils/readprofile.8.adoc']
1479 bashcompletions += ['readprofile']
1480 endif
1481
1482 opt = not get_option('build-tunelp').disabled()
1483 exe = executable(
1484 'tunelp',
1485 tunelp_sources,
1486 include_directories : includes,
1487 link_with : [lib_common],
1488 install_dir : usrsbin_exec_dir,
1489 install : opt,
1490 build_by_default : opt)
1491 if opt and not is_disabler(exe)
1492 exes += exe
1493 manadocs += ['sys-utils/tunelp.8.adoc']
1494 bashcompletions += ['tunelp']
1495 endif
1496
1497 exe = executable(
1498 'fstrim',
1499 fstrim_sources,
1500 include_directories : includes,
1501 link_with : [lib_common,
1502 lib_mount],
1503 install_dir : sbindir,
1504 install : true)
1505 if not is_disabler(exe)
1506 exes += exe
1507 manadocs += ['sys-utils/fstrim.8.adoc']
1508 bashcompletions += ['fstrim']
1509 endif
1510
1511 exe = executable(
1512 'dmesg',
1513 dmesg_sources,
1514 include_directories : includes,
1515 link_with : [lib_common,
1516 lib_tcolors],
1517 install : true)
1518 if not is_disabler(exe)
1519 exes += exe
1520 manadocs += ['sys-utils/dmesg.1.adoc']
1521 bashcompletions += ['dmesg']
1522 endif
1523
1524 exe = executable(
1525 'test_dmesg',
1526 dmesg_sources,
1527 include_directories : dir_include,
1528 c_args : '-DTEST_DMESG',
1529 link_with : [lib_common,
1530 lib_tcolors],
1531 build_by_default : program_tests)
1532 if not is_disabler(exe)
1533 exes += exe
1534 endif
1535
1536 exe = executable(
1537 'ctrlaltdel',
1538 ctrlaltdel_sources,
1539 include_directories : includes,
1540 link_with : [lib_common],
1541 install_dir : sbindir,
1542 install : true)
1543 exes += exe
1544 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1545 bashcompletions += ['ctrlaltdel']
1546
1547 exe = executable(
1548 'fsfreeze',
1549 fsfreeze_sources,
1550 include_directories : includes,
1551 install_dir : sbindir,
1552 install : true)
1553 exes += exe
1554 manadocs += ['sys-utils/fsfreeze.8.adoc']
1555 bashcompletions += ['fsfreeze']
1556
1557 exe = executable(
1558 'blkdiscard',
1559 blkdiscard_sources,
1560 include_directories : includes,
1561 link_with : [lib_common,
1562 lib_blkid],
1563 install_dir : sbindir,
1564 install : true)
1565 exes += exe
1566 manadocs += ['sys-utils/blkdiscard.8.adoc']
1567 bashcompletions += ['blkdiscard']
1568
1569 if cc.has_header('linux/blkzoned.h')
1570 exe = executable(
1571 'blkzone',
1572 blkzone_sources,
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : sbindir,
1576 install : true)
1577 exes += exe
1578 manadocs += ['sys-utils/blkzone.8.adoc']
1579 bashcompletions += ['blkzone']
1580 endif
1581
1582 if cc.has_header('linux/pr.h')
1583 exe = executable(
1584 'blkpr',
1585 blkpr_sources,
1586 include_directories : includes,
1587 link_with : [lib_common],
1588 install_dir : sbindir,
1589 install : true)
1590 exes += exe
1591 manadocs += ['sys-utils/blkpr.8.adoc']
1592 endif
1593
1594 exe = executable(
1595 'ldattach',
1596 ldattach_sources,
1597 include_directories : includes,
1598 link_with : [lib_common],
1599 install_dir : usrsbin_exec_dir,
1600 install : true)
1601 exes += exe
1602 manadocs += ['sys-utils/ldattach.8.adoc']
1603 bashcompletions += ['ldattach']
1604
1605 exe = executable(
1606 'rtcwake',
1607 rtcwake_sources,
1608 include_directories : includes,
1609 link_with : [lib_common],
1610 install_dir : usrsbin_exec_dir,
1611 install : true)
1612 exes += exe
1613 manadocs += ['sys-utils/rtcwake.8.adoc']
1614 bashcompletions += ['rtcwake']
1615
1616 exe = executable(
1617 'setarch',
1618 setarch_sources,
1619 include_directories : includes,
1620 link_with : [lib_common],
1621 install_dir : usrbin_exec_dir,
1622 install : true)
1623 exes += exe
1624 manadocs += ['sys-utils/setarch.8.adoc']
1625 bashcompletions += ['setarch']
1626
1627 setarch_links = ['uname26', 'linux32', 'linux64']
1628 setarch_links_arch = {
1629 's390x' : ['s390', 's390x'],
1630 'x86' : ['i386'],
1631 'x86_64' : ['i386', 'x86_64'],
1632 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1633 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1634 'mips64' : ['mips', 'mips64', 'mips32'],
1635 'ia64' : ['i386', 'ia64'],
1636 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1637 }
1638 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1639
1640 foreach link: setarch_links
1641 meson.add_install_script(meson_make_symlink,
1642 'setarch',
1643 join_paths(usrbin_exec_dir, link))
1644 manlinks += {link + '.8': 'setarch.8'}
1645 endforeach
1646
1647 opt = not get_option('build-eject').disabled()
1648 exe = executable(
1649 'eject',
1650 eject_sources,
1651 include_directories : includes,
1652 link_with : [lib_common,
1653 lib_mount],
1654 install_dir : usrbin_exec_dir,
1655 install : opt,
1656 build_by_default : opt)
1657 if opt and not is_disabler(exe)
1658 exe = exe
1659 manadocs += ['sys-utils/eject.1.adoc']
1660 bashcompletions += ['eject']
1661 endif
1662
1663 opt = not get_option('build-losetup').disabled()
1664 exe = executable(
1665 'losetup',
1666 losetup_sources,
1667 include_directories : includes,
1668 link_with : [lib_common,
1669 lib_smartcols],
1670 install_dir : sbindir,
1671 install : opt,
1672 build_by_default : opt)
1673 if opt and not is_disabler(exe)
1674 manadocs += ['sys-utils/losetup.8.adoc']
1675 exes += exe
1676 bashcompletions += ['losetup']
1677 endif
1678
1679 opt = opt and 'losetup' in static_programs
1680 exe = executable(
1681 'losetup.static',
1682 losetup_sources,
1683 include_directories : includes,
1684 link_args : ['--static'],
1685 link_with : [lib_common,
1686 lib_smartcols.get_static_lib()],
1687 install_dir : sbindir,
1688 install : opt,
1689 build_by_default : opt)
1690 if opt and not is_disabler(exe)
1691 exes += exe
1692 endif
1693
1694 opt = not get_option('build-zramctl').disabled()
1695 exe = executable(
1696 'zramctl',
1697 zramctl_sources,
1698 include_directories : includes,
1699 link_with : [lib_common,
1700 lib_smartcols],
1701 install_dir : sbindir,
1702 install : opt,
1703 build_by_default : opt)
1704 if opt and not is_disabler(exe)
1705 exes += exe
1706 manadocs += ['sys-utils/zramctl.8.adoc']
1707 bashcompletions += ['zramctl']
1708 endif
1709
1710 exe = executable(
1711 'prlimit',
1712 prlimit_sources,
1713 include_directories : includes,
1714 link_with : [lib_common,
1715 lib_smartcols],
1716 install_dir : usrbin_exec_dir,
1717 install : true)
1718 if not is_disabler(exe)
1719 exes += exe
1720 manadocs += ['sys-utils/prlimit.1.adoc']
1721 bashcompletions += ['prlimit']
1722 endif
1723
1724 exe = executable(
1725 'lsns',
1726 lsns_sources,
1727 include_directories : includes,
1728 link_with : [lib_common,
1729 lib_smartcols,
1730 lib_mount],
1731 install_dir : usrbin_exec_dir,
1732 install : true)
1733 if not is_disabler(exe)
1734 exes += exe
1735 manadocs += ['sys-utils/lsns.8.adoc']
1736 bashcompletions += ['lsns']
1737 endif
1738
1739 opt = not get_option('build-mount').disabled()
1740 exe = executable(
1741 'mount',
1742 mount_sources,
1743 include_directories : includes,
1744 link_with : [lib_common,
1745 lib_smartcols,
1746 lib_mount],
1747 dependencies : lib_selinux,
1748 install_mode : 'rwsr-xr-x',
1749 install : opt,
1750 build_by_default : opt)
1751 exe2 = executable(
1752 'umount',
1753 umount_sources,
1754 include_directories : includes,
1755 link_with : [lib_common,
1756 lib_mount],
1757 install_mode : 'rwsr-xr-x',
1758 install : opt,
1759 build_by_default : opt)
1760 if opt and not is_disabler(exe)
1761 exes += [exe, exe2]
1762 manadocs += ['sys-utils/fstab.5.adoc',
1763 'sys-utils/mount.8.adoc',
1764 'sys-utils/umount.8.adoc']
1765 bashcompletions += ['mount', 'umount']
1766 endif
1767
1768 opt2 = opt and 'mount' in static_programs
1769 exe = executable(
1770 'mount.static',
1771 mount_sources,
1772 include_directories : includes,
1773 link_args : ['--static'],
1774 link_with : [lib_common,
1775 lib_smartcols_static,
1776 lib_mount_static],
1777 install : opt2,
1778 build_by_default : opt2)
1779 if opt2 and not is_disabler(exe)
1780 exes += exe
1781 endif
1782
1783 opt2 = opt and 'umount' in static_programs
1784 exe = executable(
1785 'umount.static',
1786 umount_sources,
1787 include_directories : includes,
1788 link_args : ['--static'],
1789 link_with : [lib_common,
1790 lib_mount_static],
1791 install : opt2,
1792 build_by_default : opt2)
1793 if opt2 and not is_disabler(exe)
1794 exes += exe
1795 endif
1796
1797 # setuid?
1798
1799 exe = executable(
1800 'swapon',
1801 swapon_sources,
1802 include_directories : includes,
1803 link_with : [lib_common,
1804 lib_blkid,
1805 lib_mount,
1806 lib_smartcols],
1807 install_dir : sbindir,
1808 install : true)
1809 if not is_disabler(exe)
1810 exes += exe
1811 manadocs += ['sys-utils/swapon.8.adoc']
1812 bashcompletions += ['swapon']
1813 endif
1814
1815 exe = executable(
1816 'swapoff',
1817 swapoff_sources,
1818 include_directories : includes,
1819 link_with : [lib_common,
1820 lib_blkid,
1821 lib_mount],
1822 install_dir : sbindir,
1823 install : true)
1824 if not is_disabler(exe)
1825 exes += exe
1826 manlinks += {'swapoff.8': 'swapon.8'}
1827 bashcompletions += ['swapoff']
1828 endif
1829
1830 exe = executable(
1831 'lscpu',
1832 lscpu_sources,
1833 include_directories : includes,
1834 link_with : [lib_common,
1835 lib_smartcols],
1836 dependencies : [rtas_libs],
1837 install_dir : usrbin_exec_dir,
1838 install : true)
1839 if not is_disabler(exe)
1840 exes += exe
1841 manadocs += ['sys-utils/lscpu.1.adoc']
1842 bashcompletions += ['lscpu']
1843 endif
1844
1845 exe = executable(
1846 'chcpu',
1847 chcpu_sources,
1848 include_directories : includes,
1849 link_with : [lib_common],
1850 install_dir : sbindir,
1851 install : true)
1852 exes += exe
1853 manadocs += ['sys-utils/chcpu.8.adoc']
1854 bashcompletions += ['chcpu']
1855
1856 exe = executable(
1857 'wdctl',
1858 wdctl_sources,
1859 include_directories : includes,
1860 link_with : [lib_common,
1861 lib_smartcols],
1862 install : true)
1863 if not is_disabler(exe)
1864 exes += exe
1865 manadocs += ['sys-utils/wdctl.8.adoc']
1866 bashcompletions += ['wdctl']
1867 endif
1868
1869 opt = not get_option('build-mountpoint').disabled()
1870 exe = executable(
1871 'mountpoint',
1872 mountpoint_sources,
1873 include_directories : includes,
1874 link_with : [lib_mount],
1875 install : opt,
1876 build_by_default : opt)
1877 if opt and not is_disabler(exe)
1878 exes += exe
1879 manadocs += ['sys-utils/mountpoint.1.adoc']
1880 bashcompletions += ['mountpoint']
1881 endif
1882
1883 opt = not get_option('build-fallocate').disabled()
1884 exe = executable(
1885 'fallocate',
1886 fallocate_sources,
1887 include_directories : includes,
1888 link_with : [lib_common],
1889 install_dir : usrbin_exec_dir,
1890 install : opt,
1891 build_by_default : opt)
1892 if opt and not is_disabler(exe)
1893 exes += exe
1894 manadocs += ['sys-utils/fallocate.1.adoc']
1895 bashcompletions += ['fallocate']
1896 endif
1897
1898 opt = not get_option('build-pivot_root').disabled()
1899 exe = executable(
1900 'pivot_root',
1901 pivot_root_sources,
1902 include_directories : includes,
1903 install_dir : sbindir,
1904 install : opt,
1905 build_by_default : opt)
1906 if opt and not is_disabler(exe)
1907 exes += exe
1908 manadocs += ['sys-utils/pivot_root.8.adoc']
1909 bashcompletions += ['pivot_root']
1910 endif
1911
1912 opt = not get_option('build-switch_root').disabled()
1913 if opt and not have_dirfd and not have_ddfd
1914 error('neither dirfd nor ddfd are available')
1915 endif
1916 exe = executable(
1917 'switch_root',
1918 switch_root_sources,
1919 include_directories : includes,
1920 install_dir : sbindir,
1921 install : opt,
1922 build_by_default : opt)
1923 if opt and not is_disabler(exe)
1924 exes += exe
1925 manadocs += ['sys-utils/switch_root.8.adoc']
1926 endif
1927
1928 opt = not get_option('build-unshare').disabled()
1929 exe = executable(
1930 'unshare',
1931 unshare_sources,
1932 include_directories : includes,
1933 link_with : [lib_common],
1934 install_dir : usrbin_exec_dir,
1935 install : opt,
1936 build_by_default : opt)
1937 if opt and not is_disabler(exe)
1938 exes += exe
1939 manadocs += ['sys-utils/unshare.1.adoc']
1940 bashcompletions += ['unshare']
1941 endif
1942
1943 opt = opt and 'unshare' in static_programs
1944 exe = executable(
1945 'unshare.static',
1946 unshare_sources,
1947 include_directories : includes,
1948 link_with : [lib_common],
1949 install_dir : usrbin_exec_dir,
1950 install : opt,
1951 build_by_default : opt)
1952 if opt and not is_disabler(exe)
1953 exes += exe
1954 endif
1955
1956 opt = not get_option('build-nsenter').disabled()
1957 exe = executable(
1958 'nsenter',
1959 nsenter_sources,
1960 include_directories : includes,
1961 link_with : [lib_common],
1962 dependencies : [lib_selinux],
1963 install_dir : usrbin_exec_dir,
1964 install : opt,
1965 build_by_default : opt)
1966 if opt and not is_disabler(exe)
1967 exes += exe
1968 manadocs += ['sys-utils/nsenter.1.adoc']
1969 bashcompletions += ['nsenter']
1970 endif
1971
1972 opt = opt and 'nsenter' in static_programs
1973 exe = executable(
1974 'nsenter.static',
1975 nsenter_sources,
1976 include_directories : includes,
1977 link_with : [lib_common],
1978 dependencies : [lib_selinux],
1979 install_dir : usrbin_exec_dir,
1980 install : opt,
1981 build_by_default : opt)
1982 if opt and not is_disabler(exe)
1983 exes += exe
1984 endif
1985
1986 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1987 exe = executable(
1988 'setpriv',
1989 setpriv_sources,
1990 include_directories : includes,
1991 link_with : [lib_common],
1992 dependencies : [lib_cap_ng],
1993 install_dir : usrbin_exec_dir,
1994 install : opt,
1995 build_by_default : opt)
1996 if opt and not is_disabler(exe)
1997 exes += exe
1998 manadocs += ['sys-utils/setpriv.1.adoc']
1999 bashcompletions += ['setpriv']
2000 endif
2001
2002 exe = executable(
2003 'flock',
2004 flock_sources,
2005 include_directories : includes,
2006 link_with : [lib_common],
2007 dependencies : realtime_libs,
2008 install_dir : usrbin_exec_dir,
2009 install : true)
2010 exes += exe
2011 manadocs += ['sys-utils/flock.1.adoc']
2012 bashcompletions += ['flock']
2013
2014 opt = not get_option('build-lsirq').disabled()
2015 exe = executable(
2016 'lsirq',
2017 lsirq_sources,
2018 include_directories : includes,
2019 link_with : [lib_common,
2020 lib_smartcols],
2021 install_dir : usrbin_exec_dir,
2022 install : opt,
2023 build_by_default : opt)
2024 if opt and not is_disabler(exe)
2025 exes += exe
2026 manadocs += ['sys-utils/lsirq.1.adoc']
2027 bashcompletions += ['lsirq']
2028 endif
2029
2030 opt = not get_option('build-irqtop').disabled()
2031 exe = executable(
2032 'irqtop',
2033 irqtop_sources,
2034 include_directories : includes,
2035 dependencies : [realtime_libs, curses_libs],
2036 link_with : [lib_common,
2037 lib_smartcols,
2038 lib_tcolors],
2039 install_dir : usrbin_exec_dir,
2040 install : opt,
2041 build_by_default : opt)
2042 if opt and not is_disabler(exe)
2043 exes += exe
2044 manadocs += ['sys-utils/irqtop.1.adoc']
2045 bashcompletions += ['irqtop']
2046 endif
2047
2048 opt = not get_option('build-ipcs').disabled()
2049 exe = executable(
2050 'lsipc',
2051 lsipc_sources,
2052 include_directories : includes,
2053 link_with : [lib_common,
2054 lib_smartcols],
2055 install_dir : usrbin_exec_dir,
2056 install : opt,
2057 build_by_default : opt)
2058 if opt and not is_disabler(exe)
2059 exes += exe
2060 manadocs += ['sys-utils/lsipc.1.adoc']
2061 bashcompletions += ['lsipc']
2062 endif
2063
2064 opt = build_hwclock
2065 exe = executable(
2066 'hwclock',
2067 hwclock_sources,
2068 include_directories : includes,
2069 link_with : [lib_common],
2070 dependencies : [lib_m,
2071 lib_audit],
2072 install_dir : sbindir,
2073 install : opt,
2074 build_by_default : opt)
2075 if opt and not is_disabler(exe)
2076 exes += exe
2077 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2078 bashcompletions += ['hwclock']
2079 endif
2080
2081 exe = executable(
2082 'mkfs',
2083 mkfs_sources,
2084 include_directories : includes,
2085 install_dir : sbindir,
2086 install : true)
2087 exes += exe
2088 manadocs += ['disk-utils/mkfs.8.adoc']
2089 bashcompletions += ['mkfs']
2090
2091 opt = not get_option('build-bfs').disabled()
2092 exe = executable(
2093 'mkfs.bfs',
2094 mkfs_bfs_sources,
2095 include_directories : includes,
2096 link_with : [lib_common],
2097 install_dir : sbindir,
2098 install : opt,
2099 build_by_default : opt)
2100 if opt and not is_disabler(exe)
2101 exes += exe
2102 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2103 bashcompletions += ['mkfs.bfs']
2104 endif
2105
2106 exe = executable(
2107 'isosize',
2108 isosize_sources,
2109 include_directories : includes,
2110 link_with : [lib_common],
2111 install_dir : usrbin_exec_dir,
2112 install : true)
2113 exes += exe
2114 manadocs += ['disk-utils/isosize.8.adoc']
2115 bashcompletions += ['isosize']
2116
2117 exe = executable(
2118 'mkswap',
2119 mkswap_sources,
2120 include_directories : includes,
2121 link_with : [lib_common,
2122 lib_blkid,
2123 lib_uuid],
2124 dependencies: [lib_selinux],
2125 install_dir : sbindir,
2126 install : true)
2127 if not is_disabler(exe)
2128 exes += exe
2129 manadocs += ['disk-utils/mkswap.8.adoc']
2130 bashcompletions += ['mkswap']
2131 endif
2132
2133 exe = executable(
2134 'swaplabel',
2135 swaplabel_sources,
2136 include_directories : includes,
2137 link_with : [lib_common,
2138 lib_blkid,
2139 lib_uuid],
2140 install_dir : sbindir,
2141 install : true)
2142 if not is_disabler(exe)
2143 exes += exe
2144 manadocs += ['disk-utils/swaplabel.8.adoc']
2145 bashcompletions += ['swaplabel']
2146 endif
2147
2148 opt = not get_option('build-fsck').disabled()
2149 exe = executable(
2150 'fsck',
2151 fsck_sources,
2152 include_directories : includes,
2153 link_with : [lib_common,
2154 lib_blkid,
2155 lib_mount],
2156 dependencies : realtime_libs,
2157 install_dir : sbindir,
2158 install : opt,
2159 build_by_default : opt)
2160 if opt and not is_disabler(exe)
2161 exes += exe
2162 manadocs += ['disk-utils/fsck.8.adoc']
2163 bashcompletions += ['fsck']
2164 endif
2165
2166 opt = not get_option('build-minix').disabled()
2167 exe = executable(
2168 'mkfs.minix',
2169 mkfs_minix_sources,
2170 include_directories : includes,
2171 link_with : [lib_common],
2172 install_dir : sbindir,
2173 install : opt,
2174 build_by_default : opt)
2175 exe2 = executable(
2176 'test_mkfs_minix',
2177 mkfs_minix_sources,
2178 include_directories : includes,
2179 c_args : '-DTEST_SCRIPT',
2180 link_with : [lib_common],
2181 build_by_default : opt and program_tests)
2182 exe3 = executable(
2183 'fsck.minix',
2184 fsck_minix_sources,
2185 include_directories : includes,
2186 link_with : [lib_common],
2187 install_dir : sbindir,
2188 install : opt,
2189 build_by_default : opt)
2190 if opt and not is_disabler(exe)
2191 exes += [exe, exe2, exe3]
2192 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2193 bashcompletions += ['mkfs.minix', 'fsck.minix']
2194 endif
2195
2196 opt = not get_option('build-cramfs').disabled()
2197 exe = executable(
2198 'mkfs.cramfs',
2199 mkfs_cramfs_sources,
2200 include_directories : includes,
2201 link_with : [lib_common],
2202 dependencies : [lib_z],
2203 install_dir : sbindir,
2204 install : opt,
2205 build_by_default : opt)
2206 exe2 = executable(
2207 'fsck.cramfs',
2208 fsck_cramfs_sources,
2209 include_directories : includes,
2210 link_with : [lib_common],
2211 dependencies : [lib_z],
2212 install_dir : sbindir,
2213 install : opt,
2214 build_by_default : opt)
2215 if not is_disabler(exe)
2216 exes += [exe, exe2]
2217 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2218 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2219 endif
2220
2221 opt = not get_option('build-raw').disabled()
2222 if opt
2223 cc.has_header('linux/raw.h', required: opt)
2224 endif
2225 exe = executable(
2226 'raw',
2227 raw_sources,
2228 include_directories : includes,
2229 install_dir : sbindir,
2230 install : opt,
2231 build_by_default : opt)
2232 if opt and not is_disabler(exe)
2233 exes += exe
2234 manadocs += ['disk-utils/raw.8.adoc']
2235 bashcompletions += ['raw']
2236 endif
2237
2238 opt = not get_option('build-fdformat').disabled()
2239 exe = executable(
2240 'fdformat',
2241 fdformat_sources,
2242 include_directories : includes,
2243 link_with : [lib_common],
2244 install_dir : usrsbin_exec_dir,
2245 install : opt,
2246 build_by_default : opt)
2247 if opt and not is_disabler(exe)
2248 exes += exe
2249 manadocs += ['disk-utils/fdformat.8.adoc']
2250 bashcompletions += ['fdformat']
2251 endif
2252
2253 exe = executable(
2254 'blockdev',
2255 blockdev_sources,
2256 include_directories : includes,
2257 link_with : [lib_common],
2258 install_dir : sbindir,
2259 install : true)
2260 manadocs += ['disk-utils/blockdev.8.adoc']
2261 bashcompletions += ['blockdev']
2262
2263 opt = not get_option('build-fdisks').disabled()
2264 if opt and not have_dirfd and not have_ddfd
2265 error('neither dirfd nor ddfd are available')
2266 endif
2267 exe = executable(
2268 'fdisk',
2269 fdisk_sources,
2270 include_directories : includes,
2271 link_with : [lib_common,
2272 lib_fdisk,
2273 lib_smartcols,
2274 lib_tcolors],
2275 dependencies : [lib_readline],
2276 install_dir : sbindir,
2277 install : opt,
2278 build_by_default : opt)
2279 if opt and not is_disabler(exe)
2280 exes += exe
2281 bashcompletions += ['fdisk']
2282 endif
2283
2284 opt2 = opt and 'fdisk' in static_programs
2285 exe = executable(
2286 'fdisk.static',
2287 fdisk_sources,
2288 link_args : ['--static'],
2289 include_directories : includes,
2290 link_with : [lib_common,
2291 lib_tcolors,
2292 lib_fdisk_static,
2293 lib_smartcols.get_static_lib()],
2294 dependencies : [lib_readline_static],
2295 install_dir : sbindir,
2296 install : opt2,
2297 build_by_default : opt2)
2298 if opt2 and not is_disabler(exe)
2299 exes += exe
2300 endif
2301
2302 exe = executable(
2303 'sfdisk',
2304 sfdisk_sources,
2305 include_directories : includes,
2306 link_with : [lib_common,
2307 lib_fdisk,
2308 lib_smartcols,
2309 lib_tcolors],
2310 dependencies : [lib_readline],
2311 install_dir : sbindir,
2312 install : opt,
2313 build_by_default : opt)
2314 if opt and not is_disabler(exe)
2315 exes += exe
2316 bashcompletions += ['sfdisk']
2317 endif
2318
2319 opt2 = opt and 'sfdisk' in static_programs
2320 exe = executable(
2321 'sfdisk.static',
2322 sfdisk_sources,
2323 include_directories : includes,
2324 link_with : [lib_common,
2325 lib_tcolors,
2326 lib_fdisk_static,
2327 lib_smartcols.get_static_lib()],
2328 dependencies : [lib_readline_static],
2329 install_dir : sbindir,
2330 install : opt2,
2331 build_by_default : opt2)
2332 if opt2 and not is_disabler(exe)
2333 exes += exe
2334 endif
2335
2336 exe = executable(
2337 'cfdisk',
2338 cfdisk_sources,
2339 include_directories : includes,
2340 link_with : [lib_common,
2341 lib_fdisk,
2342 lib_smartcols,
2343 lib_tcolors,
2344 lib_mount],
2345 dependencies : [curses_libs],
2346 install_dir : sbindir,
2347 install : opt,
2348 build_by_default : opt)
2349 if opt and not is_disabler(exe)
2350 exes += exe
2351 manadocs += ['disk-utils/fdisk.8.adoc',
2352 'disk-utils/sfdisk.8.adoc',
2353 'disk-utils/cfdisk.8.adoc']
2354 bashcompletions += ['cfdisk']
2355 endif
2356
2357 opt = not get_option('build-partx').disabled()
2358 exe = executable(
2359 'addpart',
2360 addpart_sources,
2361 include_directories : includes,
2362 link_with : [lib_common],
2363 install_dir : usrsbin_exec_dir,
2364 install : opt,
2365 build_by_default : opt)
2366 exe2 = executable(
2367 'delpart',
2368 delpart_sources,
2369 include_directories : includes,
2370 link_with : [lib_common],
2371 install_dir : usrsbin_exec_dir,
2372 install : opt,
2373 build_by_default : opt)
2374 exe3 = executable(
2375 'resizepart',
2376 resizepart_sources,
2377 include_directories : includes,
2378 link_with : [lib_common],
2379 install_dir : usrsbin_exec_dir,
2380 install : opt,
2381 build_by_default : opt)
2382 exe4 = executable(
2383 'partx',
2384 partx_sources,
2385 include_directories : includes,
2386 link_with : [lib_common,
2387 lib_blkid,
2388 lib_smartcols],
2389 install_dir : usrsbin_exec_dir,
2390 install : opt,
2391 build_by_default : opt)
2392 if opt
2393 exes += [exe, exe2, exe3, exe4]
2394 manadocs += ['disk-utils/addpart.8.adoc',
2395 'disk-utils/delpart.8.adoc',
2396 'disk-utils/resizepart.8.adoc',
2397 'disk-utils/partx.8.adoc']
2398 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2399 endif
2400
2401 ############################################################
2402
2403 exe = executable(
2404 'script',
2405 script_sources,
2406 include_directories : includes,
2407 link_with : [lib_common],
2408 dependencies : [lib_util,
2409 lib_utempter,
2410 realtime_libs,
2411 math_libs],
2412 install_dir : usrbin_exec_dir,
2413 install : true)
2414 exes += exe
2415 manadocs += ['term-utils/script.1.adoc']
2416 bashcompletions += ['script']
2417
2418 exe = executable(
2419 'test_script',
2420 script_sources,
2421 include_directories : includes,
2422 c_args : '-DTEST_SCRIPT',
2423 link_with : [lib_common],
2424 dependencies : [lib_util,
2425 lib_utempter,
2426 realtime_libs,
2427 math_libs],
2428 build_by_default : program_tests)
2429 exes += exe
2430
2431 exe = executable(
2432 'scriptlive',
2433 scriptlive_sources,
2434 include_directories : includes,
2435 link_with : [lib_common],
2436 dependencies : [lib_util,
2437 realtime_libs,
2438 math_libs],
2439 install_dir : usrbin_exec_dir,
2440 install : true)
2441 exes += exe
2442 manadocs += ['term-utils/scriptlive.1.adoc']
2443 bashcompletions += ['scriptlive']
2444
2445 exe = executable(
2446 'scriptreplay',
2447 scriptreplay_sources,
2448 include_directories : includes,
2449 link_with : [lib_common],
2450 dependencies : [math_libs],
2451 install_dir : usrbin_exec_dir,
2452 install : true)
2453 exes += exe
2454 manadocs += ['term-utils/scriptreplay.1.adoc']
2455 bashcompletions += ['scriptreplay']
2456
2457 opt = not get_option('build-agetty').disabled()
2458 exe = executable(
2459 'agetty',
2460 agetty_sources,
2461 include_directories : includes,
2462 link_with : [lib_common, logindefs_c],
2463 dependencies : [BSD ? lib_util : [], lib_systemd],
2464 install_dir : sbindir,
2465 install : opt,
2466 build_by_default : opt)
2467 if opt
2468 exes += exe
2469 manadocs += ['term-utils/agetty.8.adoc']
2470 endif
2471
2472 opt = not get_option('build-setterm').disabled()
2473 exe = executable(
2474 'setterm',
2475 setterm_sources,
2476 include_directories : includes,
2477 link_with : [lib_common],
2478 dependencies : [curses_libs],
2479 install_dir : usrbin_exec_dir,
2480 install : opt,
2481 build_by_default : opt)
2482 if opt
2483 exes += exe
2484 manadocs += ['term-utils/setterm.1.adoc']
2485 bashcompletions += ['setterm']
2486 endif
2487
2488 opt = not get_option('build-mesg').disabled()
2489 exe = executable(
2490 'mesg',
2491 mesg_sources,
2492 include_directories : includes,
2493 link_with : [lib_common],
2494 install_dir : usrbin_exec_dir,
2495 install : opt,
2496 build_by_default : opt)
2497 if opt
2498 exes += exe
2499 manadocs += ['term-utils/mesg.1.adoc']
2500 bashcompletions += ['mesg']
2501 endif
2502
2503 opt = not get_option('build-wall').disabled()
2504 exe = executable(
2505 'wall',
2506 wall_sources,
2507 include_directories : includes,
2508 link_with : [lib_common],
2509 dependencies : [lib_systemd],
2510 install_dir : usrbin_exec_dir,
2511 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2512 install : opt,
2513 build_by_default : opt)
2514 if opt
2515 exes += exe
2516 manadocs += ['term-utils/wall.1.adoc']
2517 bashcompletions += ['wall']
2518 endif
2519
2520 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2521 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2522
2523 opt = not get_option('build-write').disabled()
2524 exe = executable(
2525 'write',
2526 write_sources,
2527 include_directories : includes,
2528 link_with : [lib_common],
2529 dependencies : [lib_systemd],
2530 install_dir : usrbin_exec_dir,
2531 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2532 install : opt,
2533 build_by_default : opt)
2534 if opt
2535 exes += exe
2536 manadocs += ['term-utils/write.1.adoc']
2537 bashcompletions += ['write']
2538 endif
2539
2540 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2541 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2542
2543 opt = not get_option('build-login').disabled()
2544 exe = executable(
2545 'login',
2546 login_sources,
2547 include_directories : includes,
2548 link_with : [lib_common, logindefs_c],
2549 dependencies : [lib_pam,
2550 lib_audit,
2551 lib_selinux],
2552 install : opt,
2553 build_by_default : opt)
2554 if not is_disabler(exe)
2555 exes += exe
2556 manadocs += ['login-utils/login.1.adoc']
2557 endif
2558
2559 opt = not get_option('build-sulogin').disabled()
2560 exe = executable(
2561 'sulogin',
2562 sulogin_sources,
2563 include_directories : includes,
2564 link_with : [lib_common],
2565 dependencies : [lib_crypt,
2566 lib_selinux],
2567 install_dir : sbindir,
2568 install : opt,
2569 build_by_default : opt)
2570 if not is_disabler(exe)
2571 exes += exe
2572 manadocs += ['login-utils/sulogin.8.adoc']
2573 endif
2574
2575 exe = executable(
2576 'cal',
2577 cal_sources,
2578 include_directories : includes,
2579 link_with : [lib_common,
2580 lib_tcolors],
2581 dependencies : [curses_libs],
2582 install_dir : usrbin_exec_dir,
2583 install : true)
2584 exes += exe
2585 manadocs += ['misc-utils/cal.1.adoc']
2586 bashcompletions += ['cal']
2587
2588 opt = not get_option('build-logger').disabled()
2589 exe = executable(
2590 'logger',
2591 logger_sources,
2592 include_directories : includes,
2593 link_with : [lib_common],
2594 dependencies : [lib_systemd],
2595 install_dir : usrbin_exec_dir,
2596 install : opt,
2597 build_by_default : opt)
2598 if opt and not is_disabler(exe)
2599 exes += exe
2600 manadocs += ['misc-utils/logger.1.adoc']
2601 bashcompletions += ['logger']
2602 endif
2603
2604 exe = executable(
2605 'test_logger',
2606 logger_sources,
2607 include_directories : includes,
2608 c_args : '-DTEST_LOGGER',
2609 link_with : [lib_common],
2610 dependencies : [lib_systemd],
2611 build_by_default: program_tests)
2612 if not is_disabler(exe)
2613 exes += exe
2614 endif
2615
2616 exe = executable(
2617 'look',
2618 look_sources,
2619 include_directories : includes,
2620 install_dir : usrbin_exec_dir,
2621 install : true)
2622 exes += exe
2623 manadocs += ['misc-utils/look.1.adoc']
2624 bashcompletions += ['look']
2625
2626 exe = executable(
2627 'mcookie',
2628 mcookie_sources,
2629 include_directories : includes,
2630 link_with : [lib_common],
2631 install_dir : usrbin_exec_dir,
2632 install : true)
2633 exes += exe
2634 manadocs += ['misc-utils/mcookie.1.adoc']
2635 bashcompletions += ['mcookie']
2636
2637 if build_liblastlog2
2638 exe = executable(
2639 'lastlog2',
2640 lastlog2_sources,
2641 include_directories : includes,
2642 link_with : [lib_common, lib_lastlog2],
2643 install_dir : usrbin_exec_dir,
2644 install : true)
2645 exes += exe
2646 manadocs += ['misc-utils/lastlog2.8.adoc']
2647 bashcompletions += ['lastlog2']
2648 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2649 'liblastlog2/man/ll2_write_entry.3.adoc',
2650 'liblastlog2/man/ll2_read_entry.3.adoc',
2651 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2652 'liblastlog2/man/ll2_read_all.3.adoc',
2653 'liblastlog2/man/ll2_remove_entry.3.adoc',
2654 'liblastlog2/man/ll2_rename_user.3.adoc',
2655 'liblastlog2/man/ll2_update_login_time.3.adoc'
2656 ]
2657 endif
2658
2659 exe = executable(
2660 'namei',
2661 namei_sources,
2662 include_directories : includes,
2663 dependencies : [lib_selinux],
2664 install_dir : usrbin_exec_dir,
2665 install : true)
2666 exes += exe
2667 manadocs += ['misc-utils/namei.1.adoc']
2668 bashcompletions += ['namei']
2669
2670 exe = executable(
2671 'whereis',
2672 whereis_sources,
2673 include_directories : includes,
2674 link_with : [lib_common],
2675 install_dir : usrbin_exec_dir,
2676 install : true)
2677 exes += exe
2678 manadocs += ['misc-utils/whereis.1.adoc']
2679 bashcompletions += ['whereis']
2680
2681 exe = executable(
2682 'lslocks',
2683 lslocks_sources,
2684 include_directories : includes,
2685 link_with : [lib_common,
2686 lib_mount,
2687 lib_smartcols],
2688 install_dir : usrbin_exec_dir,
2689 install : true)
2690 if not is_disabler(exe)
2691 exes += exe
2692 manadocs += ['misc-utils/lslocks.8.adoc']
2693 bashcompletions += ['lslocks']
2694 endif
2695
2696 exe = executable(
2697 'lsblk',
2698 lsblk_sources,
2699 include_directories : includes,
2700 link_with : [lib_common,
2701 lib_blkid,
2702 lib_mount,
2703 lib_tcolors,
2704 lib_smartcols],
2705 dependencies : lib_udev,
2706 install : true)
2707 if not is_disabler(exe)
2708 exes += exe
2709 manadocs += ['misc-utils/lsblk.8.adoc']
2710 bashcompletions += ['lsblk']
2711 endif
2712
2713 errnos_h = custom_target('errnos.h',
2714 input : 'tools/all_errnos',
2715 output : 'errnos.h',
2716 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2717 )
2718
2719 mq_libs = []
2720 mq_libs += cc.find_library('rt', required : true)
2721
2722 exe = executable(
2723 'lsfd',
2724 lsfd_sources, errnos_h,
2725 include_directories : includes,
2726 link_with : [lib_common,
2727 lib_smartcols],
2728 dependencies : mq_libs,
2729 install_dir : usrbin_exec_dir,
2730 install : true)
2731 if not is_disabler(exe)
2732 exes += exe
2733 manadocs += ['misc-utils/lsfd.1.adoc']
2734 endif
2735
2736 exe = executable(
2737 'uuidgen',
2738 uuidgen_sources,
2739 include_directories : includes,
2740 link_with : [lib_common,
2741 lib_uuid],
2742 install_dir : usrbin_exec_dir,
2743 install : true)
2744 if not is_disabler(exe)
2745 exes += exe
2746 manadocs += ['misc-utils/uuidgen.1.adoc']
2747 bashcompletions += ['uuidgen']
2748 endif
2749
2750 exe = executable(
2751 'uuidparse',
2752 uuidparse_sources,
2753 include_directories : includes,
2754 link_with : [lib_common,
2755 lib_uuid,
2756 lib_smartcols],
2757 install_dir : usrbin_exec_dir,
2758 install : true)
2759 if not is_disabler(exe)
2760 exes += exe
2761 manadocs += ['misc-utils/uuidparse.1.adoc']
2762 bashcompletions += ['uuidparse']
2763 endif
2764
2765 opt = build_uuidd
2766 exe = executable(
2767 'uuidd',
2768 uuidd_sources,
2769 include_directories : includes,
2770 link_with : [lib_common,
2771 lib_uuid],
2772 dependencies : [realtime_libs,
2773 lib_systemd],
2774 install_dir : usrsbin_exec_dir,
2775 install : opt,
2776 build_by_default : opt)
2777 exe2 = executable(
2778 'test_uuidd',
2779 test_uuidd_sources,
2780 include_directories : includes,
2781 link_with : [lib_common,
2782 lib_uuid],
2783 dependencies : thread_libs,
2784 build_by_default : opt and program_tests)
2785 if not is_disabler(exe)
2786 exes += [exe, exe2]
2787 manadocs += ['misc-utils/uuidd.8.adoc']
2788 bashcompletions += ['uuidd']
2789 endif
2790
2791 opt = build_libblkid
2792 exe = executable(
2793 'blkid',
2794 blkid_sources,
2795 include_directories : includes,
2796 link_with : [lib_common,
2797 lib_blkid],
2798 install_dir : sbindir,
2799 install : opt,
2800 build_by_default : opt)
2801 if opt and not is_disabler(exe)
2802 exes += exe
2803 manadocs += ['misc-utils/blkid.8.adoc']
2804 bashcompletions += ['blkid']
2805 endif
2806
2807 opt = opt and 'blkid' in static_programs
2808 exe = executable(
2809 'blkid.static',
2810 blkid_sources,
2811 include_directories : includes,
2812 link_with : [lib_common,
2813 lib_blkid_static],
2814 install_dir : sbindir,
2815 install : opt,
2816 build_by_default : opt)
2817 if opt and not is_disabler(exe)
2818 exes += exe
2819 endif
2820
2821 exe = executable(
2822 'sample-mkfs',
2823 'libblkid/samples/mkfs.c',
2824 include_directories : includes,
2825 link_with : lib_blkid)
2826 if not is_disabler(exe)
2827 exes += exe
2828 endif
2829
2830 exe = executable(
2831 'sample-partitions',
2832 'libblkid/samples/partitions.c',
2833 include_directories : includes,
2834 link_with : lib_blkid)
2835 if not is_disabler(exe)
2836 exes += exe
2837 endif
2838
2839 exe = executable(
2840 'sample-superblocks',
2841 'libblkid/samples/superblocks.c',
2842 include_directories : includes,
2843 link_with : lib_blkid)
2844 if not is_disabler(exe)
2845 exes += exe
2846 endif
2847
2848 exe = executable(
2849 'sample-topology',
2850 'libblkid/samples/topology.c',
2851 include_directories : includes,
2852 link_with : lib_blkid)
2853 if not is_disabler(exe)
2854 exes += exe
2855 endif
2856
2857 exe = executable(
2858 'test_blkid_fuzz_sample',
2859 'libblkid/src/fuzz.c',
2860 include_directories: includes,
2861 link_with: lib_blkid,
2862 build_by_default: program_tests)
2863 if not is_disabler(exe)
2864 exes += exe
2865 endif
2866
2867 ############################################################
2868
2869 exe = executable(
2870 'findfs',
2871 findfs_sources,
2872 include_directories : includes,
2873 link_with : [lib_blkid],
2874 install_dir : sbindir,
2875 install : true)
2876 if not is_disabler(exe)
2877 exes += exe
2878 manadocs += ['misc-utils/findfs.8.adoc']
2879 bashcompletions += ['findfs']
2880 endif
2881
2882 exe = executable(
2883 'wipefs',
2884 wipefs_sources,
2885 include_directories : includes,
2886 link_with : [lib_common,
2887 lib_blkid,
2888 lib_smartcols],
2889 install_dir : sbindir,
2890 install : true)
2891 if not is_disabler(exe)
2892 exes += exe
2893 manadocs += ['misc-utils/wipefs.8.adoc']
2894 bashcompletions += ['wipefs']
2895 endif
2896
2897 exe = executable(
2898 'findmnt',
2899 findmnt_sources,
2900 include_directories : includes,
2901 link_with : [lib_common,
2902 lib_blkid,
2903 lib_mount,
2904 lib_smartcols],
2905 dependencies : [lib_udev],
2906 install : true)
2907 if not is_disabler(exe)
2908 exes += exe
2909 manadocs += ['misc-utils/findmnt.8.adoc']
2910 bashcompletions += ['findmnt']
2911 endif
2912
2913 exe = executable(
2914 'kill',
2915 kill_sources,
2916 include_directories : includes,
2917 link_with : [lib_common],
2918 install : true)
2919 if not is_disabler(exe)
2920 exes += exe
2921 manadocs += ['misc-utils/kill.1.adoc']
2922 endif
2923
2924 opt = not get_option('build-rename').disabled()
2925 exe = executable(
2926 'rename',
2927 rename_sources,
2928 include_directories : includes,
2929 install_dir : usrbin_exec_dir,
2930 install : opt,
2931 build_by_default : opt)
2932 if opt and not is_disabler(exe)
2933 exes += exe
2934 manadocs += ['misc-utils/rename.1.adoc']
2935 bashcompletions += ['rename']
2936 endif
2937
2938 exe = executable(
2939 'getopt',
2940 getopt_sources,
2941 include_directories : includes,
2942 link_with : [lib_common],
2943 install_dir : usrbin_exec_dir,
2944 install : true)
2945 exes += exe
2946 manadocs += ['misc-utils/getopt.1.adoc']
2947 bashcompletions += ['getopt']
2948
2949 exe = executable(
2950 'fincore',
2951 fincore_sources,
2952 include_directories : includes,
2953 link_with : [lib_common,
2954 lib_smartcols],
2955 install_dir : usrbin_exec_dir,
2956 install : true)
2957 if not is_disabler(exe)
2958 exes += exe
2959 manadocs += ['misc-utils/fincore.1.adoc']
2960 bashcompletions += ['fincore']
2961 endif
2962
2963 exe = executable(
2964 'hardlink',
2965 hardlink_sources,
2966 include_directories : includes,
2967 link_with : [lib_common],
2968 install_dir : usrbin_exec_dir,
2969 install : true)
2970 if not is_disabler(exe)
2971 exes += exe
2972 manadocs += ['misc-utils/hardlink.1.adoc']
2973 bashcompletions += ['hardlink']
2974 endif
2975
2976 opt = not get_option('build-pipesz').disabled()
2977 exe = executable(
2978 'pipesz',
2979 pipesz_sources,
2980 include_directories : includes,
2981 link_with : [lib_common],
2982 install_dir : usrbin_exec_dir,
2983 install : true)
2984 if opt and not is_disabler(exe)
2985 exes += exe
2986 manadocs += ['misc-utils/pipesz.1.adoc']
2987 bashcompletions += ['pipesz']
2988 endif
2989
2990 exe = executable(
2991 'test_cal',
2992 cal_sources,
2993 include_directories : includes,
2994 c_args : '-DTEST_CAL',
2995 link_with : [lib_common,
2996 lib_tcolors],
2997 dependencies : [curses_libs],
2998 build_by_default: program_tests)
2999 if not is_disabler(exe)
3000 exes += exe
3001 endif
3002
3003 exe = executable(
3004 'fadvise',
3005 fadvise_sources,
3006 include_directories : includes,
3007 link_with : [lib_common],
3008 install_dir : usrbin_exec_dir,
3009 install : true)
3010 if not is_disabler(exe)
3011 exes += exe
3012 manadocs += ['misc-utils/fadvise.1.adoc']
3013 bashcompletions += ['fadvise']
3014 endif
3015
3016 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3017 exe = executable(
3018 'waitpid',
3019 waitpid_sources,
3020 include_directories : includes,
3021 link_with : [lib_common],
3022 install_dir : usrbin_exec_dir,
3023 install : true)
3024 if not is_disabler(exe)
3025 exes += exe
3026 manadocs += ['misc-utils/waitpid.1.adoc']
3027 bashcompletions += ['waitpid']
3028 endif
3029 endif
3030
3031 syscalls_h = custom_target('syscalls.h',
3032 input : 'tools/all_syscalls',
3033 output : 'syscalls.h',
3034 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3035 )
3036
3037 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3038 exe = executable(
3039 'enosys',
3040 'misc-utils/enosys.c', syscalls_h, errnos_h,
3041 include_directories : includes,
3042 link_with : [lib_common],
3043 install_dir : usrbin_exec_dir,
3044 install : true)
3045 if not is_disabler(exe)
3046 exes += exe
3047 manadocs += ['misc-utils/enosys.1.adoc']
3048 bashcompletions += ['enosys']
3049 endif
3050 endif
3051
3052 exe = executable(
3053 'lsclocks',
3054 lsclocks_sources,
3055 include_directories : includes,
3056 link_with : [lib_common, lib_smartcols],
3057 install_dir : usrbin_exec_dir,
3058 install : true)
3059 if not is_disabler(exe)
3060 exes += exe
3061 manadocs += ['misc-utils/lsclocks.1.adoc']
3062 bashcompletions += ['lsclocks']
3063 endif
3064
3065 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3066 exe = executable(
3067 'exch',
3068 exch_sources,
3069 include_directories : includes,
3070 link_with : [lib_common],
3071 install_dir : usrbin_exec_dir,
3072 install : true)
3073 if not is_disabler(exe)
3074 exes += exe
3075 manadocs += ['misc-utils/exch.1.adoc']
3076 bashcompletions += ['exch']
3077 endif
3078 endif
3079
3080 ############################################################
3081
3082 opt = not get_option('build-schedutils').disabled()
3083 exe = executable(
3084 'chrt',
3085 'schedutils/chrt.c',
3086 include_directories : includes,
3087 link_with : lib_common,
3088 install_dir : usrbin_exec_dir,
3089 install : opt,
3090 build_by_default : opt)
3091
3092 exe2 = executable(
3093 'ionice',
3094 'schedutils/ionice.c',
3095 include_directories : includes,
3096 link_with : lib_common,
3097 install_dir : usrbin_exec_dir,
3098 install : opt,
3099 build_by_default : opt)
3100
3101 exe3 = executable(
3102 'taskset',
3103 'schedutils/taskset.c',
3104 include_directories : includes,
3105 link_with : lib_common,
3106 install_dir : usrbin_exec_dir,
3107 install : opt,
3108 build_by_default : opt)
3109
3110 exe4 = executable(
3111 'uclampset',
3112 'schedutils/uclampset.c',
3113 include_directories : includes,
3114 link_with : lib_common,
3115 install_dir : usrbin_exec_dir,
3116 install : opt,
3117 build_by_default : opt)
3118
3119 if opt and not is_disabler(exe)
3120 exes += [exe, exe2, exe3, exe4]
3121 manadocs += ['schedutils/chrt.1.adoc',
3122 'schedutils/ionice.1.adoc',
3123 'schedutils/taskset.1.adoc',
3124 'schedutils/uclampset.1.adoc']
3125 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3126 endif
3127
3128 ############################################################
3129
3130 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3131
3132 exe = executable(
3133 'test_ttyutils',
3134 'lib/ttyutils.c',
3135 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3136 include_directories : dir_include,
3137 link_with : lib_common,
3138 build_by_default: program_tests)
3139 exes += exe
3140
3141 exe = executable(
3142 'test_blkdev',
3143 'lib/blkdev.c',
3144 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3145 include_directories : dir_include,
3146 link_with : lib_common,
3147 build_by_default: program_tests)
3148 exes += exe
3149
3150 exe = executable(
3151 'test_ismounted',
3152 'lib/ismounted.c',
3153 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3154 include_directories : dir_include,
3155 link_with : lib_common,
3156 build_by_default: program_tests)
3157 exes += exe
3158
3159 exe = executable(
3160 'test_mangle',
3161 'lib/mangle.c',
3162 c_args : ['-DTEST_PROGRAM_MANGLE'],
3163 include_directories : dir_include,
3164 build_by_default: program_tests)
3165 exes += exe
3166
3167 exe = executable(
3168 'test_strutils',
3169 'lib/strutils.c',
3170 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3171 include_directories : dir_include,
3172 build_by_default: program_tests)
3173 exes += exe
3174
3175 exe = executable(
3176 'test_colors',
3177 'lib/colors.c',
3178 'lib/color-names.c',
3179 c_args : ['-DTEST_PROGRAM_COLORS'],
3180 include_directories : dir_include,
3181 link_with : [lib_common, lib_tcolors],
3182 build_by_default: program_tests)
3183 exes += exe
3184
3185 exe = executable(
3186 'test_randutils',
3187 'lib/randutils.c',
3188 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3189 include_directories : dir_include,
3190 build_by_default: program_tests)
3191 exes += exe
3192
3193 if conf.get('HAVE_OPENAT').to_string() == '1' \
3194 and conf.get('HAVE_DIRFD').to_string() == '1'
3195 exe = executable(
3196 'test_procfs',
3197 'lib/procfs.c',
3198 c_args : ['-DTEST_PROGRAM_PROCFS'],
3199 include_directories : dir_include,
3200 link_with : lib_common,
3201 build_by_default: program_tests)
3202 exes += exe
3203
3204 exe = executable(
3205 'test_path',
3206 'lib/path.c',
3207 'lib/fileutils.c',
3208 have_cpu_set_t ? 'lib/cpuset.c' : [],
3209 c_args : ['-DTEST_PROGRAM_PATH'],
3210 include_directories : dir_include,
3211 link_with : lib_common,
3212 build_by_default: program_tests)
3213 exes += exe
3214 endif
3215
3216 if conf.get('HAVE_PTY').to_string() == '1'
3217 exe = executable(
3218 'test_pty',
3219 pty_session_c,
3220 monotonic_c,
3221 c_args : ['-DTEST_PROGRAM_PTY'],
3222 include_directories : dir_include,
3223 link_with : [lib_common],
3224 dependencies : [lib_m,
3225 realtime_libs,
3226 lib_util],
3227 build_by_default: program_tests)
3228 exes += exe
3229 endif
3230
3231 if LINUX
3232 exe = executable(
3233 'test_cpuset',
3234 'lib/cpuset.c',
3235 c_args : ['-DTEST_PROGRAM_CPUSET'],
3236 include_directories : dir_include,
3237 build_by_default: program_tests)
3238 exes += exe
3239 endif
3240
3241 exe = executable(
3242 'test_sysfs',
3243 'lib/sysfs.c',
3244 'lib/path.c',
3245 'lib/buffer.c',
3246 'lib/mbsalign.c',
3247 'lib/fileutils.c',
3248 have_cpu_set_t ? 'lib/cpuset.c' : [],
3249 c_args : ['-DTEST_PROGRAM_SYSFS'],
3250 include_directories : dir_include,
3251 build_by_default: program_tests)
3252 exes += exe
3253
3254 exe = executable(
3255 'test_pager',
3256 'lib/pager.c',
3257 c_args : ['-DTEST_PROGRAM_PAGER'],
3258 include_directories : dir_include,
3259 build_by_default: program_tests)
3260 exes += exe
3261
3262 exe = executable(
3263 'test_linux_version',
3264 'lib/linux_version.c',
3265 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3266 include_directories : dir_include,
3267 build_by_default: program_tests)
3268 exes += exe
3269
3270 exe = executable(
3271 'test_fileutils',
3272 'lib/fileutils.c',
3273 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3274 include_directories : dir_include,
3275 build_by_default: program_tests)
3276 exes += exe
3277
3278 exe = executable(
3279 'test_canonicalize',
3280 'lib/canonicalize.c',
3281 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3282 include_directories : dir_include,
3283 build_by_default: program_tests)
3284 exes += exe
3285
3286 exe = executable(
3287 'test_timeutils',
3288 'lib/timeutils.c',
3289 'lib/strutils.c',
3290 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3291 include_directories : dir_include,
3292 build_by_default: program_tests)
3293 exes += exe
3294
3295 exe = executable(
3296 'test_pwdutils',
3297 'lib/pwdutils.c',
3298 c_args : ['-DTEST_PROGRAM'],
3299 include_directories : dir_include,
3300 link_with : lib_common,
3301 build_by_default: program_tests)
3302 exes += exe
3303
3304 exe = executable(
3305 'test_logindefs',
3306 'lib/logindefs.c',
3307 c_args : ['-DTEST_PROGRAM'],
3308 include_directories : dir_include,
3309 link_with : [lib_common, logindefs_c],
3310 build_by_default: program_tests)
3311 exes += exe
3312
3313
3314 ############################################################
3315
3316 exe = executable(
3317 'test_uuid_parser',
3318 'libuuid/src/test_uuid.c',
3319 include_directories : [dir_include, dir_libuuid],
3320 link_with : lib_uuid,
3321 dependencies : socket_libs,
3322 build_by_default: program_tests)
3323 if not is_disabler(exe)
3324 exes += exe
3325 endif
3326
3327 ############################################################
3328
3329 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3330 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3331
3332 exe = executable(
3333 'test_fdisk_ask',
3334 'libfdisk/src/ask.c',
3335 c_args : libfdisk_tests_cflags,
3336 include_directories : lib_fdisk_includes,
3337 link_with : libfdisk_tests_ldadd,
3338 build_by_default: program_tests)
3339 if not is_disabler(exe)
3340 exes += exe
3341 endif
3342
3343 exe = executable(
3344 'test_fdisk_gpt',
3345 'libfdisk/src/gpt.c',
3346 c_args : libfdisk_tests_cflags,
3347 include_directories : lib_fdisk_includes,
3348 link_with : libfdisk_tests_ldadd,
3349 build_by_default: program_tests)
3350 if not is_disabler(exe)
3351 exes += exe
3352 endif
3353
3354 exe = executable(
3355 'test_fdisk_utils',
3356 'libfdisk/src/utils.c',
3357 c_args : libfdisk_tests_cflags,
3358 include_directories : lib_fdisk_includes,
3359 link_with : libfdisk_tests_ldadd,
3360 build_by_default: program_tests)
3361 if not is_disabler(exe)
3362 exes += exe
3363 endif
3364
3365 exe = executable(
3366 'test_fdisk_script',
3367 'libfdisk/src/script.c',
3368 c_args : libfdisk_tests_cflags,
3369 include_directories : lib_fdisk_includes,
3370 link_with : libfdisk_tests_ldadd,
3371 build_by_default: program_tests)
3372 if not is_disabler(exe)
3373 exes += exe
3374 endif
3375
3376 exe = executable(
3377 'test_fdisk_version',
3378 'libfdisk/src/version.c',
3379 c_args : libfdisk_tests_cflags,
3380 include_directories : lib_fdisk_includes,
3381 link_with : libfdisk_tests_ldadd,
3382 build_by_default: program_tests)
3383 if not is_disabler(exe)
3384 exes += exe
3385 endif
3386
3387 exe = executable(
3388 'test_fdisk_item',
3389 'libfdisk/src/item.c',
3390 c_args : libfdisk_tests_cflags,
3391 include_directories : lib_fdisk_includes,
3392 link_with : libfdisk_tests_ldadd,
3393 build_by_default: program_tests)
3394 if not is_disabler(exe)
3395 exes += exe
3396 endif
3397
3398 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3399
3400 exe = executable(
3401 'sample-fdisk-mkpart',
3402 'libfdisk/samples/mkpart.c',
3403 include_directories : lib_fdisk_includes,
3404 link_with : sample_fdisk_ldadd)
3405 if not is_disabler(exe)
3406 exes += exe
3407 endif
3408
3409 exe = executable(
3410 'sample-fdisk-mkpart-fullspec',
3411 'libfdisk/samples/mkpart-fullspec.c',
3412 include_directories : lib_fdisk_includes,
3413 link_with : sample_fdisk_ldadd)
3414 if not is_disabler(exe)
3415 exes += exe
3416 endif
3417
3418 ############################################################
3419
3420 exe = executable(
3421 'test_cap',
3422 'tests/helpers/test_cap.c',
3423 include_directories : includes,
3424 dependencies : [lib_cap_ng],
3425 build_by_default: program_tests)
3426 if not is_disabler(exe)
3427 exes += exe
3428 endif
3429
3430 exe = executable(
3431 'test_mbsencode',
3432 'tests/helpers/test_mbsencode.c',
3433 include_directories : includes,
3434 link_with : lib_common,
3435 build_by_default: program_tests)
3436 exes += exe
3437
3438 exe = executable(
3439 'test_byteswap',
3440 'tests/helpers/test_byteswap.c',
3441 include_directories : includes,
3442 build_by_default: program_tests)
3443 exes += exe
3444
3445 exe = executable(
3446 'test_md5',
3447 'tests/helpers/test_md5.c',
3448 md5_c,
3449 include_directories : includes,
3450 build_by_default: program_tests)
3451 exes += exe
3452
3453 exe = executable(
3454 'test_sha1',
3455 'tests/helpers/test_sha1.c',
3456 sha1_c,
3457 include_directories : includes,
3458 build_by_default: program_tests)
3459 exes += exe
3460
3461 exe = executable(
3462 'test_pathnames',
3463 'tests/helpers/test_pathnames.c',
3464 include_directories : includes,
3465 build_by_default: program_tests)
3466 exes += exe
3467
3468 exe = executable(
3469 'test_strerror',
3470 'tests/helpers/test_strerror.c',
3471 include_directories : includes,
3472 build_by_default: program_tests)
3473 exes += exe
3474
3475 exe = executable(
3476 'test_sysinfo',
3477 'tests/helpers/test_sysinfo.c',
3478 include_directories : includes,
3479 build_by_default: program_tests)
3480 exes += exe
3481
3482 exe = executable(
3483 'test_sigreceive',
3484 'tests/helpers/test_sigreceive.c',
3485 include_directories : includes,
3486 link_with : lib_common,
3487 build_by_default: program_tests)
3488 exes += exe
3489
3490 exe = executable(
3491 'test_tiocsti',
3492 'tests/helpers/test_tiocsti.c',
3493 include_directories : includes,
3494 build_by_default: program_tests)
3495 exes += exe
3496
3497 exe = executable(
3498 'test_uuid_namespace',
3499 'tests/helpers/test_uuid_namespace.c',
3500 predefined_c,
3501 unpack_c,
3502 unparse_c,
3503 include_directories : includes,
3504 build_by_default: program_tests)
3505 exes += exe
3506
3507 if LINUX
3508 exe = executable(
3509 'test_mkfds',
3510 'tests/helpers/test_mkfds.c',
3511 'tests/helpers/test_mkfds.h',
3512 'tests/helpers/test_mkfds_ppoll.c',
3513 include_directories : includes,
3514 dependencies : mq_libs,
3515 build_by_default: program_tests)
3516 exes += exe
3517 endif
3518
3519 exe = executable(
3520 'test_enosys',
3521 'tests/helpers/test_enosys.c',
3522 include_directories : includes,
3523 build_by_default: program_tests)
3524 exes += exe
3525
3526 ############################################################
3527
3528 if conf.get('HAVE_OPENAT').to_string() == '1'
3529 exe = executable(
3530 'sample-scols-tree',
3531 'libsmartcols/samples/tree.c',
3532 include_directories : includes,
3533 link_with : [lib_smartcols, lib_common],
3534 build_by_default: program_tests)
3535 if not is_disabler(exe)
3536 exes += exe
3537 endif
3538 endif
3539
3540 exe = executable(
3541 'sample-scols-title',
3542 'libsmartcols/samples/title.c',
3543 include_directories : includes,
3544 link_with : [lib_smartcols, lib_common])
3545 if not is_disabler(exe)
3546 exes += exe
3547 endif
3548
3549 exe = executable(
3550 'sample-scols-wrap',
3551 'libsmartcols/samples/wrap.c',
3552 include_directories : includes,
3553 link_with : [lib_smartcols, lib_common])
3554 if not is_disabler(exe)
3555 exes += exe
3556 endif
3557
3558 exe = executable(
3559 'sample-scols-continuous',
3560 'libsmartcols/samples/continuous.c',
3561 include_directories : includes,
3562 link_with : [lib_smartcols, lib_common])
3563 if not is_disabler(exe)
3564 exes += exe
3565 endif
3566
3567 exe = executable(
3568 'sample-scols-continuous-json',
3569 'libsmartcols/samples/continuous-json.c',
3570 include_directories : includes,
3571 link_with : [lib_smartcols, lib_common])
3572 if not is_disabler(exe)
3573 exes += exe
3574 endif
3575
3576 exe = executable(
3577 'sample-scols-maxout',
3578 'libsmartcols/samples/maxout.c',
3579 include_directories : includes,
3580 link_with : [lib_smartcols, lib_common])
3581 if not is_disabler(exe)
3582 exes += exe
3583 endif
3584
3585 exe = executable(
3586 'sample-scols-fromfile',
3587 'libsmartcols/samples/fromfile.c',
3588 include_directories : includes,
3589 link_with : [lib_smartcols, lib_common])
3590 if not is_disabler(exe)
3591 exes += exe
3592 endif
3593
3594 exe = executable(
3595 'sample-scols-grouping-simple',
3596 'libsmartcols/samples/grouping-simple.c',
3597 include_directories : includes,
3598 link_with : [lib_smartcols, lib_common])
3599 if not is_disabler(exe)
3600 exes += exe
3601 endif
3602
3603 exe = executable(
3604 'sample-scols-grouping-overlay',
3605 'libsmartcols/samples/grouping-overlay.c',
3606 include_directories : includes,
3607 link_with : [lib_smartcols, lib_common])
3608 if not is_disabler(exe)
3609 exes += exe
3610 endif
3611
3612 exe = executable(
3613 'test_boilerplate',
3614 'Documentation/boilerplate.c',
3615 include_directories : includes,
3616 build_by_default: program_tests)
3617 if not is_disabler(exe)
3618 exes += exe
3619 endif
3620
3621 ############################################################
3622
3623 # Let the test runner know whether we're running under asan and export
3624 # some paths. We use a file on disk so that it is possible to run the
3625 # test scripts from commandline without setting any variables.
3626 configure_file(output : 'meson.conf',
3627 capture : true,
3628 command : ['echo',
3629 '''asan=@0@
3630 PYTHON=@1@
3631 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3632 python.full_path())])
3633
3634 run_sh = find_program('tests/run.sh')
3635 run_target(
3636 'check',
3637 command : [run_sh,
3638 '--srcdir=' + meson.current_source_dir(),
3639 '--builddir=' + meson.current_build_dir(),
3640 '--parallel',
3641 '--nonroot'],
3642 depends : exes)
3643
3644
3645 manadocs += ['lib/terminal-colors.d.5.adoc']
3646 manadocs += ['libblkid/libblkid.3.adoc']
3647
3648 if build_libuuid
3649 manadocs += [
3650 'libuuid/man/uuid.3.adoc',
3651 'libuuid/man/uuid_clear.3.adoc',
3652 'libuuid/man/uuid_compare.3.adoc',
3653 'libuuid/man/uuid_copy.3.adoc',
3654 'libuuid/man/uuid_generate.3.adoc',
3655 'libuuid/man/uuid_is_null.3.adoc',
3656 'libuuid/man/uuid_parse.3.adoc',
3657 'libuuid/man/uuid_time.3.adoc',
3658 'libuuid/man/uuid_unparse.3.adoc']
3659 manlinks += {
3660 'uuid_generate_random.3': 'uuid_generate.3',
3661 'uuid_generate_time.3': 'uuid_generate.3',
3662 'uuid_generate_time_safe.3': 'uuid_generate.3',
3663 }
3664 endif
3665
3666 asciidoctor = find_program('asciidoctor', required : false)
3667 if asciidoctor.found()
3668 foreach adoc : manadocs
3669 name = adoc.split('/')[-1]
3670 page = name.split('.adoc')[0]
3671 section = page.split('.')[-1]
3672 mandirn = join_paths(mandir, 'man' + section)
3673 input = adoc
3674
3675 custom_target(
3676 page,
3677 command : [ asciidoctor,
3678 '-b', 'manpage',
3679 '-a', 'VERSION=' + meson.project_version(),
3680 '-a', 'release-version=' + meson.project_version(),
3681 '-a', 'ADJTIME_PATH=/etc/adjtime',
3682 '-a', 'package-docdir=' + docdir,
3683 '--base-dir=' + meson.current_source_dir(),
3684 '--destination-dir=' + meson.current_build_dir(),
3685 '--load-path', '@SOURCE_ROOT@/tools',
3686 '--require', 'asciidoctor-includetracker',
3687 '@INPUT@'],
3688 input : input,
3689 output : [page],
3690 depfile : page + '.deps',
3691 install: true,
3692 install_dir : mandirn)
3693 endforeach
3694
3695 foreach link_name, target : manlinks
3696 link_section = link_name.split('.')[-1]
3697 target_section = target.split('.')[-1]
3698 meson.add_install_script(meson_make_manpage_stub,
3699 join_paths('man' + target_section, target),
3700 join_paths(mandir, 'man' + link_section, link_name))
3701 endforeach
3702 endif
3703
3704 if bash_completion.found()
3705 foreach completion : bashcompletions
3706 install_data(
3707 join_paths('bash-completion', completion),
3708 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3709 )
3710 endforeach
3711 foreach link_name, target : bashcompletionslinks
3712 meson.add_install_script(meson_make_symlink,
3713 target,
3714 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))
3715 endforeach
3716 endif