]> git.ipfire.org Git - thirdparty/util-linux.git/blob - meson.build
Merge branch 'master' of https://github.com/BinBashBanana/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 opt = opt and 'partx' in static_programs
2401 exe = executable(
2402 'addpart.static',
2403 addpart_sources,
2404 include_directories : includes,
2405 link_args : ['--static'],
2406 link_with : [lib_common],
2407 install_dir : usrsbin_exec_dir,
2408 install : opt,
2409 build_by_default : opt)
2410 exe2 = executable(
2411 'delpart.static',
2412 delpart_sources,
2413 include_directories : includes,
2414 link_args : ['--static'],
2415 link_with : [lib_common],
2416 install_dir : usrsbin_exec_dir,
2417 install : opt,
2418 build_by_default : opt)
2419 exe3 = executable(
2420 'resizepart.static',
2421 resizepart_sources,
2422 include_directories : includes,
2423 link_args : ['--static'],
2424 link_with : [lib_common],
2425 install_dir : usrsbin_exec_dir,
2426 install : opt,
2427 build_by_default : opt)
2428 exe4 = executable(
2429 'partx.static',
2430 partx_sources,
2431 include_directories : includes,
2432 link_args : ['--static'],
2433 link_with : [lib_common,
2434 lib_blkid.get_static_lib(),
2435 lib_smartcols.get_static_lib()],
2436 install_dir : usrsbin_exec_dir,
2437 install : opt,
2438 build_by_default : opt)
2439
2440 if opt
2441 exes += [exe, exe2, exe3, exe4]
2442 endif
2443
2444 ############################################################
2445
2446 exe = executable(
2447 'script',
2448 script_sources,
2449 include_directories : includes,
2450 link_with : [lib_common],
2451 dependencies : [lib_util,
2452 lib_utempter,
2453 realtime_libs,
2454 math_libs],
2455 install_dir : usrbin_exec_dir,
2456 install : true)
2457 exes += exe
2458 manadocs += ['term-utils/script.1.adoc']
2459 bashcompletions += ['script']
2460
2461 exe = executable(
2462 'test_script',
2463 script_sources,
2464 include_directories : includes,
2465 c_args : '-DTEST_SCRIPT',
2466 link_with : [lib_common],
2467 dependencies : [lib_util,
2468 lib_utempter,
2469 realtime_libs,
2470 math_libs],
2471 build_by_default : program_tests)
2472 exes += exe
2473
2474 exe = executable(
2475 'scriptlive',
2476 scriptlive_sources,
2477 include_directories : includes,
2478 link_with : [lib_common],
2479 dependencies : [lib_util,
2480 realtime_libs,
2481 math_libs],
2482 install_dir : usrbin_exec_dir,
2483 install : true)
2484 exes += exe
2485 manadocs += ['term-utils/scriptlive.1.adoc']
2486 bashcompletions += ['scriptlive']
2487
2488 exe = executable(
2489 'scriptreplay',
2490 scriptreplay_sources,
2491 include_directories : includes,
2492 link_with : [lib_common],
2493 dependencies : [math_libs],
2494 install_dir : usrbin_exec_dir,
2495 install : true)
2496 exes += exe
2497 manadocs += ['term-utils/scriptreplay.1.adoc']
2498 bashcompletions += ['scriptreplay']
2499
2500 opt = not get_option('build-agetty').disabled()
2501 exe = executable(
2502 'agetty',
2503 agetty_sources,
2504 include_directories : includes,
2505 link_with : [lib_common, logindefs_c],
2506 dependencies : [BSD ? lib_util : [], lib_systemd],
2507 install_dir : sbindir,
2508 install : opt,
2509 build_by_default : opt)
2510 if opt
2511 exes += exe
2512 manadocs += ['term-utils/agetty.8.adoc']
2513 endif
2514
2515 opt = not get_option('build-setterm').disabled()
2516 exe = executable(
2517 'setterm',
2518 setterm_sources,
2519 include_directories : includes,
2520 link_with : [lib_common],
2521 dependencies : [curses_libs],
2522 install_dir : usrbin_exec_dir,
2523 install : opt,
2524 build_by_default : opt)
2525 if opt
2526 exes += exe
2527 manadocs += ['term-utils/setterm.1.adoc']
2528 bashcompletions += ['setterm']
2529 endif
2530
2531 opt = not get_option('build-mesg').disabled()
2532 exe = executable(
2533 'mesg',
2534 mesg_sources,
2535 include_directories : includes,
2536 link_with : [lib_common],
2537 install_dir : usrbin_exec_dir,
2538 install : opt,
2539 build_by_default : opt)
2540 if opt
2541 exes += exe
2542 manadocs += ['term-utils/mesg.1.adoc']
2543 bashcompletions += ['mesg']
2544 endif
2545
2546 opt = not get_option('build-wall').disabled()
2547 exe = executable(
2548 'wall',
2549 wall_sources,
2550 include_directories : includes,
2551 link_with : [lib_common],
2552 dependencies : [lib_systemd],
2553 install_dir : usrbin_exec_dir,
2554 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2555 install : opt,
2556 build_by_default : opt)
2557 if opt
2558 exes += exe
2559 manadocs += ['term-utils/wall.1.adoc']
2560 bashcompletions += ['wall']
2561 endif
2562
2563 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2564 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2565
2566 opt = not get_option('build-write').disabled()
2567 exe = executable(
2568 'write',
2569 write_sources,
2570 include_directories : includes,
2571 link_with : [lib_common],
2572 dependencies : [lib_systemd],
2573 install_dir : usrbin_exec_dir,
2574 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2575 install : opt,
2576 build_by_default : opt)
2577 if opt
2578 exes += exe
2579 manadocs += ['term-utils/write.1.adoc']
2580 bashcompletions += ['write']
2581 endif
2582
2583 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2584 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2585
2586 opt = not get_option('build-login').disabled()
2587 exe = executable(
2588 'login',
2589 login_sources,
2590 include_directories : includes,
2591 link_with : [lib_common, logindefs_c],
2592 dependencies : [lib_pam,
2593 lib_audit,
2594 lib_selinux],
2595 install : opt,
2596 build_by_default : opt)
2597 if not is_disabler(exe)
2598 exes += exe
2599 manadocs += ['login-utils/login.1.adoc']
2600 endif
2601
2602 opt = not get_option('build-sulogin').disabled()
2603 exe = executable(
2604 'sulogin',
2605 sulogin_sources,
2606 include_directories : includes,
2607 link_with : [lib_common],
2608 dependencies : [lib_crypt,
2609 lib_selinux],
2610 install_dir : sbindir,
2611 install : opt,
2612 build_by_default : opt)
2613 if not is_disabler(exe)
2614 exes += exe
2615 manadocs += ['login-utils/sulogin.8.adoc']
2616 endif
2617
2618 exe = executable(
2619 'cal',
2620 cal_sources,
2621 include_directories : includes,
2622 link_with : [lib_common,
2623 lib_tcolors],
2624 dependencies : [curses_libs],
2625 install_dir : usrbin_exec_dir,
2626 install : true)
2627 exes += exe
2628 manadocs += ['misc-utils/cal.1.adoc']
2629 bashcompletions += ['cal']
2630
2631 opt = not get_option('build-logger').disabled()
2632 exe = executable(
2633 'logger',
2634 logger_sources,
2635 include_directories : includes,
2636 link_with : [lib_common],
2637 dependencies : [lib_systemd],
2638 install_dir : usrbin_exec_dir,
2639 install : opt,
2640 build_by_default : opt)
2641 if opt and not is_disabler(exe)
2642 exes += exe
2643 manadocs += ['misc-utils/logger.1.adoc']
2644 bashcompletions += ['logger']
2645 endif
2646
2647 exe = executable(
2648 'test_logger',
2649 logger_sources,
2650 include_directories : includes,
2651 c_args : '-DTEST_LOGGER',
2652 link_with : [lib_common],
2653 dependencies : [lib_systemd],
2654 build_by_default: program_tests)
2655 if not is_disabler(exe)
2656 exes += exe
2657 endif
2658
2659 exe = executable(
2660 'look',
2661 look_sources,
2662 include_directories : includes,
2663 install_dir : usrbin_exec_dir,
2664 install : true)
2665 exes += exe
2666 manadocs += ['misc-utils/look.1.adoc']
2667 bashcompletions += ['look']
2668
2669 exe = executable(
2670 'mcookie',
2671 mcookie_sources,
2672 include_directories : includes,
2673 link_with : [lib_common],
2674 install_dir : usrbin_exec_dir,
2675 install : true)
2676 exes += exe
2677 manadocs += ['misc-utils/mcookie.1.adoc']
2678 bashcompletions += ['mcookie']
2679
2680 if build_liblastlog2
2681 exe = executable(
2682 'lastlog2',
2683 lastlog2_sources,
2684 include_directories : includes,
2685 link_with : [lib_common, lib_lastlog2],
2686 install_dir : usrbin_exec_dir,
2687 install : true)
2688 exes += exe
2689 manadocs += ['misc-utils/lastlog2.8.adoc']
2690 bashcompletions += ['lastlog2']
2691 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2692 'liblastlog2/man/ll2_write_entry.3.adoc',
2693 'liblastlog2/man/ll2_read_entry.3.adoc',
2694 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2695 'liblastlog2/man/ll2_read_all.3.adoc',
2696 'liblastlog2/man/ll2_remove_entry.3.adoc',
2697 'liblastlog2/man/ll2_rename_user.3.adoc',
2698 'liblastlog2/man/ll2_update_login_time.3.adoc'
2699 ]
2700 endif
2701
2702 exe = executable(
2703 'namei',
2704 namei_sources,
2705 include_directories : includes,
2706 dependencies : [lib_selinux],
2707 install_dir : usrbin_exec_dir,
2708 install : true)
2709 exes += exe
2710 manadocs += ['misc-utils/namei.1.adoc']
2711 bashcompletions += ['namei']
2712
2713 exe = executable(
2714 'whereis',
2715 whereis_sources,
2716 include_directories : includes,
2717 link_with : [lib_common],
2718 install_dir : usrbin_exec_dir,
2719 install : true)
2720 exes += exe
2721 manadocs += ['misc-utils/whereis.1.adoc']
2722 bashcompletions += ['whereis']
2723
2724 exe = executable(
2725 'lslocks',
2726 lslocks_sources,
2727 include_directories : includes,
2728 link_with : [lib_common,
2729 lib_mount,
2730 lib_smartcols],
2731 install_dir : usrbin_exec_dir,
2732 install : true)
2733 if not is_disabler(exe)
2734 exes += exe
2735 manadocs += ['misc-utils/lslocks.8.adoc']
2736 bashcompletions += ['lslocks']
2737 endif
2738
2739 exe = executable(
2740 'lsblk',
2741 lsblk_sources,
2742 include_directories : includes,
2743 link_with : [lib_common,
2744 lib_blkid,
2745 lib_mount,
2746 lib_tcolors,
2747 lib_smartcols],
2748 dependencies : lib_udev,
2749 install : true)
2750 if not is_disabler(exe)
2751 exes += exe
2752 manadocs += ['misc-utils/lsblk.8.adoc']
2753 bashcompletions += ['lsblk']
2754 endif
2755
2756 errnos_h = custom_target('errnos.h',
2757 input : 'tools/all_errnos',
2758 output : 'errnos.h',
2759 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2760 )
2761
2762 mq_libs = []
2763 mq_libs += cc.find_library('rt', required : true)
2764
2765 exe = executable(
2766 'lsfd',
2767 lsfd_sources, errnos_h,
2768 include_directories : includes,
2769 link_with : [lib_common,
2770 lib_smartcols],
2771 dependencies : mq_libs,
2772 install_dir : usrbin_exec_dir,
2773 install : true)
2774 if not is_disabler(exe)
2775 exes += exe
2776 manadocs += ['misc-utils/lsfd.1.adoc']
2777 endif
2778
2779 exe = executable(
2780 'uuidgen',
2781 uuidgen_sources,
2782 include_directories : includes,
2783 link_with : [lib_common,
2784 lib_uuid],
2785 install_dir : usrbin_exec_dir,
2786 install : true)
2787 if not is_disabler(exe)
2788 exes += exe
2789 manadocs += ['misc-utils/uuidgen.1.adoc']
2790 bashcompletions += ['uuidgen']
2791 endif
2792
2793 exe = executable(
2794 'uuidparse',
2795 uuidparse_sources,
2796 include_directories : includes,
2797 link_with : [lib_common,
2798 lib_uuid,
2799 lib_smartcols],
2800 install_dir : usrbin_exec_dir,
2801 install : true)
2802 if not is_disabler(exe)
2803 exes += exe
2804 manadocs += ['misc-utils/uuidparse.1.adoc']
2805 bashcompletions += ['uuidparse']
2806 endif
2807
2808 opt = build_uuidd
2809 exe = executable(
2810 'uuidd',
2811 uuidd_sources,
2812 include_directories : includes,
2813 link_with : [lib_common,
2814 lib_uuid],
2815 dependencies : [realtime_libs,
2816 lib_systemd],
2817 install_dir : usrsbin_exec_dir,
2818 install : opt,
2819 build_by_default : opt)
2820 exe2 = executable(
2821 'test_uuidd',
2822 test_uuidd_sources,
2823 include_directories : includes,
2824 link_with : [lib_common,
2825 lib_uuid],
2826 dependencies : thread_libs,
2827 build_by_default : opt and program_tests)
2828 if not is_disabler(exe)
2829 exes += [exe, exe2]
2830 manadocs += ['misc-utils/uuidd.8.adoc']
2831 bashcompletions += ['uuidd']
2832 endif
2833
2834 opt = build_libblkid
2835 exe = executable(
2836 'blkid',
2837 blkid_sources,
2838 include_directories : includes,
2839 link_with : [lib_common,
2840 lib_blkid],
2841 install_dir : sbindir,
2842 install : opt,
2843 build_by_default : opt)
2844 if opt and not is_disabler(exe)
2845 exes += exe
2846 manadocs += ['misc-utils/blkid.8.adoc']
2847 bashcompletions += ['blkid']
2848 endif
2849
2850 opt = opt and 'blkid' in static_programs
2851 exe = executable(
2852 'blkid.static',
2853 blkid_sources,
2854 include_directories : includes,
2855 link_with : [lib_common,
2856 lib_blkid_static],
2857 install_dir : sbindir,
2858 install : opt,
2859 build_by_default : opt)
2860 if opt and not is_disabler(exe)
2861 exes += exe
2862 endif
2863
2864 exe = executable(
2865 'sample-mkfs',
2866 'libblkid/samples/mkfs.c',
2867 include_directories : includes,
2868 link_with : lib_blkid)
2869 if not is_disabler(exe)
2870 exes += exe
2871 endif
2872
2873 exe = executable(
2874 'sample-partitions',
2875 'libblkid/samples/partitions.c',
2876 include_directories : includes,
2877 link_with : lib_blkid)
2878 if not is_disabler(exe)
2879 exes += exe
2880 endif
2881
2882 exe = executable(
2883 'sample-superblocks',
2884 'libblkid/samples/superblocks.c',
2885 include_directories : includes,
2886 link_with : lib_blkid)
2887 if not is_disabler(exe)
2888 exes += exe
2889 endif
2890
2891 exe = executable(
2892 'sample-topology',
2893 'libblkid/samples/topology.c',
2894 include_directories : includes,
2895 link_with : lib_blkid)
2896 if not is_disabler(exe)
2897 exes += exe
2898 endif
2899
2900 exe = executable(
2901 'test_blkid_fuzz_sample',
2902 'libblkid/src/fuzz.c',
2903 include_directories: includes,
2904 link_with: lib_blkid,
2905 build_by_default: program_tests)
2906 if not is_disabler(exe)
2907 exes += exe
2908 endif
2909
2910 ############################################################
2911
2912 exe = executable(
2913 'findfs',
2914 findfs_sources,
2915 include_directories : includes,
2916 link_with : [lib_blkid],
2917 install_dir : sbindir,
2918 install : true)
2919 if not is_disabler(exe)
2920 exes += exe
2921 manadocs += ['misc-utils/findfs.8.adoc']
2922 bashcompletions += ['findfs']
2923 endif
2924
2925 exe = executable(
2926 'wipefs',
2927 wipefs_sources,
2928 include_directories : includes,
2929 link_with : [lib_common,
2930 lib_blkid,
2931 lib_smartcols],
2932 install_dir : sbindir,
2933 install : true)
2934 if not is_disabler(exe)
2935 exes += exe
2936 manadocs += ['misc-utils/wipefs.8.adoc']
2937 bashcompletions += ['wipefs']
2938 endif
2939
2940 exe = executable(
2941 'findmnt',
2942 findmnt_sources,
2943 include_directories : includes,
2944 link_with : [lib_common,
2945 lib_blkid,
2946 lib_mount,
2947 lib_smartcols],
2948 dependencies : [lib_udev],
2949 install : true)
2950 if not is_disabler(exe)
2951 exes += exe
2952 manadocs += ['misc-utils/findmnt.8.adoc']
2953 bashcompletions += ['findmnt']
2954 endif
2955
2956 exe = executable(
2957 'kill',
2958 kill_sources,
2959 include_directories : includes,
2960 link_with : [lib_common],
2961 install : true)
2962 if not is_disabler(exe)
2963 exes += exe
2964 manadocs += ['misc-utils/kill.1.adoc']
2965 endif
2966
2967 opt = not get_option('build-rename').disabled()
2968 exe = executable(
2969 'rename',
2970 rename_sources,
2971 include_directories : includes,
2972 install_dir : usrbin_exec_dir,
2973 install : opt,
2974 build_by_default : opt)
2975 if opt and not is_disabler(exe)
2976 exes += exe
2977 manadocs += ['misc-utils/rename.1.adoc']
2978 bashcompletions += ['rename']
2979 endif
2980
2981 exe = executable(
2982 'getopt',
2983 getopt_sources,
2984 include_directories : includes,
2985 link_with : [lib_common],
2986 install_dir : usrbin_exec_dir,
2987 install : true)
2988 exes += exe
2989 manadocs += ['misc-utils/getopt.1.adoc']
2990 bashcompletions += ['getopt']
2991
2992 exe = executable(
2993 'fincore',
2994 fincore_sources,
2995 include_directories : includes,
2996 link_with : [lib_common,
2997 lib_smartcols],
2998 install_dir : usrbin_exec_dir,
2999 install : true)
3000 if not is_disabler(exe)
3001 exes += exe
3002 manadocs += ['misc-utils/fincore.1.adoc']
3003 bashcompletions += ['fincore']
3004 endif
3005
3006 exe = executable(
3007 'hardlink',
3008 hardlink_sources,
3009 include_directories : includes,
3010 link_with : [lib_common],
3011 install_dir : usrbin_exec_dir,
3012 install : true)
3013 if not is_disabler(exe)
3014 exes += exe
3015 manadocs += ['misc-utils/hardlink.1.adoc']
3016 bashcompletions += ['hardlink']
3017 endif
3018
3019 opt = not get_option('build-pipesz').disabled()
3020 exe = executable(
3021 'pipesz',
3022 pipesz_sources,
3023 include_directories : includes,
3024 link_with : [lib_common],
3025 install_dir : usrbin_exec_dir,
3026 install : true)
3027 if opt and not is_disabler(exe)
3028 exes += exe
3029 manadocs += ['misc-utils/pipesz.1.adoc']
3030 bashcompletions += ['pipesz']
3031 endif
3032
3033 exe = executable(
3034 'test_cal',
3035 cal_sources,
3036 include_directories : includes,
3037 c_args : '-DTEST_CAL',
3038 link_with : [lib_common,
3039 lib_tcolors],
3040 dependencies : [curses_libs],
3041 build_by_default: program_tests)
3042 if not is_disabler(exe)
3043 exes += exe
3044 endif
3045
3046 exe = executable(
3047 'fadvise',
3048 fadvise_sources,
3049 include_directories : includes,
3050 link_with : [lib_common],
3051 install_dir : usrbin_exec_dir,
3052 install : true)
3053 if not is_disabler(exe)
3054 exes += exe
3055 manadocs += ['misc-utils/fadvise.1.adoc']
3056 bashcompletions += ['fadvise']
3057 endif
3058
3059 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3060 exe = executable(
3061 'waitpid',
3062 waitpid_sources,
3063 include_directories : includes,
3064 link_with : [lib_common],
3065 install_dir : usrbin_exec_dir,
3066 install : true)
3067 if not is_disabler(exe)
3068 exes += exe
3069 manadocs += ['misc-utils/waitpid.1.adoc']
3070 bashcompletions += ['waitpid']
3071 endif
3072 endif
3073
3074 syscalls_h = custom_target('syscalls.h',
3075 input : 'tools/all_syscalls',
3076 output : 'syscalls.h',
3077 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3078 )
3079
3080 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3081 exe = executable(
3082 'enosys',
3083 'misc-utils/enosys.c', syscalls_h, errnos_h,
3084 include_directories : includes,
3085 link_with : [lib_common],
3086 install_dir : usrbin_exec_dir,
3087 install : true)
3088 if not is_disabler(exe)
3089 exes += exe
3090 manadocs += ['misc-utils/enosys.1.adoc']
3091 bashcompletions += ['enosys']
3092 endif
3093 endif
3094
3095 exe = executable(
3096 'lsclocks',
3097 lsclocks_sources,
3098 include_directories : includes,
3099 link_with : [lib_common, lib_smartcols],
3100 install_dir : usrbin_exec_dir,
3101 install : true)
3102 if not is_disabler(exe)
3103 exes += exe
3104 manadocs += ['misc-utils/lsclocks.1.adoc']
3105 bashcompletions += ['lsclocks']
3106 endif
3107
3108 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3109 exe = executable(
3110 'exch',
3111 exch_sources,
3112 include_directories : includes,
3113 link_with : [lib_common],
3114 install_dir : usrbin_exec_dir,
3115 install : true)
3116 if not is_disabler(exe)
3117 exes += exe
3118 manadocs += ['misc-utils/exch.1.adoc']
3119 bashcompletions += ['exch']
3120 endif
3121 endif
3122
3123 ############################################################
3124
3125 opt = not get_option('build-schedutils').disabled()
3126 exe = executable(
3127 'chrt',
3128 'schedutils/chrt.c',
3129 include_directories : includes,
3130 link_with : lib_common,
3131 install_dir : usrbin_exec_dir,
3132 install : opt,
3133 build_by_default : opt)
3134
3135 exe2 = executable(
3136 'ionice',
3137 'schedutils/ionice.c',
3138 include_directories : includes,
3139 link_with : lib_common,
3140 install_dir : usrbin_exec_dir,
3141 install : opt,
3142 build_by_default : opt)
3143
3144 exe3 = executable(
3145 'taskset',
3146 'schedutils/taskset.c',
3147 include_directories : includes,
3148 link_with : lib_common,
3149 install_dir : usrbin_exec_dir,
3150 install : opt,
3151 build_by_default : opt)
3152
3153 exe4 = executable(
3154 'uclampset',
3155 'schedutils/uclampset.c',
3156 include_directories : includes,
3157 link_with : lib_common,
3158 install_dir : usrbin_exec_dir,
3159 install : opt,
3160 build_by_default : opt)
3161
3162 if opt and not is_disabler(exe)
3163 exes += [exe, exe2, exe3, exe4]
3164 manadocs += ['schedutils/chrt.1.adoc',
3165 'schedutils/ionice.1.adoc',
3166 'schedutils/taskset.1.adoc',
3167 'schedutils/uclampset.1.adoc']
3168 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3169 endif
3170
3171 ############################################################
3172
3173 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3174
3175 exe = executable(
3176 'test_ttyutils',
3177 'lib/ttyutils.c',
3178 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3179 include_directories : dir_include,
3180 link_with : lib_common,
3181 build_by_default: program_tests)
3182 exes += exe
3183
3184 exe = executable(
3185 'test_blkdev',
3186 'lib/blkdev.c',
3187 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3188 include_directories : dir_include,
3189 link_with : lib_common,
3190 build_by_default: program_tests)
3191 exes += exe
3192
3193 exe = executable(
3194 'test_ismounted',
3195 'lib/ismounted.c',
3196 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3197 include_directories : dir_include,
3198 link_with : lib_common,
3199 build_by_default: program_tests)
3200 exes += exe
3201
3202 exe = executable(
3203 'test_mangle',
3204 'lib/mangle.c',
3205 c_args : ['-DTEST_PROGRAM_MANGLE'],
3206 include_directories : dir_include,
3207 build_by_default: program_tests)
3208 exes += exe
3209
3210 exe = executable(
3211 'test_strutils',
3212 'lib/strutils.c',
3213 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3214 include_directories : dir_include,
3215 build_by_default: program_tests)
3216 exes += exe
3217
3218 exe = executable(
3219 'test_colors',
3220 'lib/colors.c',
3221 'lib/color-names.c',
3222 c_args : ['-DTEST_PROGRAM_COLORS'],
3223 include_directories : dir_include,
3224 link_with : [lib_common, lib_tcolors],
3225 build_by_default: program_tests)
3226 exes += exe
3227
3228 exe = executable(
3229 'test_randutils',
3230 'lib/randutils.c',
3231 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3232 include_directories : dir_include,
3233 build_by_default: program_tests)
3234 exes += exe
3235
3236 if conf.get('HAVE_OPENAT').to_string() == '1' \
3237 and conf.get('HAVE_DIRFD').to_string() == '1'
3238 exe = executable(
3239 'test_procfs',
3240 'lib/procfs.c',
3241 c_args : ['-DTEST_PROGRAM_PROCFS'],
3242 include_directories : dir_include,
3243 link_with : lib_common,
3244 build_by_default: program_tests)
3245 exes += exe
3246
3247 exe = executable(
3248 'test_path',
3249 'lib/path.c',
3250 'lib/fileutils.c',
3251 have_cpu_set_t ? 'lib/cpuset.c' : [],
3252 c_args : ['-DTEST_PROGRAM_PATH'],
3253 include_directories : dir_include,
3254 link_with : lib_common,
3255 build_by_default: program_tests)
3256 exes += exe
3257 endif
3258
3259 if conf.get('HAVE_PTY').to_string() == '1'
3260 exe = executable(
3261 'test_pty',
3262 pty_session_c,
3263 monotonic_c,
3264 c_args : ['-DTEST_PROGRAM_PTY'],
3265 include_directories : dir_include,
3266 link_with : [lib_common],
3267 dependencies : [lib_m,
3268 realtime_libs,
3269 lib_util],
3270 build_by_default: program_tests)
3271 exes += exe
3272 endif
3273
3274 if LINUX
3275 exe = executable(
3276 'test_cpuset',
3277 'lib/cpuset.c',
3278 c_args : ['-DTEST_PROGRAM_CPUSET'],
3279 include_directories : dir_include,
3280 build_by_default: program_tests)
3281 exes += exe
3282 endif
3283
3284 exe = executable(
3285 'test_sysfs',
3286 'lib/sysfs.c',
3287 'lib/path.c',
3288 'lib/buffer.c',
3289 'lib/mbsalign.c',
3290 'lib/fileutils.c',
3291 have_cpu_set_t ? 'lib/cpuset.c' : [],
3292 c_args : ['-DTEST_PROGRAM_SYSFS'],
3293 include_directories : dir_include,
3294 build_by_default: program_tests)
3295 exes += exe
3296
3297 exe = executable(
3298 'test_pager',
3299 'lib/pager.c',
3300 c_args : ['-DTEST_PROGRAM_PAGER'],
3301 include_directories : dir_include,
3302 build_by_default: program_tests)
3303 exes += exe
3304
3305 exe = executable(
3306 'test_linux_version',
3307 'lib/linux_version.c',
3308 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3309 include_directories : dir_include,
3310 build_by_default: program_tests)
3311 exes += exe
3312
3313 exe = executable(
3314 'test_fileutils',
3315 'lib/fileutils.c',
3316 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3317 include_directories : dir_include,
3318 build_by_default: program_tests)
3319 exes += exe
3320
3321 exe = executable(
3322 'test_canonicalize',
3323 'lib/canonicalize.c',
3324 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3325 include_directories : dir_include,
3326 build_by_default: program_tests)
3327 exes += exe
3328
3329 exe = executable(
3330 'test_timeutils',
3331 'lib/timeutils.c',
3332 'lib/strutils.c',
3333 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3334 include_directories : dir_include,
3335 build_by_default: program_tests)
3336 exes += exe
3337
3338 exe = executable(
3339 'test_pwdutils',
3340 'lib/pwdutils.c',
3341 c_args : ['-DTEST_PROGRAM'],
3342 include_directories : dir_include,
3343 link_with : lib_common,
3344 build_by_default: program_tests)
3345 exes += exe
3346
3347 exe = executable(
3348 'test_logindefs',
3349 'lib/logindefs.c',
3350 c_args : ['-DTEST_PROGRAM'],
3351 include_directories : dir_include,
3352 link_with : [lib_common, logindefs_c],
3353 build_by_default: program_tests)
3354 exes += exe
3355
3356
3357 ############################################################
3358
3359 exe = executable(
3360 'test_uuid_parser',
3361 'libuuid/src/test_uuid.c',
3362 include_directories : [dir_include, dir_libuuid],
3363 link_with : lib_uuid,
3364 dependencies : socket_libs,
3365 build_by_default: program_tests)
3366 if not is_disabler(exe)
3367 exes += exe
3368 endif
3369
3370 ############################################################
3371
3372 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3373 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3374
3375 exe = executable(
3376 'test_fdisk_ask',
3377 'libfdisk/src/ask.c',
3378 c_args : libfdisk_tests_cflags,
3379 include_directories : lib_fdisk_includes,
3380 link_with : libfdisk_tests_ldadd,
3381 build_by_default: program_tests)
3382 if not is_disabler(exe)
3383 exes += exe
3384 endif
3385
3386 exe = executable(
3387 'test_fdisk_gpt',
3388 'libfdisk/src/gpt.c',
3389 c_args : libfdisk_tests_cflags,
3390 include_directories : lib_fdisk_includes,
3391 link_with : libfdisk_tests_ldadd,
3392 build_by_default: program_tests)
3393 if not is_disabler(exe)
3394 exes += exe
3395 endif
3396
3397 exe = executable(
3398 'test_fdisk_utils',
3399 'libfdisk/src/utils.c',
3400 c_args : libfdisk_tests_cflags,
3401 include_directories : lib_fdisk_includes,
3402 link_with : libfdisk_tests_ldadd,
3403 build_by_default: program_tests)
3404 if not is_disabler(exe)
3405 exes += exe
3406 endif
3407
3408 exe = executable(
3409 'test_fdisk_script',
3410 'libfdisk/src/script.c',
3411 c_args : libfdisk_tests_cflags,
3412 include_directories : lib_fdisk_includes,
3413 link_with : libfdisk_tests_ldadd,
3414 build_by_default: program_tests)
3415 if not is_disabler(exe)
3416 exes += exe
3417 endif
3418
3419 exe = executable(
3420 'test_fdisk_version',
3421 'libfdisk/src/version.c',
3422 c_args : libfdisk_tests_cflags,
3423 include_directories : lib_fdisk_includes,
3424 link_with : libfdisk_tests_ldadd,
3425 build_by_default: program_tests)
3426 if not is_disabler(exe)
3427 exes += exe
3428 endif
3429
3430 exe = executable(
3431 'test_fdisk_item',
3432 'libfdisk/src/item.c',
3433 c_args : libfdisk_tests_cflags,
3434 include_directories : lib_fdisk_includes,
3435 link_with : libfdisk_tests_ldadd,
3436 build_by_default: program_tests)
3437 if not is_disabler(exe)
3438 exes += exe
3439 endif
3440
3441 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3442
3443 exe = executable(
3444 'sample-fdisk-mkpart',
3445 'libfdisk/samples/mkpart.c',
3446 include_directories : lib_fdisk_includes,
3447 link_with : sample_fdisk_ldadd)
3448 if not is_disabler(exe)
3449 exes += exe
3450 endif
3451
3452 exe = executable(
3453 'sample-fdisk-mkpart-fullspec',
3454 'libfdisk/samples/mkpart-fullspec.c',
3455 include_directories : lib_fdisk_includes,
3456 link_with : sample_fdisk_ldadd)
3457 if not is_disabler(exe)
3458 exes += exe
3459 endif
3460
3461 ############################################################
3462
3463 exe = executable(
3464 'test_cap',
3465 'tests/helpers/test_cap.c',
3466 include_directories : includes,
3467 dependencies : [lib_cap_ng],
3468 build_by_default: program_tests)
3469 if not is_disabler(exe)
3470 exes += exe
3471 endif
3472
3473 exe = executable(
3474 'test_mbsencode',
3475 'tests/helpers/test_mbsencode.c',
3476 include_directories : includes,
3477 link_with : lib_common,
3478 build_by_default: program_tests)
3479 exes += exe
3480
3481 exe = executable(
3482 'test_byteswap',
3483 'tests/helpers/test_byteswap.c',
3484 include_directories : includes,
3485 build_by_default: program_tests)
3486 exes += exe
3487
3488 exe = executable(
3489 'test_md5',
3490 'tests/helpers/test_md5.c',
3491 md5_c,
3492 include_directories : includes,
3493 build_by_default: program_tests)
3494 exes += exe
3495
3496 exe = executable(
3497 'test_sha1',
3498 'tests/helpers/test_sha1.c',
3499 sha1_c,
3500 include_directories : includes,
3501 build_by_default: program_tests)
3502 exes += exe
3503
3504 exe = executable(
3505 'test_pathnames',
3506 'tests/helpers/test_pathnames.c',
3507 include_directories : includes,
3508 build_by_default: program_tests)
3509 exes += exe
3510
3511 exe = executable(
3512 'test_strerror',
3513 'tests/helpers/test_strerror.c',
3514 include_directories : includes,
3515 build_by_default: program_tests)
3516 exes += exe
3517
3518 exe = executable(
3519 'test_sysinfo',
3520 'tests/helpers/test_sysinfo.c',
3521 include_directories : includes,
3522 build_by_default: program_tests)
3523 exes += exe
3524
3525 exe = executable(
3526 'test_sigreceive',
3527 'tests/helpers/test_sigreceive.c',
3528 include_directories : includes,
3529 link_with : lib_common,
3530 build_by_default: program_tests)
3531 exes += exe
3532
3533 exe = executable(
3534 'test_tiocsti',
3535 'tests/helpers/test_tiocsti.c',
3536 include_directories : includes,
3537 build_by_default: program_tests)
3538 exes += exe
3539
3540 exe = executable(
3541 'test_uuid_namespace',
3542 'tests/helpers/test_uuid_namespace.c',
3543 predefined_c,
3544 unpack_c,
3545 unparse_c,
3546 include_directories : includes,
3547 build_by_default: program_tests)
3548 exes += exe
3549
3550 if LINUX
3551 exe = executable(
3552 'test_mkfds',
3553 'tests/helpers/test_mkfds.c',
3554 'tests/helpers/test_mkfds.h',
3555 'tests/helpers/test_mkfds_ppoll.c',
3556 include_directories : includes,
3557 dependencies : mq_libs,
3558 build_by_default: program_tests)
3559 exes += exe
3560 endif
3561
3562 exe = executable(
3563 'test_enosys',
3564 'tests/helpers/test_enosys.c',
3565 include_directories : includes,
3566 build_by_default: program_tests)
3567 exes += exe
3568
3569 ############################################################
3570
3571 if conf.get('HAVE_OPENAT').to_string() == '1'
3572 exe = executable(
3573 'sample-scols-tree',
3574 'libsmartcols/samples/tree.c',
3575 include_directories : includes,
3576 link_with : [lib_smartcols, lib_common],
3577 build_by_default: program_tests)
3578 if not is_disabler(exe)
3579 exes += exe
3580 endif
3581 endif
3582
3583 exe = executable(
3584 'sample-scols-title',
3585 'libsmartcols/samples/title.c',
3586 include_directories : includes,
3587 link_with : [lib_smartcols, lib_common])
3588 if not is_disabler(exe)
3589 exes += exe
3590 endif
3591
3592 exe = executable(
3593 'sample-scols-wrap',
3594 'libsmartcols/samples/wrap.c',
3595 include_directories : includes,
3596 link_with : [lib_smartcols, lib_common])
3597 if not is_disabler(exe)
3598 exes += exe
3599 endif
3600
3601 exe = executable(
3602 'sample-scols-continuous',
3603 'libsmartcols/samples/continuous.c',
3604 include_directories : includes,
3605 link_with : [lib_smartcols, lib_common])
3606 if not is_disabler(exe)
3607 exes += exe
3608 endif
3609
3610 exe = executable(
3611 'sample-scols-continuous-json',
3612 'libsmartcols/samples/continuous-json.c',
3613 include_directories : includes,
3614 link_with : [lib_smartcols, lib_common])
3615 if not is_disabler(exe)
3616 exes += exe
3617 endif
3618
3619 exe = executable(
3620 'sample-scols-maxout',
3621 'libsmartcols/samples/maxout.c',
3622 include_directories : includes,
3623 link_with : [lib_smartcols, lib_common])
3624 if not is_disabler(exe)
3625 exes += exe
3626 endif
3627
3628 exe = executable(
3629 'sample-scols-fromfile',
3630 'libsmartcols/samples/fromfile.c',
3631 include_directories : includes,
3632 link_with : [lib_smartcols, lib_common])
3633 if not is_disabler(exe)
3634 exes += exe
3635 endif
3636
3637 exe = executable(
3638 'sample-scols-grouping-simple',
3639 'libsmartcols/samples/grouping-simple.c',
3640 include_directories : includes,
3641 link_with : [lib_smartcols, lib_common])
3642 if not is_disabler(exe)
3643 exes += exe
3644 endif
3645
3646 exe = executable(
3647 'sample-scols-grouping-overlay',
3648 'libsmartcols/samples/grouping-overlay.c',
3649 include_directories : includes,
3650 link_with : [lib_smartcols, lib_common])
3651 if not is_disabler(exe)
3652 exes += exe
3653 endif
3654
3655 exe = executable(
3656 'test_boilerplate',
3657 'Documentation/boilerplate.c',
3658 include_directories : includes,
3659 build_by_default: program_tests)
3660 if not is_disabler(exe)
3661 exes += exe
3662 endif
3663
3664 ############################################################
3665
3666 # Let the test runner know whether we're running under asan and export
3667 # some paths. We use a file on disk so that it is possible to run the
3668 # test scripts from commandline without setting any variables.
3669 configure_file(output : 'meson.conf',
3670 capture : true,
3671 command : ['echo',
3672 '''asan=@0@
3673 PYTHON=@1@
3674 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3675 python.full_path())])
3676
3677 run_sh = find_program('tests/run.sh')
3678 run_target(
3679 'check',
3680 command : [run_sh,
3681 '--srcdir=' + meson.current_source_dir(),
3682 '--builddir=' + meson.current_build_dir(),
3683 '--parallel',
3684 '--nonroot'],
3685 depends : exes)
3686
3687
3688 manadocs += ['lib/terminal-colors.d.5.adoc']
3689 manadocs += ['libblkid/libblkid.3.adoc']
3690
3691 if build_libuuid
3692 manadocs += [
3693 'libuuid/man/uuid.3.adoc',
3694 'libuuid/man/uuid_clear.3.adoc',
3695 'libuuid/man/uuid_compare.3.adoc',
3696 'libuuid/man/uuid_copy.3.adoc',
3697 'libuuid/man/uuid_generate.3.adoc',
3698 'libuuid/man/uuid_is_null.3.adoc',
3699 'libuuid/man/uuid_parse.3.adoc',
3700 'libuuid/man/uuid_time.3.adoc',
3701 'libuuid/man/uuid_unparse.3.adoc']
3702 manlinks += {
3703 'uuid_generate_random.3': 'uuid_generate.3',
3704 'uuid_generate_time.3': 'uuid_generate.3',
3705 'uuid_generate_time_safe.3': 'uuid_generate.3',
3706 }
3707 endif
3708
3709 asciidoctor = find_program('asciidoctor', required : false)
3710 if asciidoctor.found()
3711 foreach adoc : manadocs
3712 name = adoc.split('/')[-1]
3713 page = name.split('.adoc')[0]
3714 section = page.split('.')[-1]
3715 mandirn = join_paths(mandir, 'man' + section)
3716 input = adoc
3717
3718 custom_target(
3719 page,
3720 command : [ asciidoctor,
3721 '-b', 'manpage',
3722 '-a', 'VERSION=' + meson.project_version(),
3723 '-a', 'release-version=' + meson.project_version(),
3724 '-a', 'ADJTIME_PATH=/etc/adjtime',
3725 '-a', 'package-docdir=' + docdir,
3726 '--base-dir=' + meson.current_source_dir(),
3727 '--destination-dir=' + meson.current_build_dir(),
3728 '--load-path', '@SOURCE_ROOT@/tools',
3729 '--require', 'asciidoctor-includetracker',
3730 '@INPUT@'],
3731 input : input,
3732 output : [page],
3733 depfile : page + '.deps',
3734 install: true,
3735 install_dir : mandirn)
3736 endforeach
3737
3738 foreach link_name, target : manlinks
3739 link_section = link_name.split('.')[-1]
3740 target_section = target.split('.')[-1]
3741 meson.add_install_script(meson_make_manpage_stub,
3742 join_paths('man' + target_section, target),
3743 join_paths(mandir, 'man' + link_section, link_name))
3744 endforeach
3745 endif
3746
3747 if bash_completion.found()
3748 foreach completion : bashcompletions
3749 install_data(
3750 join_paths('bash-completion', completion),
3751 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3752 )
3753 endforeach
3754 foreach link_name, target : bashcompletionslinks
3755 meson.add_install_script(meson_make_symlink,
3756 target,
3757 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))
3758 endforeach
3759 endif