1 project('util-linux', 'c',
5 pkgconfig = import('pkgconfig')
7 libblkid_version = '1.1.0'
8 libblkid_date = '01-Jun-2021'
9 libuuid_version = '1.3.0'
10 libmount_version = '1.1.0'
11 libsmartcols_version = '1.1.0'
12 libfdisk_version = '1.1.0'
14 prefixdir = get_option('prefix')
15 if not prefixdir.startswith('/')
16 error('Prefix is not absolute: "@0@"'.format(prefixdir))
18 bindir = join_paths(prefixdir, get_option('bindir'))
19 sbindir = join_paths(prefixdir, get_option('sbindir'))
20 sysconfstaticdir = join_paths(prefixdir, 'lib')
21 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
22 mandir = join_paths(prefixdir, get_option('mandir'))
24 execprefixdir = '/usr'
25 usrbin_exec_dir = join_paths(execprefixdir, 'bin')
26 usrsbin_exec_dir = join_paths(execprefixdir, 'sbin')
28 localstatedir = '/var'
29 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
31 vendordir = get_option('vendordir')
33 add_project_arguments('-D_GNU_SOURCE', language : 'c')
35 cc = meson.get_compiler('c')
37 conf = configuration_data()
38 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
39 conf.set_quoted('PACKAGE_STRING', package_string)
40 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
42 codes = [''' {print $1} ''',
43 ''' {sub("-.*","",$2); print $2} ''',
44 ''' {sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0} ''']
47 res = run_command('bash', '-c',
48 '''echo '@0@' | awk -F. '@1@' '''.format(
49 meson.project_version(), code))
50 pc_version += res.stdout().strip()
52 pc_version = '.'.join(pc_version)
54 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
55 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
57 conf.set('bindir', bindir)
58 conf.set('sbindir', sbindir)
59 conf.set('runstatedir', runstatedir)
60 conf.set('usrsbin_execdir', usrsbin_exec_dir)
61 conf.set('docdir', docdir)
62 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
63 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
64 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
65 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
67 conf.set_quoted('_PATH_VENDORDIR', vendordir)
68 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
70 build_libblkid = not get_option('build-libblkid').disabled()
71 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
72 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
74 build_libuuid = not get_option('build-libuuid').disabled()
75 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
76 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
78 build_libmount = not get_option('build-libmount').disabled()
79 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
80 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
82 build_libsmartcols = not get_option('build-libsmartcols').disabled()
83 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
84 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
86 build_libfdisk = not get_option('build-libfdisk').disabled()
87 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
88 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
90 build_uuidd = not get_option('build-uuidd').disabled()
91 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
92 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
94 static_programs = get_option('static-programs')
95 need_static_libs = static_programs.length() > 0 # a rough estimate...
96 summary('static programs', static_programs)
98 LINUX = host_machine.system() in ['linux']
99 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
101 ############################################################
119 have = cc.compiles(code, name : 'wchar_t support')
120 if not have and get_option('widechar').enabled()
121 error('widechar support requested but unavailable')
123 if get_option('ncurses').enabled() and get_option('widechar').enabled()
124 error('widechar support is incompatible with non-wide ncurses')
126 conf.set('HAVE_WIDECHAR', have ? 1 : false)
162 linux/net_namespace.h
203 lib_m = cc.find_library('m')
205 lib_tinfo = dependency(
207 required : get_option('tinfo'))
209 lib_tinfo_static = dependency(
212 required : need_static_libs ? get_option('tinfo') : disabler())
214 lib_ncursesw = dependency(
216 required : get_option('ncursesw'))
217 if lib_ncursesw.found()
218 headers += ['ncursesw/ncurses.h',
222 lib_ncurses = disabler()
224 lib_ncurses = dependency(
226 required : get_option('ncurses'))
227 headers += ['ncurses.h',
231 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
232 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
233 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
235 lib_slang = dependency(
237 required : get_option('slang'))
239 headers += ['slang.h',
244 conf.set('HAVE_SLANG', lib_slang.found())
246 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
247 if curses_libs.found()
248 have = cc.has_function('use_default_colors', dependencies : curses_libs)
249 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
250 have = cc.has_function('resizeterm', dependencies : curses_libs)
251 conf.set('HAVE_RESIZETERM', have ? 1 : false)
258 required : get_option('zlib'))
260 lib_readline = dependency(
262 required : get_option('readline'))
263 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
265 lib_readline_static = dependency(
268 required : need_static_libs ? get_option('readline') : disabler())
270 lib_user = dependency(
273 required : get_option('libuser'))
274 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
276 lib_util = cc.find_library(
278 required : get_option('libutil'))
279 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
281 lib_utempter = cc.find_library(
283 required : get_option('libutempter'))
284 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
286 systemd = dependency(
288 required : get_option('systemd'))
290 lib_systemd = dependency(
292 required : get_option('systemd'))
293 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
295 lib_udev = dependency(
297 required : get_option('systemd'))
298 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
300 lib_crypt = cc.find_library('crypt')
302 lib_pam = cc.find_library('pam')
304 lib_pam_misc = cc.find_library('pam_misc')
305 lib_pam = [lib_pam, lib_pam_misc]
308 lib_cryptsetup = dependency(
310 required : get_option('cryptsetup'))
311 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
313 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
314 lib_dl = cc.find_library(
317 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
318 summary('cryptsetup support (dlopen)',
320 section : 'components')
322 summary('cryptsetup support',
323 lib_cryptsetup.found() ? 'enabled' : 'disabled',
324 section : 'components')
327 have = cc.has_function(
328 'crypt_activate_by_signed_key',
329 dependencies : lib_cryptsetup)
330 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
332 lib_cap_ng = dependency(
335 lib_selinux = dependency(
338 required : get_option('selinux'))
339 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
341 lib_magic = dependency(
343 required : get_option('magic'))
344 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
346 lib_econf = dependency(
348 required : get_option('econf'))
349 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
351 lib_audit = dependency(
353 required : get_option('audit'))
354 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
356 conf.set('HAVE_SMACK', not get_option('smack').disabled())
358 foreach header : headers
359 have = cc.has_header(header)
360 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
363 header = 'linux/btrfs.h'
364 enable_btrfs = cc.has_header(header,
365 required : get_option('btrfs'))
366 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
367 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
369 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
374 have = cc.has_header(header,
376 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
379 have = cc.has_header('sched.h')
380 conf.set10('HAVE_DECL_CPU_ALLOC', have)
381 # We get -1 if the size cannot be determined
382 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#include <sched.h>') > 0
383 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
385 have = cc.has_header_symbol('stdlib.h', 'environ')
386 conf.set10('HAVE_ENVIRON_DECL', have)
388 have = cc.has_header_symbol('signal.h', 'sighandler_t')
389 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
391 have = cc.has_header_symbol('string.h', 'strsignal')
392 conf.set10('HAVE_STRSIGNAL_DECL', have)
394 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
395 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
397 have = cc.compiles('''
398 #define _GNU_SOURCE 1
399 #include <langinfo.h>
402 str = nl_langinfo (ALTMON_1);
403 str = nl_langinfo (ALTMON_2);
404 str = nl_langinfo (ALTMON_3);
405 str = nl_langinfo (ALTMON_4);
406 str = nl_langinfo (ALTMON_5);
407 str = nl_langinfo (ALTMON_6);
408 str = nl_langinfo (ALTMON_7);
409 str = nl_langinfo (ALTMON_8);
410 str = nl_langinfo (ALTMON_9);
411 str = nl_langinfo (ALTMON_10);
412 str = nl_langinfo (ALTMON_11);
413 str = nl_langinfo (ALTMON_12);
417 name : 'langinfo.h defines ALTMON_x constants')
418 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
420 have = cc.compiles('''
421 #define _GNU_SOURCE 1
422 #include <langinfo.h>
425 str = nl_langinfo (_NL_ABALTMON_1);
426 str = nl_langinfo (_NL_ABALTMON_2);
427 str = nl_langinfo (_NL_ABALTMON_3);
428 str = nl_langinfo (_NL_ABALTMON_4);
429 str = nl_langinfo (_NL_ABALTMON_5);
430 str = nl_langinfo (_NL_ABALTMON_6);
431 str = nl_langinfo (_NL_ABALTMON_7);
432 str = nl_langinfo (_NL_ABALTMON_8);
433 str = nl_langinfo (_NL_ABALTMON_9);
434 str = nl_langinfo (_NL_ABALTMON_10);
435 str = nl_langinfo (_NL_ABALTMON_11);
436 str = nl_langinfo (_NL_ABALTMON_12);
440 name : 'langinfo.h defines _NL_ABALTMON_x constants')
441 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
523 have = cc.has_function(func)
524 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
525 # This makes little sense, but is necessary to avoid warnings about
526 # redefined macros from Python.h, which uses this convention.
527 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
530 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
531 conf.set('AGETTY_RELOAD', have ? 1 : false)
533 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
536 have_dirfd = (cc.has_function('dirfd') or
537 cc.has_header_symbol('dirent.h', 'dirfd',
538 prefix : '#include <sys/types.h>'))
539 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
541 have_ddfd = cc.has_member('DIR', 'dd_fd',
543 #include <sys/types.h>
546 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
548 have = cc.has_member('struct tm', 'tm_gmtoff',
553 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
555 have = cc.has_member('struct termios', 'c_line',
556 prefix : '#include <termios.h>')
557 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
559 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
560 prefix : '#include <sys/stat.h>')
561 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
563 # replacement for AC_STRUCT_TIMEZONE
564 have = cc.has_member('struct tm', 'tm_zone',
565 prefix : '#include <time.h>')
566 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
568 have = cc.sizeof('tzname', prefix : '#include <time.h>') > 0
569 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
574 extern char *tzname[];
577 return tzname ? 0 : 1;
579 '''.format(have ? 1 : 0)
580 result = cc.run(code, name : 'using tzname[]')
581 have = result.compiled() and result.returncode() == 0
582 conf.set('HAVE_TZNAME', have ? 1 : false)
585 if not cc.has_function('socket')
586 socket_libs += cc.find_library('socket', required : true)
587 have = cc.has_function('socket',
588 dependencies : socket_libs)
590 error('socket() function not available')
595 have = cc.has_function('clock_gettime')
597 realtime_libs += cc.find_library('rt', required : true)
598 have = cc.has_function('clock_gettime',
599 dependencies : realtime_libs)
601 conf.set('HAVE_CLOCK_GETTIME', have_dirfd ? 1 : false)
603 thread_libs = dependency('threads')
605 have = cc.has_function('timer_create')
607 realtime_libs = cc.find_library('rt', required : true)
608 have = cc.has_function('timer_create',
609 dependencies : realtime_libs)
611 realtime_libs += thread_libs
612 have = cc.has_function('timer_create',
613 dependencies : realtime_libs)
616 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
618 have = cc.has_function('setitimer')
619 conf.set('HAVE_SETITIMER', have ? 1 : false)
622 rtas_libs = cc.find_library('rtas', required : false)
623 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
626 if not cc.has_function('isnan')
627 lib = cc.find_library('m', required : true)
628 if (cc.has_function('isnan', dependencies : lib) and
629 cc.has_function('__isnan', dependencies : lib))
634 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
635 args : '-D_GNU_SOURCE')
636 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
639 extern char *__progname;
641 return (*__progname != 0);
644 result = cc.run(code, name : 'using __progname')
645 have = result.compiled() and result.returncode() == 0
646 conf.set('HAVE___PROGNAME', have ? 1 : false)
648 build_plymouth_support = get_option('build-plymouth-support')
649 have_tiocglcktrmios = cc.has_header_symbol(
650 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
651 required : build_plymouth_support.enabled())
652 have_sock_cloexec = cc.has_header_symbol(
653 'sys/socket.h', 'SOCK_CLOEXEC',
654 prefix : '#include <sys/types.h>',
655 required : build_plymouth_support.enabled())
656 have_sock_nonblock = cc.has_header_symbol(
657 'sys/socket.h', 'SOCK_NONBLOCK',
658 prefix : '#include <sys/types.h>',
659 required : build_plymouth_support.enabled())
660 have_so_passcred = cc.has_header_symbol(
661 'sys/socket.h', 'SO_PASSCRED',
662 prefix : '#include <sys/types.h>',
663 required : build_plymouth_support.enabled())
665 build_plymouth_support = (not build_plymouth_support.disabled() and
666 have_tiocglcktrmios and
667 have_sock_cloexec and
668 have_sock_nonblock and
670 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
671 summary('plymouth support',
672 build_plymouth_support ? 'enabled' : 'disabled',
673 section : 'components')
675 # check for valid fallocate() function
676 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
677 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
678 # and program can't be linked.
686 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
687 return ret == 0 ? 0 : 1;
690 have = cc.links(code, name : 'fallocate() function')
691 conf.set('HAVE_FALLOCATE', have ? 1 : false)
699 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
700 return ret == 0 ? 0 : 1;
703 have = cc.links(code, name : 'posix_fallocate() function')
704 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
706 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
707 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
708 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
710 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
711 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
713 ############################################################
716 fs_search_path = get_option('fs-search-path')
717 fs_search_path_extra = get_option('fs-search-path-extra')
718 if fs_search_path_extra != ''
719 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
721 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
724 systemdsystemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
727 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
728 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
730 have = get_option('chsh-only-listed')
731 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
733 have = get_option('use-tty-group')
734 conf.set('USE_TTY_GROUP', have ? 1 : false)
736 build_hwclock = not get_option('build-hwclock').disabled()
737 bison = find_program('bison', required: build_hwclock)
738 bison_gen = generator(
740 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
741 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
745 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
746 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
748 config_h = configure_file(
750 configuration : conf)
752 add_project_arguments('-include', 'config.h', language : 'c')
758 bashcompletionslinks = {}
764 subdir('libsmartcols')
767 subdir('login-utils')
775 includes = [dir_include,
785 opt = not get_option('build-chfn-chsh').disabled()
790 include_directories : includes,
791 link_with : lib_common,
792 dependencies : chfn_chsh_deps,
793 install_dir : usrbin_exec_dir,
795 build_by_default : opt)
799 'login-utils/chsh.c',
801 include_directories : includes,
802 link_with : lib_common,
803 dependencies : chfn_chsh_deps,
804 install_dir : usrbin_exec_dir,
806 build_by_default : opt)
807 if opt and not is_disabler(exe)
809 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
810 bashcompletions += ['chfn', 'chsh']
815 test_islocal_sources,
816 include_directories : includes,
817 c_args : '-DTEST_PROGRAM')
822 test_logindefs_sources,
823 include_directories : includes,
824 c_args : '-DTEST_PROGRAM')
829 test_consoles_sources,
830 c_args : ['-DTEST_PROGRAM'],
831 include_directories : includes,
832 link_with : lib_common)
835 opt = not get_option('build-last').disabled()
839 include_directories : includes,
840 link_with : [lib_common],
841 install_dir : usrbin_exec_dir,
843 build_by_default : opt)
844 if opt and not is_disabler(exe)
846 meson.add_install_script(meson_make_symlink,
848 join_paths(usrbin_exec_dir, 'lastb'))
849 manadocs += ['login-utils/last.1.adoc']
850 manlinks += {'lastb.1': 'last.1'}
851 bashcompletions += ['last']
852 bashcompletionslinks += {'lastb': 'last'}
855 opt = not get_option('build-nologin').disabled()
858 'login-utils/nologin.c',
859 include_directories : includes,
860 install_dir : sbindir,
861 link_with : [lib_common],
863 build_by_default : opt)
864 if opt and not is_disabler(exe)
866 manadocs += ['login-utils/nologin.8.adoc']
869 opt = not get_option('build-utmpdump').disabled()
872 'login-utils/utmpdump.c',
873 include_directories : includes,
874 link_with : [lib_common],
875 install_dir : usrbin_exec_dir,
877 build_by_default : opt)
878 if opt and not is_disabler(exe)
880 manadocs += ['login-utils/utmpdump.1.adoc']
881 bashcompletions += ['utmpdump']
884 opt = not get_option('build-su').disabled()
888 'login-utils/su-common.c',
889 'login-utils/su-common.h',
890 'login-utils/logindefs.c',
891 'login-utils/logindefs.h',
894 include_directories : includes,
895 link_with : lib_common,
896 dependencies : [lib_pam,
901 build_by_default : opt)
902 if opt and not is_disabler(exe)
904 manadocs += ['login-utils/su.1.adoc']
905 bashcompletions += ['su']
908 opt = not get_option('build-newgrp').disabled()
911 'login-utils/newgrp.c',
912 include_directories : includes,
913 dependencies : [lib_crypt],
914 install_dir : usrbin_exec_dir,
916 build_by_default : opt)
917 if opt and not is_disabler(exe)
919 manadocs += ['login-utils/newgrp.1.adoc']
922 opt = not get_option('build-lslogins').disabled()
925 'login-utils/lslogins.c',
926 'login-utils/logindefs.c',
927 'login-utils/logindefs.h',
928 include_directories : includes,
929 link_with : [lib_common,
931 dependencies : [lib_selinux,
933 install_dir : usrbin_exec_dir,
935 build_by_default : opt)
936 if opt and not is_disabler(exe)
938 manadocs += ['login-utils/lslogins.1.adoc']
939 bashcompletions += ['lslogins']
942 opt = not get_option('build-vipw').disabled()
945 'login-utils/vipw.c',
946 'login-utils/setpwnam.h',
947 include_directories : includes,
948 link_with : [lib_common],
949 dependencies : [lib_selinux],
950 install_dir : usrbin_exec_dir,
952 build_by_default : opt)
953 if opt and not is_disabler(exe)
955 meson.add_install_script(meson_make_symlink,
957 join_paths(usrbin_exec_dir, 'vigr'))
958 manadocs += ['login-utils/vipw.8.adoc']
961 opt = not get_option('build-runuser').disabled()
964 'login-utils/runuser.c',
965 'login-utils/su-common.c',
966 'login-utils/su-common.h',
967 'login-utils/logindefs.c',
968 'login-utils/logindefs.h',
971 include_directories : includes,
972 link_with : lib_common,
973 dependencies : [lib_pam,
977 install_dir : sbindir,
979 build_by_default : opt)
980 if opt and not is_disabler(exe)
982 manadocs += ['login-utils/runuser.1.adoc']
983 bashcompletionslinks += {'runuser': 'su'}
986 ############################################################
991 include_directories : includes,
992 link_with : lib_common,
993 install_dir : usrbin_exec_dir,
996 manadocs += ['text-utils/col.1.adoc']
997 bashcompletions += ['col']
1002 include_directories : includes,
1003 install_dir : usrbin_exec_dir,
1006 manadocs += ['text-utils/colcrt.1.adoc']
1007 bashcompletions += ['colcrt']
1012 include_directories : includes,
1013 link_with : lib_common,
1014 install_dir : usrbin_exec_dir,
1017 manadocs += ['text-utils/colrm.1.adoc']
1018 bashcompletions += ['colrm']
1023 include_directories : includes,
1024 install_dir : usrbin_exec_dir,
1027 manadocs += ['text-utils/rev.1.adoc']
1028 bashcompletions += ['rev']
1033 include_directories : includes,
1034 link_with : [lib_common,
1036 install_dir : usrbin_exec_dir,
1038 if not is_disabler(exe)
1040 manadocs += ['text-utils/column.1.adoc']
1041 bashcompletions += ['column']
1044 opt = not get_option('build-line').disabled()
1048 include_directories : includes,
1049 install_dir : usrbin_exec_dir,
1051 build_by_default : opt)
1052 if opt and not is_disabler(exe)
1054 manadocs += ['text-utils/line.1.adoc']
1057 opt = not get_option('build-pg').disabled()
1061 link_with : lib_common,
1062 include_directories : includes,
1063 dependencies : [lib_tinfo,
1065 install_dir : usrbin_exec_dir,
1067 build_by_default : opt)
1068 if opt and not is_disabler(exe)
1070 manadocs += ['text-utils/pg.1.adoc']
1071 bashcompletions += ['pg']
1074 opt = not get_option('build-ul').disabled()
1078 include_directories : includes,
1079 dependencies : [lib_tinfo,
1081 install_dir : usrbin_exec_dir,
1083 build_by_default : opt)
1084 if opt and not is_disabler(exe)
1086 manadocs += ['text-utils/ul.1.adoc']
1087 bashcompletions += ['ul']
1090 opt = not get_option('build-more').disabled()
1094 link_with : [lib_common],
1095 include_directories : includes,
1096 dependencies : [lib_tinfo,
1100 build_by_default : opt)
1104 link_with : [lib_common],
1105 include_directories : includes,
1106 c_args : '-DTEST_PROGRAM',
1107 dependencies : [lib_tinfo,
1110 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1114 manadocs += ['text-utils/more.1.adoc']
1115 bashcompletions += ['more']
1121 include_directories : includes,
1122 link_with : [lib_common,
1124 install_dir : usrbin_exec_dir,
1126 if not is_disabler(exe)
1128 manadocs += ['text-utils/hexdump.1.adoc']
1129 bashcompletions += ['hexdump']
1132 opt = not get_option('build-lsmem').disabled()
1136 include_directories : includes,
1137 link_with : [lib_common,
1139 install_dir : usrbin_exec_dir,
1141 build_by_default : opt)
1142 if opt and not is_disabler(exe)
1144 manadocs += ['sys-utils/lsmem.1.adoc']
1145 bashcompletions += ['lsmem']
1148 opt = not get_option('build-chmem').disabled()
1152 include_directories : includes,
1153 link_with : [lib_common],
1154 install_dir : usrbin_exec_dir,
1156 build_by_default : opt)
1157 if opt and not is_disabler(exe)
1159 manadocs += ['sys-utils/chmem.8.adoc']
1160 bashcompletions += ['chmem']
1166 include_directories : includes,
1167 link_with : [lib_common],
1168 install_dir : usrbin_exec_dir,
1171 manadocs += ['sys-utils/choom.1.adoc']
1176 include_directories : includes,
1177 link_with : [lib_common],
1178 install_dir : usrbin_exec_dir,
1181 manadocs += ['sys-utils/ipcmk.1.adoc']
1182 bashcompletions += ['ipcmk']
1187 include_directories : includes,
1188 link_with : [lib_common],
1189 install_dir : usrbin_exec_dir,
1192 manadocs += ['sys-utils/ipcrm.1.adoc']
1193 bashcompletions += ['ipcrm']
1195 opt = not get_option('build-ipcs').disabled()
1199 include_directories : includes,
1200 link_with : [lib_common],
1201 install_dir : usrbin_exec_dir,
1203 build_by_default : opt)
1204 if opt and not is_disabler(exe)
1206 manadocs += ['sys-utils/ipcs.1.adoc']
1207 bashcompletions += ['ipcs']
1210 opt = not get_option('build-rfkill').disabled()
1214 include_directories : includes,
1215 link_with : [lib_common,
1217 install_dir : usrsbin_exec_dir,
1219 build_by_default : opt)
1220 if opt and not is_disabler(exe)
1222 manadocs += ['sys-utils/rfkill.8.adoc']
1223 bashcompletions += ['rfkill']
1229 include_directories : includes,
1230 link_with : [lib_common,
1232 install_dir : usrbin_exec_dir,
1234 if not is_disabler(exe)
1236 manadocs += ['sys-utils/renice.1.adoc']
1237 bashcompletions += ['renice']
1243 include_directories : includes,
1244 link_with : [lib_common,
1246 install_dir : usrbin_exec_dir,
1248 if opt and not is_disabler(exe)
1250 manadocs += ['sys-utils/setsid.1.adoc']
1251 bashcompletions += ['setsid']
1256 readprofile_sources,
1257 include_directories : includes,
1258 link_with : [lib_common,
1260 install_dir : usrsbin_exec_dir,
1262 if not is_disabler(exe)
1264 manadocs += ['sys-utils/readprofile.8.adoc']
1265 bashcompletions += ['readprofile']
1268 opt = not get_option('build-tunelp').disabled()
1272 include_directories : includes,
1273 link_with : [lib_common],
1274 install_dir : usrsbin_exec_dir,
1276 build_by_default : opt)
1277 if opt and not is_disabler(exe)
1279 manadocs += ['sys-utils/tunelp.8.adoc']
1280 bashcompletions += ['tunelp']
1286 include_directories : includes,
1287 link_with : [lib_common,
1289 install_dir : sbindir,
1291 if not is_disabler(exe)
1293 manadocs += ['sys-utils/fstrim.8.adoc']
1294 bashcompletions += ['fstrim']
1300 include_directories : includes,
1301 link_with : [lib_common,
1304 if not is_disabler(exe)
1306 manadocs += ['sys-utils/dmesg.1.adoc']
1307 bashcompletions += ['dmesg']
1313 include_directories : dir_include,
1314 c_args : '-DTEST_DMESG',
1315 link_with : [lib_common,
1317 if not is_disabler(exe)
1324 include_directories : includes,
1325 link_with : [lib_common],
1326 install_dir : sbindir,
1329 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1330 bashcompletions += ['ctrlaltdel']
1335 include_directories : includes,
1336 install_dir : sbindir,
1339 manadocs += ['sys-utils/fsfreeze.8.adoc']
1340 bashcompletions += ['fsfreeze']
1345 include_directories : includes,
1346 link_with : [lib_common,
1348 install_dir : sbindir,
1351 manadocs += ['sys-utils/blkdiscard.8.adoc']
1352 bashcompletions += ['blkdiscard']
1357 include_directories : includes,
1358 link_with : [lib_common],
1359 install_dir : sbindir,
1362 manadocs += ['sys-utils/blkzone.8.adoc']
1363 bashcompletions += ['blkzone']
1368 include_directories : includes,
1369 link_with : [lib_common],
1370 install_dir : usrsbin_exec_dir,
1373 manadocs += ['sys-utils/ldattach.8.adoc']
1374 bashcompletions += ['ldattach']
1379 include_directories : includes,
1380 link_with : [lib_common],
1381 install_dir : usrsbin_exec_dir,
1384 manadocs += ['sys-utils/rtcwake.8.adoc']
1385 bashcompletions += ['rtcwake']
1390 include_directories : includes,
1391 install_dir : usrbin_exec_dir,
1394 manadocs += ['sys-utils/setarch.8.adoc']
1395 bashcompletions += ['setarch']
1397 setarch_links = ['uname26', 'linux32', 'linux64']
1398 setarch_links_arch = {
1399 's390x' : ['s390', 's390x'],
1401 'x86_64' : ['i386', 'x86_64'],
1402 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1403 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1404 'mips64' : ['mips', 'mips64', 'mips32'],
1405 'ia64' : ['i386', 'ia64'],
1406 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1408 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1410 foreach link: setarch_links
1411 meson.add_install_script(meson_make_symlink,
1413 join_paths(usrbin_exec_dir, link))
1414 manlinks += {link + '.8': 'setarch.8'}
1417 opt = not get_option('build-eject').disabled()
1421 include_directories : includes,
1422 link_with : [lib_common,
1424 install_dir : usrbin_exec_dir,
1426 build_by_default : opt)
1427 if opt and not is_disabler(exe)
1429 manadocs += ['sys-utils/eject.1.adoc']
1430 bashcompletions += ['eject']
1433 opt = not get_option('build-losetup').disabled()
1437 include_directories : includes,
1438 link_with : [lib_common,
1440 install_dir : sbindir,
1442 build_by_default : opt)
1443 if opt and not is_disabler(exe)
1444 manadocs += ['sys-utils/losetup.8.adoc']
1446 bashcompletions += ['losetup']
1449 opt = opt and 'losetup' in static_programs
1453 include_directories : includes,
1454 link_args : ['--static'],
1455 link_with : [lib_common,
1456 lib_smartcols.get_static_lib()],
1457 install_dir : sbindir,
1459 build_by_default : opt)
1460 if opt and not is_disabler(exe)
1464 opt = not get_option('build-zramctl').disabled()
1468 include_directories : includes,
1469 link_with : [lib_common,
1471 install_dir : sbindir,
1473 build_by_default : opt)
1474 if opt and not is_disabler(exe)
1476 manadocs += ['sys-utils/zramctl.8.adoc']
1477 bashcompletions += ['zramctl']
1483 include_directories : includes,
1484 link_with : [lib_common,
1486 install_dir : usrbin_exec_dir,
1488 if not is_disabler(exe)
1490 manadocs += ['sys-utils/prlimit.1.adoc']
1491 bashcompletions += ['prlimit']
1497 include_directories : includes,
1498 link_with : [lib_common,
1501 install_dir : usrbin_exec_dir,
1503 if not is_disabler(exe)
1505 manadocs += ['sys-utils/lsns.8.adoc']
1506 bashcompletions += ['lsns']
1509 opt = not get_option('build-mount').disabled()
1513 include_directories : includes,
1514 link_with : [lib_common,
1517 dependencies : lib_selinux,
1519 build_by_default : opt)
1523 include_directories : includes,
1524 link_with : [lib_common,
1527 build_by_default : opt)
1528 if opt and not is_disabler(exe)
1530 manadocs += ['sys-utils/fstab.5.adoc',
1531 'sys-utils/mount.8.adoc',
1532 'sys-utils/umount.8.adoc']
1533 bashcompletions += ['mount', 'umount']
1536 opt2 = opt and 'mount' in static_programs
1540 include_directories : includes,
1541 link_args : ['--static'],
1542 link_with : [lib_common,
1543 lib_smartcols_static,
1546 build_by_default : opt2)
1547 if opt2 and not is_disabler(exe)
1551 opt2 = opt and 'umount' in static_programs
1555 include_directories : includes,
1556 link_args : ['--static'],
1557 link_with : [lib_common,
1560 build_by_default : opt2)
1561 if opt2 and not is_disabler(exe)
1570 include_directories : includes,
1571 link_with : [lib_common,
1575 install_dir : sbindir,
1577 if not is_disabler(exe)
1579 manadocs += ['sys-utils/swapon.8.adoc']
1580 bashcompletions += ['swapon']
1586 include_directories : includes,
1587 link_with : [lib_common,
1590 install_dir : sbindir,
1592 if not is_disabler(exe)
1594 manlinks += {'swapoff.8': 'swapon.8'}
1595 bashcompletions += ['swapoff']
1601 include_directories : includes,
1602 link_with : [lib_common,
1604 dependencies : [rtas_libs],
1605 install_dir : usrbin_exec_dir,
1607 if not is_disabler(exe)
1609 manadocs += ['sys-utils/lscpu.1.adoc']
1610 bashcompletions += ['lscpu']
1616 include_directories : includes,
1617 link_with : [lib_common],
1618 install_dir : sbindir,
1621 manadocs += ['sys-utils/chcpu.8.adoc']
1622 bashcompletions += ['chcpu']
1627 include_directories : includes,
1628 link_with : [lib_common,
1631 if not is_disabler(exe)
1633 manadocs += ['sys-utils/wdctl.8.adoc']
1634 bashcompletions += ['wdctl']
1637 opt = not get_option('build-mountpoint').disabled()
1641 include_directories : includes,
1642 link_with : [lib_mount],
1644 build_by_default : opt)
1645 if opt and not is_disabler(exe)
1647 manadocs += ['sys-utils/mountpoint.1.adoc']
1648 bashcompletions += ['mountpoint']
1651 opt = not get_option('build-fallocate').disabled()
1655 include_directories : includes,
1656 link_with : [lib_common],
1657 install_dir : usrbin_exec_dir,
1659 build_by_default : opt)
1660 if opt and not is_disabler(exe)
1662 manadocs += ['sys-utils/fallocate.1.adoc']
1663 bashcompletions += ['fallocate']
1666 opt = not get_option('build-pivot_root').disabled()
1670 include_directories : includes,
1671 install_dir : sbindir,
1673 build_by_default : opt)
1674 if opt and not is_disabler(exe)
1676 manadocs += ['sys-utils/pivot_root.8.adoc']
1677 bashcompletions += ['pivot_root']
1680 opt = not get_option('build-switch_root').disabled()
1681 if opt and not have_dirfd and not have_ddfd
1682 error('neither dirfd nor ddfd are available')
1686 switch_root_sources,
1687 include_directories : includes,
1688 install_dir : sbindir,
1690 build_by_default : opt)
1691 if opt and not is_disabler(exe)
1693 manadocs += ['sys-utils/switch_root.8.adoc']
1696 opt = not get_option('build-unshare').disabled()
1700 include_directories : includes,
1701 link_with : [lib_common],
1702 install_dir : usrbin_exec_dir,
1704 build_by_default : opt)
1705 if opt and not is_disabler(exe)
1707 manadocs += ['sys-utils/unshare.1.adoc']
1708 bashcompletions += ['unshare']
1711 opt = opt and 'unshare' in static_programs
1715 include_directories : includes,
1716 link_with : [lib_common],
1717 install_dir : usrbin_exec_dir,
1719 build_by_default : opt)
1720 if opt and not is_disabler(exe)
1724 opt = not get_option('build-nsenter').disabled()
1728 include_directories : includes,
1729 link_with : [lib_common],
1730 dependencies : [lib_selinux],
1731 install_dir : usrbin_exec_dir,
1733 build_by_default : opt)
1734 if opt and not is_disabler(exe)
1736 manadocs += ['sys-utils/nsenter.1.adoc']
1737 bashcompletions += ['nsenter']
1740 opt = opt and 'nsenter' in static_programs
1744 include_directories : includes,
1745 link_with : [lib_common],
1746 dependencies : [lib_selinux],
1747 install_dir : usrbin_exec_dir,
1749 build_by_default : opt)
1750 if opt and not is_disabler(exe)
1754 opt = not get_option('build-setpriv').disabled()
1758 include_directories : includes,
1759 link_with : [lib_common],
1760 dependencies : [lib_cap_ng],
1761 install_dir : usrbin_exec_dir,
1763 build_by_default : opt)
1764 if opt and not is_disabler(exe)
1766 manadocs += ['sys-utils/setpriv.1.adoc']
1767 bashcompletions += ['setpriv']
1773 include_directories : includes,
1774 link_with : [lib_common],
1775 dependencies : realtime_libs,
1776 install_dir : usrbin_exec_dir,
1779 manadocs += ['sys-utils/flock.1.adoc']
1780 bashcompletions += ['flock']
1782 opt = not get_option('build-lsirq').disabled()
1786 include_directories : includes,
1787 link_with : [lib_common,
1789 install_dir : usrbin_exec_dir,
1791 build_by_default : opt)
1792 if opt and not is_disabler(exe)
1794 manadocs += ['sys-utils/lsirq.1.adoc']
1795 bashcompletions += ['lsirq']
1798 opt = not get_option('build-irqtop').disabled()
1802 include_directories : includes,
1803 dependencies : [realtime_libs, curses_libs],
1804 link_with : [lib_common,
1807 install_dir : usrbin_exec_dir,
1809 build_by_default : opt)
1810 if opt and not is_disabler(exe)
1812 manadocs += ['sys-utils/irqtop.1.adoc']
1813 bashcompletions += ['irqtop']
1816 opt = not get_option('build-ipcs').disabled()
1820 include_directories : includes,
1821 link_with : [lib_common,
1823 install_dir : usrbin_exec_dir,
1825 build_by_default : opt)
1826 if opt and not is_disabler(exe)
1828 manadocs += ['sys-utils/lsipc.1.adoc']
1829 bashcompletions += ['lsipc']
1836 include_directories : includes,
1837 link_with : [lib_common],
1838 dependencies : [lib_m,
1840 install_dir : sbindir,
1842 build_by_default : opt)
1843 if opt and not is_disabler(exe)
1845 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
1846 bashcompletions += ['hwclock']
1852 include_directories : includes,
1853 install_dir : sbindir,
1856 manadocs += ['disk-utils/mkfs.8.adoc']
1857 bashcompletions += ['mkfs']
1859 opt = not get_option('build-bfs').disabled()
1863 include_directories : includes,
1864 link_with : [lib_common],
1865 install_dir : sbindir,
1867 build_by_default : opt)
1868 if opt and not is_disabler(exe)
1870 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
1871 bashcompletions += ['mkfs.bfs']
1877 include_directories : includes,
1878 link_with : [lib_common],
1879 install_dir : usrbin_exec_dir,
1882 manadocs += ['disk-utils/isosize.8.adoc']
1883 bashcompletions += ['isosize']
1888 include_directories : includes,
1889 link_with : [lib_common,
1892 dependencies: [lib_selinux],
1893 install_dir : sbindir,
1895 if opt and not is_disabler(exe)
1897 manadocs += ['disk-utils/mkswap.8.adoc']
1898 bashcompletions += ['mkswap']
1904 include_directories : includes,
1905 link_with : [lib_common,
1908 install_dir : sbindir,
1910 if opt and not is_disabler(exe)
1912 manadocs += ['disk-utils/swaplabel.8.adoc']
1913 bashcompletions += ['swaplabel']
1916 opt = not get_option('build-fsck').disabled()
1920 include_directories : includes,
1921 link_with : [lib_common,
1924 dependencies : realtime_libs,
1925 install_dir : sbindir,
1927 build_by_default : opt)
1928 if opt and not is_disabler(exe)
1930 manadocs += ['disk-utils/fsck.8.adoc']
1931 bashcompletions += ['fsck']
1934 opt = not get_option('build-minix').disabled()
1938 include_directories : includes,
1939 link_with : [lib_common],
1940 install_dir : sbindir,
1942 build_by_default : opt)
1946 include_directories : includes,
1947 c_args : '-DTEST_SCRIPT',
1948 link_with : [lib_common],
1949 build_by_default : opt)
1953 include_directories : includes,
1954 link_with : [lib_common],
1955 install_dir : sbindir,
1957 build_by_default : opt)
1958 if opt and not is_disabler(exe)
1959 exes += [exe, exe2, exe3]
1960 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
1961 bashcompletions += ['mkfs.minix', 'fsck.minix']
1964 opt = not get_option('build-cramfs').disabled()
1967 mkfs_cramfs_sources,
1968 include_directories : includes,
1969 link_with : [lib_common],
1970 dependencies : [lib_z],
1971 install_dir : sbindir,
1973 build_by_default : opt)
1976 fsck_cramfs_sources,
1977 include_directories : includes,
1978 link_with : [lib_common],
1979 dependencies : [lib_z],
1980 install_dir : sbindir,
1982 build_by_default : opt)
1983 if not is_disabler(exe)
1985 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
1986 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
1989 opt = not get_option('build-raw').disabled()
1991 cc.has_header('linux/raw.h', required: opt)
1996 include_directories : includes,
1997 install_dir : sbindir,
1999 build_by_default : opt)
2000 if opt and not is_disabler(exe)
2002 manadocs += ['disk-utils/raw.8.adoc']
2003 bashcompletions += ['raw']
2006 opt = not get_option('build-fdformat').disabled()
2010 include_directories : includes,
2011 link_with : [lib_common],
2012 install_dir : usrsbin_exec_dir,
2014 build_by_default : opt)
2015 if opt and not is_disabler(exe)
2017 manadocs += ['disk-utils/fdformat.8.adoc']
2023 include_directories : includes,
2024 link_with : [lib_common],
2025 install_dir : sbindir,
2027 manadocs += ['disk-utils/blockdev.8.adoc']
2028 bashcompletions += ['blockdev']
2030 opt = not get_option('build-fdisks').disabled()
2031 if opt and not have_dirfd and not have_ddfd
2032 error('neither dirfd nor ddfd are available')
2037 include_directories : includes,
2038 link_with : [lib_common,
2042 dependencies : [lib_readline],
2043 install_dir : sbindir,
2045 build_by_default : opt)
2046 if opt and not is_disabler(exe)
2048 bashcompletions += ['fdisk']
2051 opt2 = opt and 'fdisk' in static_programs
2055 link_args : ['--static'],
2056 include_directories : includes,
2057 link_with : [lib_common,
2060 lib_smartcols.get_static_lib()],
2061 dependencies : [lib_readline_static],
2062 install_dir : sbindir,
2064 build_by_default : opt2)
2065 if opt2 and not is_disabler(exe)
2072 include_directories : includes,
2073 link_with : [lib_common,
2077 dependencies : [lib_readline],
2078 install_dir : sbindir,
2080 build_by_default : opt)
2081 if opt and not is_disabler(exe)
2083 bashcompletions += ['sfdisk']
2086 opt2 = opt and 'sfdisk' in static_programs
2090 include_directories : includes,
2091 link_with : [lib_common,
2094 lib_smartcols.get_static_lib()],
2095 dependencies : [lib_readline_static],
2096 install_dir : sbindir,
2098 build_by_default : opt2)
2099 if opt2 and not is_disabler(exe)
2106 include_directories : includes,
2107 link_with : [lib_common,
2112 dependencies : [curses_libs],
2113 install_dir : sbindir,
2115 build_by_default : opt)
2116 if opt and not is_disabler(exe)
2118 manadocs += ['disk-utils/fdisk.8.adoc',
2119 'disk-utils/sfdisk.8.adoc',
2120 'disk-utils/cfdisk.8.adoc']
2121 bashcompletions += ['cfdisk']
2124 opt = not get_option('build-partx').disabled()
2128 include_directories : includes,
2129 link_with : [lib_common],
2130 install_dir : usrsbin_exec_dir,
2132 build_by_default : opt)
2136 include_directories : includes,
2137 link_with : [lib_common],
2138 install_dir : usrsbin_exec_dir,
2140 build_by_default : opt)
2144 include_directories : includes,
2145 link_with : [lib_common],
2146 install_dir : usrsbin_exec_dir,
2148 build_by_default : opt)
2152 include_directories : includes,
2153 link_with : [lib_common,
2156 install_dir : usrsbin_exec_dir,
2158 build_by_default : opt)
2160 exes += [exe, exe2, exe3, exe4]
2161 manadocs += ['disk-utils/addpart.8.adoc',
2162 'disk-utils/delpart.8.adoc',
2163 'disk-utils/resizepart.8.adoc',
2164 'disk-utils/partx.8.adoc']
2165 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2168 ############################################################
2173 include_directories : includes,
2174 link_with : [lib_common],
2175 dependencies : [lib_util,
2179 install_dir : usrbin_exec_dir,
2182 manadocs += ['term-utils/script.1.adoc']
2183 bashcompletions += ['script']
2188 include_directories : includes,
2189 c_args : '-DTEST_SCRIPT',
2190 link_with : [lib_common],
2191 dependencies : [lib_util,
2200 include_directories : includes,
2201 link_with : [lib_common],
2202 dependencies : [lib_util,
2205 install_dir : usrbin_exec_dir,
2208 manadocs += ['term-utils/scriptlive.1.adoc']
2209 bashcompletions += ['scriptlive']
2213 scriptreplay_sources,
2214 include_directories : includes,
2215 link_with : [lib_common],
2216 dependencies : [math_libs],
2217 install_dir : usrbin_exec_dir,
2220 manadocs += ['term-utils/scriptreplay.1.adoc']
2221 bashcompletions += ['scriptreplay']
2223 opt = not get_option('build-agetty').disabled()
2227 include_directories : includes,
2228 link_with : [lib_common],
2229 dependencies : BSD ? lib_util : [],
2230 install_dir : sbindir,
2232 build_by_default : opt)
2235 manadocs += ['term-utils/agetty.8.adoc']
2238 opt = not get_option('build-setterm').disabled()
2242 include_directories : includes,
2243 link_with : [lib_common],
2244 dependencies : [curses_libs],
2245 install_dir : usrbin_exec_dir,
2247 build_by_default : opt)
2250 manadocs += ['term-utils/setterm.1.adoc']
2251 bashcompletions += ['setterm']
2254 opt = not get_option('build-mesg').disabled()
2258 include_directories : includes,
2259 link_with : [lib_common],
2260 install_dir : usrbin_exec_dir,
2262 build_by_default : opt)
2265 manadocs += ['term-utils/mesg.1.adoc']
2266 bashcompletions += ['mesg']
2269 opt = not get_option('build-wall').disabled()
2273 include_directories : includes,
2274 link_with : [lib_common],
2275 install_dir : usrbin_exec_dir,
2277 build_by_default : opt)
2280 manadocs += ['term-utils/wall.1.adoc']
2281 bashcompletions += ['wall']
2284 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2285 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2287 opt = not get_option('build-write').disabled()
2291 include_directories : includes,
2292 link_with : [lib_common],
2293 install_dir : usrbin_exec_dir,
2295 build_by_default : opt)
2298 manadocs += ['term-utils/write.1.adoc']
2301 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2302 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2304 opt = not get_option('build-login').disabled()
2308 include_directories : includes,
2309 link_with : [lib_common],
2310 dependencies : [lib_pam,
2314 build_by_default : opt)
2315 if not is_disabler(exe)
2317 manadocs += ['login-utils/login.1.adoc']
2320 opt = not get_option('build-sulogin').disabled()
2324 include_directories : includes,
2325 link_with : [lib_common],
2326 dependencies : [lib_crypt,
2328 install_dir : sbindir,
2330 build_by_default : opt)
2331 if not is_disabler(exe)
2333 manadocs += ['login-utils/sulogin.8.adoc']
2339 include_directories : includes,
2340 link_with : [lib_common,
2342 dependencies : [curses_libs],
2343 install_dir : usrbin_exec_dir,
2346 manadocs += ['misc-utils/cal.1.adoc']
2347 bashcompletions += ['cal']
2349 opt = not get_option('build-logger').disabled()
2353 include_directories : includes,
2354 link_with : [lib_common],
2355 dependencies : [lib_systemd],
2356 install_dir : usrbin_exec_dir,
2358 build_by_default : opt)
2359 if opt and not is_disabler(exe)
2361 manadocs += ['misc-utils/logger.1.adoc']
2362 bashcompletions += ['logger']
2368 include_directories : includes,
2369 c_args : '-DTEST_LOGGER',
2370 link_with : [lib_common],
2371 dependencies : [lib_systemd])
2372 if not is_disabler(exe)
2379 include_directories : includes,
2380 install_dir : usrbin_exec_dir,
2383 manadocs += ['misc-utils/look.1.adoc']
2384 bashcompletions += ['look']
2389 include_directories : includes,
2390 link_with : [lib_common],
2391 install_dir : usrbin_exec_dir,
2394 manadocs += ['misc-utils/mcookie.1.adoc']
2395 bashcompletions += ['mcookie']
2400 include_directories : includes,
2401 install_dir : usrbin_exec_dir,
2404 manadocs += ['misc-utils/namei.1.adoc']
2405 bashcompletions += ['namei']
2410 include_directories : includes,
2411 link_with : [lib_common],
2412 install_dir : usrbin_exec_dir,
2415 manadocs += ['misc-utils/whereis.1.adoc']
2416 bashcompletions += ['whereis']
2421 include_directories : includes,
2422 link_with : [lib_common,
2425 install_dir : usrbin_exec_dir,
2427 if not is_disabler(exe)
2429 manadocs += ['misc-utils/lslocks.8.adoc']
2430 bashcompletions += ['lslocks']
2436 include_directories : includes,
2437 link_with : [lib_common,
2441 dependencies : lib_udev,
2443 if not is_disabler(exe)
2445 manadocs += ['misc-utils/lsblk.8.adoc']
2446 bashcompletions += ['lsblk']
2452 include_directories : includes,
2453 link_with : [lib_common,
2455 install_dir : usrbin_exec_dir,
2457 if not is_disabler(exe)
2459 manadocs += ['misc-utils/lsfd.1.adoc']
2465 include_directories : includes,
2466 link_with : [lib_uuid],
2467 install_dir : usrbin_exec_dir,
2469 if not is_disabler(exe)
2471 manadocs += ['misc-utils/uuidgen.1.adoc']
2472 bashcompletions += ['uuidgen']
2478 include_directories : includes,
2479 link_with : [lib_common,
2482 install_dir : usrbin_exec_dir,
2484 if not is_disabler(exe)
2486 manadocs += ['misc-utils/uuidparse.1.adoc']
2487 bashcompletions += ['uuidparse']
2494 include_directories : includes,
2495 link_with : [lib_common,
2497 dependencies : [realtime_libs,
2499 install_dir : usrsbin_exec_dir,
2501 build_by_default : opt)
2505 include_directories : includes,
2506 link_with : [lib_common,
2508 dependencies : thread_libs,
2509 build_by_default : opt)
2510 if not is_disabler(exe)
2512 manadocs += ['misc-utils/uuidd.8.adoc']
2513 bashcompletions += ['uuidd']
2516 opt = build_libblkid
2520 include_directories : includes,
2521 link_with : [lib_common,
2523 install_dir : sbindir,
2525 build_by_default : opt)
2526 if opt and not is_disabler(exe)
2528 manadocs += ['misc-utils/blkid.8.adoc']
2529 bashcompletions += ['blkid']
2532 opt = opt and 'blkid' in static_programs
2536 include_directories : includes,
2537 link_with : [lib_common,
2539 install_dir : sbindir,
2541 build_by_default : opt)
2542 if opt and not is_disabler(exe)
2548 'libblkid/samples/mkfs.c',
2549 include_directories : includes,
2550 link_with : lib_blkid)
2551 if not is_disabler(exe)
2556 'sample-partitions',
2557 'libblkid/samples/partitions.c',
2558 include_directories : includes,
2559 link_with : lib_blkid)
2560 if not is_disabler(exe)
2565 'sample-superblocks',
2566 'libblkid/samples/superblocks.c',
2567 include_directories : includes,
2568 link_with : lib_blkid)
2569 if not is_disabler(exe)
2575 'libblkid/samples/topology.c',
2576 include_directories : includes,
2577 link_with : lib_blkid)
2578 if not is_disabler(exe)
2582 ############################################################
2587 include_directories : includes,
2588 link_with : [lib_blkid],
2589 install_dir : sbindir,
2591 if not is_disabler(exe)
2593 manadocs += ['misc-utils/findfs.8.adoc']
2594 bashcompletions += ['findfs']
2600 include_directories : includes,
2601 link_with : [lib_common,
2604 install_dir : sbindir,
2606 if not is_disabler(exe)
2608 manadocs += ['misc-utils/wipefs.8.adoc']
2609 bashcompletions += ['wipefs']
2615 include_directories : includes,
2616 link_with : [lib_common,
2620 dependencies : [lib_udev],
2622 if not is_disabler(exe)
2624 manadocs += ['misc-utils/findmnt.8.adoc']
2625 bashcompletions += ['findmnt']
2631 include_directories : includes,
2632 link_with : [lib_common],
2634 if not is_disabler(exe)
2636 manadocs += ['misc-utils/kill.1.adoc']
2639 opt = not get_option('build-rename').disabled()
2643 include_directories : includes,
2644 install_dir : usrbin_exec_dir,
2646 build_by_default : opt)
2647 if opt and not is_disabler(exe)
2649 manadocs += ['misc-utils/rename.1.adoc']
2650 bashcompletions += ['rename']
2656 include_directories : includes,
2657 link_with : [lib_common],
2658 install_dir : usrbin_exec_dir,
2661 manadocs += ['misc-utils/getopt.1.adoc']
2662 bashcompletions += ['getopt']
2667 include_directories : includes,
2668 link_with : [lib_common,
2670 install_dir : usrbin_exec_dir,
2672 if not is_disabler(exe)
2674 manadocs += ['misc-utils/fincore.1.adoc']
2675 bashcompletions += ['fincore']
2681 include_directories : includes,
2682 link_with : [lib_common],
2683 install_dir : usrbin_exec_dir,
2685 if not is_disabler(exe)
2687 manadocs += ['misc-utils/hardlink.1.adoc']
2688 bashcompletions += ['hardlink']
2694 include_directories : includes,
2695 c_args : '-DTEST_CAL',
2696 link_with : [lib_common,
2698 dependencies : [curses_libs])
2699 if not is_disabler(exe)
2703 ############################################################
2705 opt = not get_option('build-schedutils').disabled()
2708 'schedutils/chrt.c',
2709 include_directories : includes,
2710 link_with : lib_common,
2711 install_dir : usrbin_exec_dir,
2713 build_by_default : opt)
2717 'schedutils/ionice.c',
2718 include_directories : includes,
2719 link_with : lib_common,
2720 install_dir : usrbin_exec_dir,
2722 build_by_default : opt)
2726 'schedutils/taskset.c',
2727 include_directories : includes,
2728 link_with : lib_common,
2729 install_dir : usrbin_exec_dir,
2731 build_by_default : opt)
2735 'schedutils/uclampset.c',
2736 include_directories : includes,
2737 link_with : lib_common,
2738 install_dir : usrbin_exec_dir,
2740 build_by_default : opt)
2742 if opt and not is_disabler(exe)
2743 exes += [exe, exe2, exe3, exe4]
2744 manadocs += ['schedutils/chrt.1.adoc',
2745 'schedutils/ionice.1.adoc',
2746 'schedutils/taskset.1.adoc',
2747 'schedutils/uclampset.1.adoc']
2748 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
2751 ############################################################
2753 # TODO: when autotools compat is not needed, s/_/-/g in file names?
2758 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
2759 include_directories : dir_include,
2760 link_with : lib_common)
2766 c_args : ['-DTEST_PROGRAM_BLKDEV'],
2767 include_directories : dir_include,
2768 link_with : lib_common)
2774 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
2775 include_directories : dir_include,
2776 link_with : lib_common)
2782 c_args : ['-DTEST_PROGRAM_MANGLE'],
2783 include_directories : dir_include)
2789 c_args : ['-DTEST_PROGRAM_STRUTILS'],
2790 include_directories : dir_include)
2796 'lib/color-names.c',
2797 c_args : ['-DTEST_PROGRAM_COLORS'],
2798 include_directories : dir_include,
2799 link_with : [lib_common, lib_tcolors])
2805 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
2806 include_directories : dir_include)
2809 # XXX: HAVE_OPENAT && HAVE_DIRFD
2813 c_args : ['-DTEST_PROGRAM_PROCFS'],
2814 include_directories : dir_include,
2815 link_with : lib_common)
2818 # XXX: HAVE_OPENAT && HAVE_DIRFD
2823 have_cpu_set_t ? 'lib/cpuset.c' : [],
2824 c_args : ['-DTEST_PROGRAM_PATH'],
2825 include_directories : dir_include,
2826 link_with : lib_common)
2834 c_args : ['-DTEST_PROGRAM_PTY'],
2835 include_directories : dir_include,
2836 link_with : [lib_common],
2837 dependencies : [lib_m,
2846 c_args : ['-DTEST_PROGRAM_CPUSET'],
2847 include_directories : dir_include)
2855 have_cpu_set_t ? 'lib/cpuset.c' : [],
2856 c_args : ['-DTEST_PROGRAM_SYSFS'],
2857 include_directories : dir_include)
2863 c_args : ['-DTEST_PROGRAM_PAGER'],
2864 include_directories : dir_include)
2868 'test_linux_version',
2869 'lib/linux_version.c',
2870 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
2871 include_directories : dir_include)
2877 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
2878 include_directories : dir_include)
2882 'test_canonicalize',
2883 'lib/canonicalize.c',
2884 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
2885 include_directories : dir_include)
2892 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
2893 include_directories : dir_include)
2899 c_args : ['-DTEST_PROGRAM'],
2900 include_directories : dir_include,
2901 link_with : lib_common)
2904 ############################################################
2908 'libuuid/src/test_uuid.c',
2909 include_directories : [dir_include, dir_libuuid],
2910 link_with : lib_uuid,
2911 dependencies : socket_libs)
2912 if not is_disabler(exe)
2916 ############################################################
2918 libfdisk_tests_cflags = ['-DTEST_PROGRAM',
2920 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
2924 'libfdisk/src/ask.c',
2925 c_args : libfdisk_tests_cflags,
2926 include_directories : lib_fdisk_includes,
2927 link_with : libfdisk_tests_ldadd)
2928 if not is_disabler(exe)
2934 'libfdisk/src/gpt.c',
2935 c_args : libfdisk_tests_cflags,
2936 include_directories : lib_fdisk_includes,
2937 link_with : libfdisk_tests_ldadd)
2938 if not is_disabler(exe)
2944 'libfdisk/src/utils.c',
2945 c_args : libfdisk_tests_cflags,
2946 include_directories : lib_fdisk_includes,
2947 link_with : libfdisk_tests_ldadd)
2948 if not is_disabler(exe)
2953 'test_fdisk_script',
2954 'libfdisk/src/script.c',
2955 c_args : libfdisk_tests_cflags,
2956 include_directories : lib_fdisk_includes,
2957 link_with : libfdisk_tests_ldadd)
2958 if not is_disabler(exe)
2963 'test_fdisk_version',
2964 'libfdisk/src/version.c',
2965 c_args : libfdisk_tests_cflags,
2966 include_directories : lib_fdisk_includes,
2967 link_with : libfdisk_tests_ldadd)
2968 if not is_disabler(exe)
2974 'libfdisk/src/item.c',
2975 c_args : libfdisk_tests_cflags,
2976 include_directories : lib_fdisk_includes,
2977 link_with : libfdisk_tests_ldadd)
2978 if not is_disabler(exe)
2982 sample_fdisk_cflags = ['-Wno-unused']
2983 sample_fdisk_ldadd = [lib_common, lib_fdisk]
2986 'sample-fdisk-mkpart',
2987 'libfdisk/samples/mkpart.c',
2988 c_args : sample_fdisk_cflags,
2989 include_directories : lib_fdisk_includes,
2990 link_with : sample_fdisk_ldadd)
2991 if not is_disabler(exe)
2996 'sample-fdisk-mkpart-fullspec',
2997 'libfdisk/samples/mkpart-fullspec.c',
2998 c_args : sample_fdisk_cflags,
2999 include_directories : lib_fdisk_includes,
3000 link_with : sample_fdisk_ldadd)
3001 if not is_disabler(exe)
3005 ############################################################
3009 'tests/helpers/test_mbsencode.c',
3010 include_directories : includes,
3011 link_with : lib_common)
3016 'tests/helpers/test_byteswap.c',
3017 include_directories : includes)
3022 'tests/helpers/test_md5.c',
3024 include_directories : includes)
3029 'tests/helpers/test_sha1.c',
3031 include_directories : includes)
3036 'tests/helpers/test_pathnames.c',
3037 include_directories : includes)
3042 'tests/helpers/test_strerror.c',
3043 include_directories : includes)
3048 'tests/helpers/test_sysinfo.c',
3049 include_directories : includes)
3054 'tests/helpers/test_sigreceive.c',
3055 include_directories : includes,
3056 link_with : lib_common)
3061 'tests/helpers/test_tiocsti.c',
3062 include_directories : includes)
3066 'test_uuid_namespace',
3067 'tests/helpers/test_uuid_namespace.c',
3071 include_directories : includes)
3074 ############################################################
3078 'sample-scols-tree',
3079 'libsmartcols/samples/tree.c',
3080 include_directories : includes,
3081 link_with : [lib_smartcols, lib_common])
3082 if not is_disabler(exe)
3087 'sample-scols-title',
3088 'libsmartcols/samples/title.c',
3089 include_directories : includes,
3090 link_with : [lib_smartcols, lib_common])
3091 if not is_disabler(exe)
3096 'sample-scols-wrap',
3097 'libsmartcols/samples/wrap.c',
3098 include_directories : includes,
3099 link_with : [lib_smartcols, lib_common])
3100 if not is_disabler(exe)
3105 'sample-scols-continuous',
3106 'libsmartcols/samples/continuous.c',
3107 include_directories : includes,
3108 link_with : [lib_smartcols, lib_common])
3109 if not is_disabler(exe)
3114 'sample-scols-maxout',
3115 'libsmartcols/samples/maxout.c',
3116 include_directories : includes,
3117 link_with : [lib_smartcols, lib_common])
3118 if not is_disabler(exe)
3123 'sample-scols-fromfile',
3124 'libsmartcols/samples/fromfile.c',
3125 include_directories : includes,
3126 link_with : [lib_smartcols, lib_common])
3127 if not is_disabler(exe)
3132 'sample-scols-grouping-simple',
3133 'libsmartcols/samples/grouping-simple.c',
3134 include_directories : includes,
3135 link_with : [lib_smartcols, lib_common])
3136 if not is_disabler(exe)
3141 'sample-scols-grouping-overlay',
3142 'libsmartcols/samples/grouping-overlay.c',
3143 include_directories : includes,
3144 link_with : [lib_smartcols, lib_common])
3145 if not is_disabler(exe)
3149 ############################################################
3151 # Let the test runner know whether we're running under asan and export
3152 # some paths. We use a file on disk so that it is possible to run the
3153 # test scripts from commandline without setting any variables.
3154 configure_file(output : 'meson.conf',
3159 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3162 run_sh = find_program('tests/run.sh')
3166 '--srcdir=' + meson.current_source_dir(),
3167 '--builddir=' + meson.current_build_dir(),
3173 manadocs += ['lib/terminal-colors.d.5.adoc']
3174 manadocs += ['libblkid/libblkid.3.adoc']
3178 'libuuid/man/uuid.3.adoc',
3179 'libuuid/man/uuid_clear.3.adoc',
3180 'libuuid/man/uuid_compare.3.adoc',
3181 'libuuid/man/uuid_copy.3.adoc',
3182 'libuuid/man/uuid_generate.3.adoc',
3183 'libuuid/man/uuid_is_null.3.adoc',
3184 'libuuid/man/uuid_parse.3.adoc',
3185 'libuuid/man/uuid_time.3.adoc',
3186 'libuuid/man/uuid_unparse.3.adoc']
3188 'uuid_generate_random.3': 'uuid_generate.3',
3189 'uuid_generate_time.3': 'uuid_generate.3',
3190 'uuid_generate_time_safe.3': 'uuid_generate.3',
3194 asciidoctor = find_program('asciidoctor', required : false)
3195 if asciidoctor.found()
3196 foreach adoc : manadocs
3197 name = adoc.split('/')[-1]
3198 page = name.split('.adoc')[0]
3199 section = page.split('.')[-1]
3200 mandirn = join_paths(mandir, 'man' + section)
3205 command : [ asciidoctor,
3207 '-a', 'VERSION=' + meson.project_version(),
3208 '-a', 'release-version=' + meson.project_version(),
3209 '-a', 'ADJTIME_PATH=/etc/adjtime',
3210 '-a', 'package-docdir=' + docdir,
3211 '--base-dir=' + meson.current_source_dir(),
3212 '--destination-dir=' + meson.current_build_dir(),
3217 install_dir : mandirn)
3220 foreach link_name, target : manlinks
3221 link_section = link_name.split('.')[-1]
3222 target_section = target.split('.')[-1]
3223 meson.add_install_script(meson_make_manpage_stub,
3224 join_paths('man' + target_section, target),
3225 join_paths(mandir, 'man' + link_section, link_name))
3229 if bash_completion.found()
3230 foreach completion : bashcompletions
3232 join_paths('bash-completion', completion),
3233 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3236 foreach link_name, target : bashcompletionslinks
3237 meson.add_install_script(meson_make_symlink,
3239 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))