1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.57.0',
7 pkgconfig = import('pkgconfig')
9 libblkid_version = '1.1.0'
10 libblkid_date = '01-Jun-2021'
11 libuuid_version = '1.3.0'
12 libmount_version = '1.1.0'
13 libsmartcols_version = '1.1.0'
14 libfdisk_version = '1.1.0'
16 prefixdir = get_option('prefix')
17 if not prefixdir.startswith('/')
18 error('Prefix is not absolute: "@0@"'.format(prefixdir))
20 bindir = join_paths(prefixdir, get_option('bindir'))
21 sbindir = join_paths(prefixdir, get_option('sbindir'))
22 sysconfstaticdir = join_paths(prefixdir, 'lib')
23 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
24 mandir = join_paths(prefixdir, get_option('mandir'))
26 execprefixdir = prefixdir
27 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
28 usrbin_exec_dir = join_paths(execprefixdir, bindir)
29 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
30 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
32 vendordir = get_option('vendordir')
34 add_project_arguments('-D_GNU_SOURCE', language : 'c')
36 cc = meson.get_compiler('c')
38 conf = configuration_data()
39 conf.set_quoted('PACKAGE', meson.project_name())
40 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
41 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
42 conf.set_quoted('PACKAGE_STRING', package_string)
45 pc_version = meson.project_version().split('-')[0].split('.')
47 if pc_version.length() < 3
51 pc_version = '.'.join(pc_version)
53 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
54 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
56 conf.set('bindir', bindir)
57 conf.set('sbindir', sbindir)
58 conf.set('runstatedir', runstatedir)
59 conf.set('sysconfdir', sysconfdir)
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 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
79 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
80 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
82 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
83 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
85 build_libmount = not get_option('build-libmount').disabled()
86 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
87 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
88 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
89 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
91 build_libsmartcols = not get_option('build-libsmartcols').disabled()
92 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
93 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
95 build_libfdisk = not get_option('build-libfdisk').disabled()
96 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
97 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
99 build_uuidd = not get_option('build-uuidd').disabled()
100 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
101 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
103 static_programs = get_option('static-programs')
104 need_static_libs = static_programs.length() > 0 # a rough estimate...
105 summary('static programs', static_programs)
107 LINUX = host_machine.system() in ['linux']
108 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
110 ############################################################
128 have = cc.compiles(code, name : 'wchar_t support')
129 if not have and get_option('widechar').enabled()
130 error('widechar support requested but unavailable')
132 if get_option('ncurses').enabled() and get_option('widechar').enabled()
133 error('widechar support is incompatible with non-wide ncurses')
135 conf.set('HAVE_WIDECHAR', have ? 1 : false)
176 linux/net_namespace.h
222 lib_m = cc.find_library('m')
224 lib_tinfo = dependency(
226 required : get_option('tinfo'))
228 lib_ncursesw = dependency(
230 required : get_option('ncursesw'))
231 if lib_ncursesw.found()
232 headers += ['ncursesw/ncurses.h',
236 lib_ncurses = disabler()
238 lib_ncurses = dependency(
240 required : get_option('ncurses'))
241 headers += ['ncurses.h',
245 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
246 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
247 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
249 lib_slang = dependency(
251 required : get_option('slang'))
253 headers += ['slang.h',
258 conf.set('HAVE_SLANG', lib_slang.found())
260 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
261 if curses_libs.found()
262 have = cc.has_function('use_default_colors', dependencies : curses_libs)
263 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
264 have = cc.has_function('resizeterm', dependencies : curses_libs)
265 conf.set('HAVE_RESIZETERM', have ? 1 : false)
272 required : get_option('zlib'))
274 lib_readline = dependency(
276 required : get_option('readline'))
277 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
279 lib_readline_static = dependency(
282 required : need_static_libs ? get_option('readline') : disabler())
284 if meson.version().version_compare('>= 0.59.0')
285 lib_intl = dependency(
287 required : get_option('nls'))
288 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
290 if get_option('nls').enabled()
291 error('nls is not supported with meson before 0.59.0')
293 lib_intl = dependency('', required : false)
296 lib_user = dependency(
299 required : get_option('libuser'))
300 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
302 lib_util = cc.find_library(
304 required : get_option('libutil'))
305 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
307 lib_utempter = cc.find_library(
309 required : get_option('libutempter'))
310 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
312 systemd = dependency(
314 required : get_option('systemd'))
316 lib_systemd = dependency(
318 required : get_option('systemd'))
319 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
320 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
322 have = cc.has_function(
323 'sd_session_get_username',
324 dependencies : lib_systemd)
325 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
327 lib_udev = dependency(
329 required : get_option('systemd'))
330 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
332 lib_crypt = cc.find_library('crypt')
334 lib_pam = cc.find_library('pam', required : get_option('build-login'))
335 if not lib_pam.found()
336 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
338 if not lib_pam.found()
339 lib_pam = cc.find_library('pam', required : get_option('build-su'))
341 if not lib_pam.found()
342 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
345 lib_pam_misc = cc.find_library('pam_misc')
346 lib_pam = [lib_pam, lib_pam_misc]
348 lib_pam_misc = declare_dependency()
351 lib_cryptsetup = dependency(
353 required : get_option('cryptsetup'))
354 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
356 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
357 if meson.version().version_compare('>= 0.62.0')
358 lib_dl = dependency('dl')
360 lib_dl = cc.find_library('dl')
362 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
363 summary('cryptsetup support (dlopen)',
365 section : 'components')
367 summary('cryptsetup support',
368 lib_cryptsetup.found() ? 'enabled' : 'disabled',
369 section : 'components')
372 have = cc.has_function(
373 'crypt_activate_by_signed_key',
374 dependencies : lib_cryptsetup)
375 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
377 lib_cap_ng = dependency(
379 required : get_option('build-setpriv'))
380 if not lib_cap_ng.found()
381 lib_cap_ng = disabler()
384 lib_selinux = dependency(
387 required : get_option('selinux'))
388 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
390 lib_magic = dependency(
392 required : get_option('magic'))
393 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
395 lib_econf = dependency(
397 required : get_option('econf'))
398 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
400 lib_audit = dependency(
402 required : get_option('audit'))
403 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
405 conf.set('HAVE_SMACK', not get_option('smack').disabled())
407 foreach header : headers
408 have = cc.has_header(header)
409 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
412 header = 'linux/btrfs.h'
413 enable_btrfs = cc.has_header(header,
414 required : get_option('btrfs'))
415 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
416 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
418 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
423 have = cc.has_header(header,
425 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
428 have = cc.has_header('sched.h')
429 conf.set10('HAVE_DECL_CPU_ALLOC', have)
430 # We get -1 if the size cannot be determined
431 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
432 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
434 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
435 conf.set10('HAVE_ENVIRON_DECL', have)
437 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
438 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
440 have = cc.has_function('strsignal')
441 conf.set10('HAVE_STRSIGNAL_DECL', have)
443 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
444 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
446 have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
447 conf.set('HAVE_LOFF_T', have ? 1 : false)
449 have = cc.compiles('''
450 #define _GNU_SOURCE 1
451 #include <langinfo.h>
454 str = nl_langinfo (ALTMON_1);
455 str = nl_langinfo (ALTMON_2);
456 str = nl_langinfo (ALTMON_3);
457 str = nl_langinfo (ALTMON_4);
458 str = nl_langinfo (ALTMON_5);
459 str = nl_langinfo (ALTMON_6);
460 str = nl_langinfo (ALTMON_7);
461 str = nl_langinfo (ALTMON_8);
462 str = nl_langinfo (ALTMON_9);
463 str = nl_langinfo (ALTMON_10);
464 str = nl_langinfo (ALTMON_11);
465 str = nl_langinfo (ALTMON_12);
469 name : 'langinfo.h defines ALTMON_x constants')
470 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
472 have = cc.compiles('''
473 #define _GNU_SOURCE 1
474 #include <langinfo.h>
477 str = nl_langinfo (_NL_ABALTMON_1);
478 str = nl_langinfo (_NL_ABALTMON_2);
479 str = nl_langinfo (_NL_ABALTMON_3);
480 str = nl_langinfo (_NL_ABALTMON_4);
481 str = nl_langinfo (_NL_ABALTMON_5);
482 str = nl_langinfo (_NL_ABALTMON_6);
483 str = nl_langinfo (_NL_ABALTMON_7);
484 str = nl_langinfo (_NL_ABALTMON_8);
485 str = nl_langinfo (_NL_ABALTMON_9);
486 str = nl_langinfo (_NL_ABALTMON_10);
487 str = nl_langinfo (_NL_ABALTMON_11);
488 str = nl_langinfo (_NL_ABALTMON_12);
492 name : 'langinfo.h defines _NL_ABALTMON_x constants')
493 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
495 have = cc.compiles('''
496 #define _GNU_SOURCE 1
497 #include <langinfo.h>
500 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
504 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
505 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
599 have = cc.has_function(func)
600 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
601 # This makes little sense, but is necessary to avoid warnings about
602 # redefined macros from Python.h, which uses this convention.
603 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
606 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
607 conf.set('AGETTY_RELOAD', have ? 1 : false)
609 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
612 have_dirfd = (cc.has_function('dirfd') or
613 cc.has_header_symbol('dirent.h', 'dirfd',
614 prefix : '#include <sys/types.h>'))
615 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
617 have_ddfd = cc.has_member('DIR', 'dd_fd',
619 #include <sys/types.h>
622 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
624 have = cc.has_member('struct tm', 'tm_gmtoff',
629 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
633 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
634 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
636 have = cc.has_member('struct termios', 'c_line',
637 prefix : '#include <termios.h>')
638 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
640 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
641 prefix : '#include <sys/stat.h>')
642 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
644 have = cc.has_member('struct statx', 'stx_mnt_id',
645 prefix : '#include <sys/stat.h>')
646 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
648 # replacement for AC_STRUCT_TIMEZONE
649 have = cc.has_member('struct tm', 'tm_zone',
650 prefix : '#include <time.h>')
651 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
653 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
654 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
656 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
657 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
659 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
660 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
665 extern char *tzname[];
668 return tzname ? 0 : 1;
670 '''.format(have ? 1 : 0)
671 have = cc.compiles(code, name : 'using tzname[]')
672 conf.set('HAVE_TZNAME', have ? 1 : false)
675 if not cc.has_function('socket')
676 socket_libs += cc.find_library('socket', required : true)
677 have = cc.has_function('socket',
678 dependencies : socket_libs)
680 error('socket() function not available')
685 have = cc.has_function('clock_gettime')
687 realtime_libs += cc.find_library('rt', required : true)
688 have = cc.has_function('clock_gettime',
689 dependencies : realtime_libs)
691 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
693 thread_libs = dependency('threads')
695 have = cc.has_function('timer_create')
697 realtime_libs = [cc.find_library('rt', required : true)]
698 have = cc.has_function('timer_create',
699 dependencies : realtime_libs)
701 realtime_libs += thread_libs
702 have = cc.has_function('timer_create',
703 dependencies : realtime_libs)
706 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
708 have = cc.has_function('setitimer')
709 conf.set('HAVE_SETITIMER', have ? 1 : false)
712 rtas_libs = cc.find_library('rtas', required : false)
713 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
716 if not cc.has_header_symbol('math.h', 'isnan')
717 lib = cc.find_library('m', required : true)
718 if (cc.has_function('isnan', dependencies : lib) and
719 cc.has_function('__isnan', dependencies : lib))
724 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
725 args : '-D_GNU_SOURCE')
726 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
729 extern char *__progname;
731 return (*__progname != 0);
734 have = cc.compiles(code, name : 'using __progname')
735 conf.set('HAVE___PROGNAME', have ? 1 : false)
737 have = conf.get('HAVE_PTY_H').to_string() == '1' \
738 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
739 conf.set('HAVE_PTY', have ? 1 : false)
741 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
742 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
744 build_plymouth_support = get_option('build-plymouth-support')
745 have_tiocglcktrmios = cc.has_header_symbol(
746 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
747 required : build_plymouth_support.enabled())
748 have_sock_cloexec = cc.has_header_symbol(
749 'sys/socket.h', 'SOCK_CLOEXEC',
750 prefix : '#include <sys/types.h>',
751 required : build_plymouth_support.enabled())
752 have_sock_nonblock = cc.has_header_symbol(
753 'sys/socket.h', 'SOCK_NONBLOCK',
754 prefix : '#include <sys/types.h>',
755 required : build_plymouth_support.enabled())
756 have_so_passcred = cc.has_header_symbol(
757 'sys/socket.h', 'SO_PASSCRED',
758 prefix : '#include <sys/types.h>',
759 required : build_plymouth_support.enabled())
761 build_plymouth_support = (not build_plymouth_support.disabled() and
762 have_tiocglcktrmios and
763 have_sock_cloexec and
764 have_sock_nonblock and
766 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
767 summary('plymouth support',
768 build_plymouth_support ? 'enabled' : 'disabled',
769 section : 'components')
771 # check for valid fallocate() function
772 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
773 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
774 # and program can't be linked.
782 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
783 return ret == 0 ? 0 : 1;
786 have = cc.links(code, name : 'fallocate() function')
787 conf.set('HAVE_FALLOCATE', have ? 1 : false)
795 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
796 return ret == 0 ? 0 : 1;
799 have = cc.links(code, name : 'posix_fallocate() function')
800 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
802 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
803 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
804 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
806 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
807 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
808 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
810 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
812 ############################################################
815 fs_search_path = get_option('fs-search-path')
816 fs_search_path_extra = get_option('fs-search-path-extra')
817 if fs_search_path_extra != ''
818 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
820 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
822 systemdsystemunitdir = ''
824 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
827 sysvinit = get_option('sysvinit').enabled()
828 sysvinitrcdir = sysconfdir + '/init.d'
830 program_tests = get_option('program-tests')
832 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
833 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
835 have = get_option('chsh-only-listed')
836 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
838 have = get_option('use-tty-group')
839 conf.set('USE_TTY_GROUP', have ? 1 : false)
841 bison = find_program('bison')
842 flex = find_program('flex')
844 build_hwclock = not get_option('build-hwclock').disabled()
845 bison_gen = generator(
847 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
848 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
850 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
851 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
855 configuration : conf)
857 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
862 '-Waddress-of-packed-member',
863 '-Wdiscarded-qualifiers',
864 '-Wembedded-directive',
867 '-Wimplicit-function-declaration',
868 '-Wmissing-declarations',
869 '-Wmissing-parameter-type',
870 '-Wmissing-prototypes',
872 '-Wno-missing-field-initializers',
873 '-Wold-style-definition',
877 '-Wstrict-prototypes',
880 '-Wunused-but-set-parameter',
881 '-Wunused-but-set-variable',
882 '-Wunused-parameter',
888 foreach compiler_flag : compiler_flags
889 if cc.has_argument(compiler_flag)
890 add_project_arguments(compiler_flag, language : 'c')
898 bashcompletionslinks = {}
904 subdir('libsmartcols')
907 subdir('login-utils')
915 includes = [dir_include,
925 opt = not get_option('build-chfn-chsh').disabled()
930 include_directories : includes,
931 link_with : [lib_common, logindefs_c],
932 dependencies : chfn_chsh_deps,
933 install_dir : usrbin_exec_dir,
934 install_mode : 'rwsr-xr-x',
936 build_by_default : opt)
940 'login-utils/chsh.c',
943 include_directories : includes,
944 link_with : lib_common,
945 dependencies : chfn_chsh_deps,
946 install_dir : usrbin_exec_dir,
947 install_mode : 'rwsr-xr-x',
949 build_by_default : opt)
950 if opt and not is_disabler(exe)
952 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
953 bashcompletions += ['chfn', 'chsh']
958 test_islocal_sources,
959 include_directories : includes,
960 c_args : '-DTEST_PROGRAM',
961 build_by_default : program_tests)
966 test_consoles_sources,
967 c_args : ['-DTEST_PROGRAM'],
968 include_directories : includes,
969 link_with : lib_common,
970 build_by_default : program_tests)
973 opt = not get_option('build-last').disabled()
977 include_directories : includes,
978 link_with : [lib_common],
979 install_dir : usrbin_exec_dir,
981 build_by_default : opt)
982 if opt and not is_disabler(exe)
984 meson.add_install_script(meson_make_symlink,
986 join_paths(usrbin_exec_dir, 'lastb'))
987 manadocs += ['login-utils/last.1.adoc']
988 manlinks += {'lastb.1': 'last.1'}
989 bashcompletions += ['last']
990 bashcompletionslinks += {'lastb': 'last'}
993 opt = not get_option('build-nologin').disabled()
996 'login-utils/nologin.c',
997 include_directories : includes,
998 install_dir : sbindir,
999 link_with : [lib_common],
1001 build_by_default : opt)
1002 if opt and not is_disabler(exe)
1004 manadocs += ['login-utils/nologin.8.adoc']
1007 opt = not get_option('build-utmpdump').disabled()
1010 'login-utils/utmpdump.c',
1011 include_directories : includes,
1012 link_with : [lib_common],
1013 install_dir : usrbin_exec_dir,
1015 build_by_default : opt)
1016 if opt and not is_disabler(exe)
1018 manadocs += ['login-utils/utmpdump.1.adoc']
1019 bashcompletions += ['utmpdump']
1022 opt = not get_option('build-su').disabled()
1026 'login-utils/su-common.c',
1027 'login-utils/su-common.h',
1031 include_directories : includes,
1032 link_with : [lib_common, logindefs_c],
1033 dependencies : [lib_pam,
1037 install_mode : 'rwsr-xr-x',
1039 build_by_default : opt)
1040 if opt and not is_disabler(exe)
1042 manadocs += ['login-utils/su.1.adoc']
1043 bashcompletions += ['su']
1046 opt = not get_option('build-newgrp').disabled()
1049 'login-utils/newgrp.c',
1050 include_directories : includes,
1051 dependencies : [lib_crypt],
1052 install_dir : usrbin_exec_dir,
1053 install_mode : 'rwsr-xr-x',
1055 build_by_default : opt)
1056 if opt and not is_disabler(exe)
1058 manadocs += ['login-utils/newgrp.1.adoc']
1059 bashcompletions += ['newgrp']
1062 opt = not get_option('build-lslogins').disabled()
1065 'login-utils/lslogins.c',
1066 include_directories : includes,
1067 link_with : [lib_common,
1070 dependencies : [lib_selinux,
1072 install_dir : usrbin_exec_dir,
1074 build_by_default : opt)
1075 if opt and not is_disabler(exe)
1077 manadocs += ['login-utils/lslogins.1.adoc']
1078 bashcompletions += ['lslogins']
1081 opt = not get_option('build-vipw').disabled()
1084 'login-utils/vipw.c',
1085 'login-utils/setpwnam.h',
1086 include_directories : includes,
1087 link_with : [lib_common],
1088 dependencies : [lib_selinux],
1089 install_dir : usrbin_exec_dir,
1091 build_by_default : opt)
1092 if opt and not is_disabler(exe)
1094 meson.add_install_script(meson_make_symlink,
1096 join_paths(usrbin_exec_dir, 'vigr'))
1097 manadocs += ['login-utils/vipw.8.adoc']
1098 meson.add_install_script(meson_make_symlink,
1100 join_paths(mandir, 'man8/vigr.8'))
1103 opt = not get_option('build-runuser').disabled()
1106 'login-utils/runuser.c',
1107 'login-utils/su-common.c',
1108 'login-utils/su-common.h',
1112 include_directories : includes,
1113 link_with : [lib_common, logindefs_c],
1114 dependencies : [lib_pam,
1118 install_dir : sbindir,
1120 build_by_default : opt)
1121 if opt and not is_disabler(exe)
1123 manadocs += ['login-utils/runuser.1.adoc']
1124 bashcompletionslinks += {'runuser': 'su'}
1127 ############################################################
1133 include_directories : includes,
1134 link_with : lib_common,
1135 install_dir : usrbin_exec_dir,
1138 manadocs += ['text-utils/col.1.adoc']
1139 bashcompletions += ['col']
1145 include_directories : includes,
1146 install_dir : usrbin_exec_dir,
1149 manadocs += ['text-utils/colcrt.1.adoc']
1150 bashcompletions += ['colcrt']
1155 include_directories : includes,
1156 link_with : lib_common,
1157 install_dir : usrbin_exec_dir,
1160 manadocs += ['text-utils/colrm.1.adoc']
1161 bashcompletions += ['colrm']
1166 include_directories : includes,
1167 install_dir : usrbin_exec_dir,
1170 manadocs += ['text-utils/rev.1.adoc']
1171 bashcompletions += ['rev']
1176 include_directories : includes,
1177 link_with : [lib_common,
1179 install_dir : usrbin_exec_dir,
1181 if not is_disabler(exe)
1183 manadocs += ['text-utils/column.1.adoc']
1184 bashcompletions += ['column']
1187 opt = not get_option('build-line').disabled()
1191 include_directories : includes,
1192 install_dir : usrbin_exec_dir,
1194 build_by_default : opt)
1195 if opt and not is_disabler(exe)
1197 manadocs += ['text-utils/line.1.adoc']
1200 opt = not get_option('build-pg').disabled()
1204 link_with : lib_common,
1205 include_directories : includes,
1206 dependencies : [lib_tinfo,
1208 install_dir : usrbin_exec_dir,
1210 build_by_default : opt)
1211 if opt and not is_disabler(exe)
1213 manadocs += ['text-utils/pg.1.adoc']
1214 bashcompletions += ['pg']
1217 opt = not get_option('build-ul').disabled()
1221 include_directories : includes,
1222 dependencies : [lib_tinfo,
1224 install_dir : usrbin_exec_dir,
1226 build_by_default : opt)
1227 if opt and not is_disabler(exe)
1229 manadocs += ['text-utils/ul.1.adoc']
1230 bashcompletions += ['ul']
1233 opt = not get_option('build-more').disabled()
1237 link_with : [lib_common],
1238 include_directories : includes,
1239 dependencies : [lib_tinfo,
1243 build_by_default : opt)
1247 link_with : [lib_common],
1248 include_directories : includes,
1249 c_args : '-DTEST_PROGRAM',
1250 dependencies : [lib_tinfo,
1253 build_by_default : opt and program_tests)
1255 if opt and not is_disabler(exe)
1257 manadocs += ['text-utils/more.1.adoc']
1258 bashcompletions += ['more']
1264 include_directories : includes,
1265 link_with : [lib_common,
1267 install_dir : usrbin_exec_dir,
1269 if not is_disabler(exe)
1271 manadocs += ['text-utils/hexdump.1.adoc']
1272 bashcompletions += ['hexdump']
1275 opt = not get_option('build-lsmem').disabled()
1279 include_directories : includes,
1280 link_with : [lib_common,
1282 install_dir : usrbin_exec_dir,
1284 build_by_default : opt)
1285 if opt and not is_disabler(exe)
1287 manadocs += ['sys-utils/lsmem.1.adoc']
1288 bashcompletions += ['lsmem']
1291 opt = not get_option('build-chmem').disabled()
1295 include_directories : includes,
1296 link_with : [lib_common],
1297 install_dir : usrbin_exec_dir,
1299 build_by_default : opt)
1300 if opt and not is_disabler(exe)
1302 manadocs += ['sys-utils/chmem.8.adoc']
1303 bashcompletions += ['chmem']
1309 include_directories : includes,
1310 link_with : [lib_common],
1311 install_dir : usrbin_exec_dir,
1314 manadocs += ['sys-utils/choom.1.adoc']
1319 include_directories : includes,
1320 link_with : [lib_common],
1321 install_dir : usrbin_exec_dir,
1324 manadocs += ['sys-utils/ipcmk.1.adoc']
1325 bashcompletions += ['ipcmk']
1330 include_directories : includes,
1331 link_with : [lib_common],
1332 install_dir : usrbin_exec_dir,
1335 manadocs += ['sys-utils/ipcrm.1.adoc']
1336 bashcompletions += ['ipcrm']
1338 opt = not get_option('build-ipcs').disabled()
1342 include_directories : includes,
1343 link_with : [lib_common],
1344 install_dir : usrbin_exec_dir,
1346 build_by_default : opt)
1347 if opt and not is_disabler(exe)
1349 manadocs += ['sys-utils/ipcs.1.adoc']
1350 bashcompletions += ['ipcs']
1353 opt = not get_option('build-rfkill').disabled()
1357 include_directories : includes,
1358 link_with : [lib_common,
1360 install_dir : usrsbin_exec_dir,
1362 build_by_default : opt)
1363 if opt and not is_disabler(exe)
1365 manadocs += ['sys-utils/rfkill.8.adoc']
1366 bashcompletions += ['rfkill']
1372 include_directories : includes,
1373 link_with : [lib_common,
1375 install_dir : usrbin_exec_dir,
1377 if not is_disabler(exe)
1379 manadocs += ['sys-utils/renice.1.adoc']
1380 bashcompletions += ['renice']
1386 include_directories: includes,
1387 link_with : [lib_common,
1389 install_dir : usrbin_exec_dir,
1391 if opt and not is_disabler(exe)
1393 manadocs += ['sys-utils/setpgid.1.adoc']
1394 bashcompletions += ['setpgid']
1400 include_directories : includes,
1401 link_with : [lib_common,
1403 install_dir : usrbin_exec_dir,
1405 if opt and not is_disabler(exe)
1407 manadocs += ['sys-utils/setsid.1.adoc']
1408 bashcompletions += ['setsid']
1413 readprofile_sources,
1414 include_directories : includes,
1415 link_with : [lib_common,
1417 install_dir : usrsbin_exec_dir,
1419 if not is_disabler(exe)
1421 manadocs += ['sys-utils/readprofile.8.adoc']
1422 bashcompletions += ['readprofile']
1425 opt = not get_option('build-tunelp').disabled()
1429 include_directories : includes,
1430 link_with : [lib_common],
1431 install_dir : usrsbin_exec_dir,
1433 build_by_default : opt)
1434 if opt and not is_disabler(exe)
1436 manadocs += ['sys-utils/tunelp.8.adoc']
1437 bashcompletions += ['tunelp']
1443 include_directories : includes,
1444 link_with : [lib_common,
1446 install_dir : sbindir,
1448 if not is_disabler(exe)
1450 manadocs += ['sys-utils/fstrim.8.adoc']
1451 bashcompletions += ['fstrim']
1457 include_directories : includes,
1458 link_with : [lib_common,
1461 if not is_disabler(exe)
1463 manadocs += ['sys-utils/dmesg.1.adoc']
1464 bashcompletions += ['dmesg']
1470 include_directories : dir_include,
1471 c_args : '-DTEST_DMESG',
1472 link_with : [lib_common,
1474 build_by_default : program_tests)
1475 if not is_disabler(exe)
1482 include_directories : includes,
1483 link_with : [lib_common],
1484 install_dir : sbindir,
1487 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1488 bashcompletions += ['ctrlaltdel']
1493 include_directories : includes,
1494 install_dir : sbindir,
1497 manadocs += ['sys-utils/fsfreeze.8.adoc']
1498 bashcompletions += ['fsfreeze']
1503 include_directories : includes,
1504 link_with : [lib_common,
1506 install_dir : sbindir,
1509 manadocs += ['sys-utils/blkdiscard.8.adoc']
1510 bashcompletions += ['blkdiscard']
1515 include_directories : includes,
1516 link_with : [lib_common],
1517 install_dir : sbindir,
1520 manadocs += ['sys-utils/blkzone.8.adoc']
1521 bashcompletions += ['blkzone']
1526 include_directories : includes,
1527 link_with : [lib_common],
1528 install_dir : sbindir,
1531 manadocs += ['sys-utils/blkpr.8.adoc']
1536 include_directories : includes,
1537 link_with : [lib_common],
1538 install_dir : usrsbin_exec_dir,
1541 manadocs += ['sys-utils/ldattach.8.adoc']
1542 bashcompletions += ['ldattach']
1547 include_directories : includes,
1548 link_with : [lib_common],
1549 install_dir : usrsbin_exec_dir,
1552 manadocs += ['sys-utils/rtcwake.8.adoc']
1553 bashcompletions += ['rtcwake']
1558 include_directories : includes,
1559 link_with : [lib_common],
1560 install_dir : usrbin_exec_dir,
1563 manadocs += ['sys-utils/setarch.8.adoc']
1564 bashcompletions += ['setarch']
1566 setarch_links = ['uname26', 'linux32', 'linux64']
1567 setarch_links_arch = {
1568 's390x' : ['s390', 's390x'],
1570 'x86_64' : ['i386', 'x86_64'],
1571 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1572 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1573 'mips64' : ['mips', 'mips64', 'mips32'],
1574 'ia64' : ['i386', 'ia64'],
1575 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1577 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1579 foreach link: setarch_links
1580 meson.add_install_script(meson_make_symlink,
1582 join_paths(usrbin_exec_dir, link))
1583 manlinks += {link + '.8': 'setarch.8'}
1586 opt = not get_option('build-eject').disabled()
1590 include_directories : includes,
1591 link_with : [lib_common,
1593 install_dir : usrbin_exec_dir,
1595 build_by_default : opt)
1596 if opt and not is_disabler(exe)
1598 manadocs += ['sys-utils/eject.1.adoc']
1599 bashcompletions += ['eject']
1602 opt = not get_option('build-losetup').disabled()
1606 include_directories : includes,
1607 link_with : [lib_common,
1609 install_dir : sbindir,
1611 build_by_default : opt)
1612 if opt and not is_disabler(exe)
1613 manadocs += ['sys-utils/losetup.8.adoc']
1615 bashcompletions += ['losetup']
1618 opt = opt and 'losetup' in static_programs
1622 include_directories : includes,
1623 link_args : ['--static'],
1624 link_with : [lib_common,
1625 lib_smartcols.get_static_lib()],
1626 install_dir : sbindir,
1628 build_by_default : opt)
1629 if opt and not is_disabler(exe)
1633 opt = not get_option('build-zramctl').disabled()
1637 include_directories : includes,
1638 link_with : [lib_common,
1640 install_dir : sbindir,
1642 build_by_default : opt)
1643 if opt and not is_disabler(exe)
1645 manadocs += ['sys-utils/zramctl.8.adoc']
1646 bashcompletions += ['zramctl']
1652 include_directories : includes,
1653 link_with : [lib_common,
1655 install_dir : usrbin_exec_dir,
1657 if not is_disabler(exe)
1659 manadocs += ['sys-utils/prlimit.1.adoc']
1660 bashcompletions += ['prlimit']
1666 include_directories : includes,
1667 link_with : [lib_common,
1670 install_dir : usrbin_exec_dir,
1672 if not is_disabler(exe)
1674 manadocs += ['sys-utils/lsns.8.adoc']
1675 bashcompletions += ['lsns']
1678 opt = not get_option('build-mount').disabled()
1682 include_directories : includes,
1683 link_with : [lib_common,
1686 dependencies : lib_selinux,
1687 install_mode : 'rwsr-xr-x',
1689 build_by_default : opt)
1693 include_directories : includes,
1694 link_with : [lib_common,
1696 install_mode : 'rwsr-xr-x',
1698 build_by_default : opt)
1699 if opt and not is_disabler(exe)
1701 manadocs += ['sys-utils/fstab.5.adoc',
1702 'sys-utils/mount.8.adoc',
1703 'sys-utils/umount.8.adoc']
1704 bashcompletions += ['mount', 'umount']
1707 opt2 = opt and 'mount' in static_programs
1711 include_directories : includes,
1712 link_args : ['--static'],
1713 link_with : [lib_common,
1714 lib_smartcols_static,
1717 build_by_default : opt2)
1718 if opt2 and not is_disabler(exe)
1722 opt2 = opt and 'umount' in static_programs
1726 include_directories : includes,
1727 link_args : ['--static'],
1728 link_with : [lib_common,
1731 build_by_default : opt2)
1732 if opt2 and not is_disabler(exe)
1741 include_directories : includes,
1742 link_with : [lib_common,
1746 install_dir : sbindir,
1748 if not is_disabler(exe)
1750 manadocs += ['sys-utils/swapon.8.adoc']
1751 bashcompletions += ['swapon']
1757 include_directories : includes,
1758 link_with : [lib_common,
1761 install_dir : sbindir,
1763 if not is_disabler(exe)
1765 manlinks += {'swapoff.8': 'swapon.8'}
1766 bashcompletions += ['swapoff']
1772 include_directories : includes,
1773 link_with : [lib_common,
1775 dependencies : [rtas_libs],
1776 install_dir : usrbin_exec_dir,
1778 if not is_disabler(exe)
1780 manadocs += ['sys-utils/lscpu.1.adoc']
1781 bashcompletions += ['lscpu']
1787 include_directories : includes,
1788 link_with : [lib_common],
1789 install_dir : sbindir,
1792 manadocs += ['sys-utils/chcpu.8.adoc']
1793 bashcompletions += ['chcpu']
1798 include_directories : includes,
1799 link_with : [lib_common,
1802 if not is_disabler(exe)
1804 manadocs += ['sys-utils/wdctl.8.adoc']
1805 bashcompletions += ['wdctl']
1808 opt = not get_option('build-mountpoint').disabled()
1812 include_directories : includes,
1813 link_with : [lib_mount],
1815 build_by_default : opt)
1816 if opt and not is_disabler(exe)
1818 manadocs += ['sys-utils/mountpoint.1.adoc']
1819 bashcompletions += ['mountpoint']
1822 opt = not get_option('build-fallocate').disabled()
1826 include_directories : includes,
1827 link_with : [lib_common],
1828 install_dir : usrbin_exec_dir,
1830 build_by_default : opt)
1831 if opt and not is_disabler(exe)
1833 manadocs += ['sys-utils/fallocate.1.adoc']
1834 bashcompletions += ['fallocate']
1837 opt = not get_option('build-pivot_root').disabled()
1841 include_directories : includes,
1842 install_dir : sbindir,
1844 build_by_default : opt)
1845 if opt and not is_disabler(exe)
1847 manadocs += ['sys-utils/pivot_root.8.adoc']
1848 bashcompletions += ['pivot_root']
1851 opt = not get_option('build-switch_root').disabled()
1852 if opt and not have_dirfd and not have_ddfd
1853 error('neither dirfd nor ddfd are available')
1857 switch_root_sources,
1858 include_directories : includes,
1859 install_dir : sbindir,
1861 build_by_default : opt)
1862 if opt and not is_disabler(exe)
1864 manadocs += ['sys-utils/switch_root.8.adoc']
1867 opt = not get_option('build-unshare').disabled()
1871 include_directories : includes,
1872 link_with : [lib_common],
1873 install_dir : usrbin_exec_dir,
1875 build_by_default : opt)
1876 if opt and not is_disabler(exe)
1878 manadocs += ['sys-utils/unshare.1.adoc']
1879 bashcompletions += ['unshare']
1882 opt = opt and 'unshare' in static_programs
1886 include_directories : includes,
1887 link_with : [lib_common],
1888 install_dir : usrbin_exec_dir,
1890 build_by_default : opt)
1891 if opt and not is_disabler(exe)
1895 opt = not get_option('build-nsenter').disabled()
1899 include_directories : includes,
1900 link_with : [lib_common],
1901 dependencies : [lib_selinux],
1902 install_dir : usrbin_exec_dir,
1904 build_by_default : opt)
1905 if opt and not is_disabler(exe)
1907 manadocs += ['sys-utils/nsenter.1.adoc']
1908 bashcompletions += ['nsenter']
1911 opt = opt and 'nsenter' in static_programs
1915 include_directories : includes,
1916 link_with : [lib_common],
1917 dependencies : [lib_selinux],
1918 install_dir : usrbin_exec_dir,
1920 build_by_default : opt)
1921 if opt and not is_disabler(exe)
1925 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1929 include_directories : includes,
1930 link_with : [lib_common],
1931 dependencies : [lib_cap_ng],
1932 install_dir : usrbin_exec_dir,
1934 build_by_default : opt)
1935 if opt and not is_disabler(exe)
1937 manadocs += ['sys-utils/setpriv.1.adoc']
1938 bashcompletions += ['setpriv']
1944 include_directories : includes,
1945 link_with : [lib_common],
1946 dependencies : realtime_libs,
1947 install_dir : usrbin_exec_dir,
1950 manadocs += ['sys-utils/flock.1.adoc']
1951 bashcompletions += ['flock']
1953 opt = not get_option('build-lsirq').disabled()
1957 include_directories : includes,
1958 link_with : [lib_common,
1960 install_dir : usrbin_exec_dir,
1962 build_by_default : opt)
1963 if opt and not is_disabler(exe)
1965 manadocs += ['sys-utils/lsirq.1.adoc']
1966 bashcompletions += ['lsirq']
1969 opt = not get_option('build-irqtop').disabled()
1973 include_directories : includes,
1974 dependencies : [realtime_libs, curses_libs],
1975 link_with : [lib_common,
1978 install_dir : usrbin_exec_dir,
1980 build_by_default : opt)
1981 if opt and not is_disabler(exe)
1983 manadocs += ['sys-utils/irqtop.1.adoc']
1984 bashcompletions += ['irqtop']
1987 opt = not get_option('build-ipcs').disabled()
1991 include_directories : includes,
1992 link_with : [lib_common,
1994 install_dir : usrbin_exec_dir,
1996 build_by_default : opt)
1997 if opt and not is_disabler(exe)
1999 manadocs += ['sys-utils/lsipc.1.adoc']
2000 bashcompletions += ['lsipc']
2007 include_directories : includes,
2008 link_with : [lib_common],
2009 dependencies : [lib_m,
2011 install_dir : sbindir,
2013 build_by_default : opt)
2014 if opt and not is_disabler(exe)
2016 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2017 bashcompletions += ['hwclock']
2023 include_directories : includes,
2024 install_dir : sbindir,
2027 manadocs += ['disk-utils/mkfs.8.adoc']
2028 bashcompletions += ['mkfs']
2030 opt = not get_option('build-bfs').disabled()
2034 include_directories : includes,
2035 link_with : [lib_common],
2036 install_dir : sbindir,
2038 build_by_default : opt)
2039 if opt and not is_disabler(exe)
2041 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2042 bashcompletions += ['mkfs.bfs']
2048 include_directories : includes,
2049 link_with : [lib_common],
2050 install_dir : usrbin_exec_dir,
2053 manadocs += ['disk-utils/isosize.8.adoc']
2054 bashcompletions += ['isosize']
2059 include_directories : includes,
2060 link_with : [lib_common,
2063 dependencies: [lib_selinux],
2064 install_dir : sbindir,
2066 if opt and not is_disabler(exe)
2068 manadocs += ['disk-utils/mkswap.8.adoc']
2069 bashcompletions += ['mkswap']
2075 include_directories : includes,
2076 link_with : [lib_common,
2079 install_dir : sbindir,
2081 if opt and not is_disabler(exe)
2083 manadocs += ['disk-utils/swaplabel.8.adoc']
2084 bashcompletions += ['swaplabel']
2087 opt = not get_option('build-fsck').disabled()
2091 include_directories : includes,
2092 link_with : [lib_common,
2095 dependencies : realtime_libs,
2096 install_dir : sbindir,
2098 build_by_default : opt)
2099 if opt and not is_disabler(exe)
2101 manadocs += ['disk-utils/fsck.8.adoc']
2102 bashcompletions += ['fsck']
2105 opt = not get_option('build-minix').disabled()
2109 include_directories : includes,
2110 link_with : [lib_common],
2111 install_dir : sbindir,
2113 build_by_default : opt)
2117 include_directories : includes,
2118 c_args : '-DTEST_SCRIPT',
2119 link_with : [lib_common],
2120 build_by_default : opt and program_tests)
2124 include_directories : includes,
2125 link_with : [lib_common],
2126 install_dir : sbindir,
2128 build_by_default : opt)
2129 if opt and not is_disabler(exe)
2130 exes += [exe, exe2, exe3]
2131 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2132 bashcompletions += ['mkfs.minix', 'fsck.minix']
2135 opt = not get_option('build-cramfs').disabled()
2138 mkfs_cramfs_sources,
2139 include_directories : includes,
2140 link_with : [lib_common],
2141 dependencies : [lib_z],
2142 install_dir : sbindir,
2144 build_by_default : opt)
2147 fsck_cramfs_sources,
2148 include_directories : includes,
2149 link_with : [lib_common],
2150 dependencies : [lib_z],
2151 install_dir : sbindir,
2153 build_by_default : opt)
2154 if not is_disabler(exe)
2156 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2157 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2160 opt = not get_option('build-raw').disabled()
2162 cc.has_header('linux/raw.h', required: opt)
2167 include_directories : includes,
2168 install_dir : sbindir,
2170 build_by_default : opt)
2171 if opt and not is_disabler(exe)
2173 manadocs += ['disk-utils/raw.8.adoc']
2174 bashcompletions += ['raw']
2177 opt = not get_option('build-fdformat').disabled()
2181 include_directories : includes,
2182 link_with : [lib_common],
2183 install_dir : usrsbin_exec_dir,
2185 build_by_default : opt)
2186 if opt and not is_disabler(exe)
2188 manadocs += ['disk-utils/fdformat.8.adoc']
2194 include_directories : includes,
2195 link_with : [lib_common],
2196 install_dir : sbindir,
2198 manadocs += ['disk-utils/blockdev.8.adoc']
2199 bashcompletions += ['blockdev']
2201 opt = not get_option('build-fdisks').disabled()
2202 if opt and not have_dirfd and not have_ddfd
2203 error('neither dirfd nor ddfd are available')
2208 include_directories : includes,
2209 link_with : [lib_common,
2213 dependencies : [lib_readline],
2214 install_dir : sbindir,
2216 build_by_default : opt)
2217 if opt and not is_disabler(exe)
2219 bashcompletions += ['fdisk']
2222 opt2 = opt and 'fdisk' in static_programs
2226 link_args : ['--static'],
2227 include_directories : includes,
2228 link_with : [lib_common,
2231 lib_smartcols.get_static_lib()],
2232 dependencies : [lib_readline_static],
2233 install_dir : sbindir,
2235 build_by_default : opt2)
2236 if opt2 and not is_disabler(exe)
2243 include_directories : includes,
2244 link_with : [lib_common,
2248 dependencies : [lib_readline],
2249 install_dir : sbindir,
2251 build_by_default : opt)
2252 if opt and not is_disabler(exe)
2254 bashcompletions += ['sfdisk']
2257 opt2 = opt and 'sfdisk' in static_programs
2261 include_directories : includes,
2262 link_with : [lib_common,
2265 lib_smartcols.get_static_lib()],
2266 dependencies : [lib_readline_static],
2267 install_dir : sbindir,
2269 build_by_default : opt2)
2270 if opt2 and not is_disabler(exe)
2277 include_directories : includes,
2278 link_with : [lib_common,
2283 dependencies : [curses_libs],
2284 install_dir : sbindir,
2286 build_by_default : opt)
2287 if opt and not is_disabler(exe)
2289 manadocs += ['disk-utils/fdisk.8.adoc',
2290 'disk-utils/sfdisk.8.adoc',
2291 'disk-utils/cfdisk.8.adoc']
2292 bashcompletions += ['cfdisk']
2295 opt = not get_option('build-partx').disabled()
2299 include_directories : includes,
2300 link_with : [lib_common],
2301 install_dir : usrsbin_exec_dir,
2303 build_by_default : opt)
2307 include_directories : includes,
2308 link_with : [lib_common],
2309 install_dir : usrsbin_exec_dir,
2311 build_by_default : opt)
2315 include_directories : includes,
2316 link_with : [lib_common],
2317 install_dir : usrsbin_exec_dir,
2319 build_by_default : opt)
2323 include_directories : includes,
2324 link_with : [lib_common,
2327 install_dir : usrsbin_exec_dir,
2329 build_by_default : opt)
2331 exes += [exe, exe2, exe3, exe4]
2332 manadocs += ['disk-utils/addpart.8.adoc',
2333 'disk-utils/delpart.8.adoc',
2334 'disk-utils/resizepart.8.adoc',
2335 'disk-utils/partx.8.adoc']
2336 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2339 ############################################################
2344 include_directories : includes,
2345 link_with : [lib_common],
2346 dependencies : [lib_util,
2350 install_dir : usrbin_exec_dir,
2353 manadocs += ['term-utils/script.1.adoc']
2354 bashcompletions += ['script']
2359 include_directories : includes,
2360 c_args : '-DTEST_SCRIPT',
2361 link_with : [lib_common],
2362 dependencies : [lib_util,
2366 build_by_default : program_tests)
2372 include_directories : includes,
2373 link_with : [lib_common],
2374 dependencies : [lib_util,
2377 install_dir : usrbin_exec_dir,
2380 manadocs += ['term-utils/scriptlive.1.adoc']
2381 bashcompletions += ['scriptlive']
2385 scriptreplay_sources,
2386 include_directories : includes,
2387 link_with : [lib_common],
2388 dependencies : [math_libs],
2389 install_dir : usrbin_exec_dir,
2392 manadocs += ['term-utils/scriptreplay.1.adoc']
2393 bashcompletions += ['scriptreplay']
2395 opt = not get_option('build-agetty').disabled()
2399 include_directories : includes,
2400 link_with : [lib_common, logindefs_c],
2401 dependencies : [BSD ? lib_util : [], lib_systemd],
2402 install_dir : sbindir,
2404 build_by_default : opt)
2407 manadocs += ['term-utils/agetty.8.adoc']
2410 opt = not get_option('build-setterm').disabled()
2414 include_directories : includes,
2415 link_with : [lib_common],
2416 dependencies : [curses_libs],
2417 install_dir : usrbin_exec_dir,
2419 build_by_default : opt)
2422 manadocs += ['term-utils/setterm.1.adoc']
2423 bashcompletions += ['setterm']
2426 opt = not get_option('build-mesg').disabled()
2430 include_directories : includes,
2431 link_with : [lib_common],
2432 install_dir : usrbin_exec_dir,
2434 build_by_default : opt)
2437 manadocs += ['term-utils/mesg.1.adoc']
2438 bashcompletions += ['mesg']
2441 opt = not get_option('build-wall').disabled()
2445 include_directories : includes,
2446 link_with : [lib_common],
2447 dependencies : [lib_systemd],
2448 install_dir : usrbin_exec_dir,
2449 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2451 build_by_default : opt)
2454 manadocs += ['term-utils/wall.1.adoc']
2455 bashcompletions += ['wall']
2458 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2459 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2461 opt = not get_option('build-write').disabled()
2465 include_directories : includes,
2466 link_with : [lib_common],
2467 dependencies : [lib_systemd],
2468 install_dir : usrbin_exec_dir,
2469 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2471 build_by_default : opt)
2474 manadocs += ['term-utils/write.1.adoc']
2475 bashcompletions += ['write']
2478 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2479 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2481 opt = not get_option('build-login').disabled()
2485 include_directories : includes,
2486 link_with : [lib_common, logindefs_c],
2487 dependencies : [lib_pam,
2491 build_by_default : opt)
2492 if not is_disabler(exe)
2494 manadocs += ['login-utils/login.1.adoc']
2497 opt = not get_option('build-sulogin').disabled()
2501 include_directories : includes,
2502 link_with : [lib_common],
2503 dependencies : [lib_crypt,
2505 install_dir : sbindir,
2507 build_by_default : opt)
2508 if not is_disabler(exe)
2510 manadocs += ['login-utils/sulogin.8.adoc']
2516 include_directories : includes,
2517 link_with : [lib_common,
2519 dependencies : [curses_libs],
2520 install_dir : usrbin_exec_dir,
2523 manadocs += ['misc-utils/cal.1.adoc']
2524 bashcompletions += ['cal']
2526 opt = not get_option('build-logger').disabled()
2530 include_directories : includes,
2531 link_with : [lib_common],
2532 dependencies : [lib_systemd],
2533 install_dir : usrbin_exec_dir,
2535 build_by_default : opt)
2536 if opt and not is_disabler(exe)
2538 manadocs += ['misc-utils/logger.1.adoc']
2539 bashcompletions += ['logger']
2545 include_directories : includes,
2546 c_args : '-DTEST_LOGGER',
2547 link_with : [lib_common],
2548 dependencies : [lib_systemd],
2549 build_by_default: program_tests)
2550 if not is_disabler(exe)
2557 include_directories : includes,
2558 install_dir : usrbin_exec_dir,
2561 manadocs += ['misc-utils/look.1.adoc']
2562 bashcompletions += ['look']
2567 include_directories : includes,
2568 link_with : [lib_common],
2569 install_dir : usrbin_exec_dir,
2572 manadocs += ['misc-utils/mcookie.1.adoc']
2573 bashcompletions += ['mcookie']
2578 include_directories : includes,
2579 dependencies : [lib_selinux],
2580 install_dir : usrbin_exec_dir,
2583 manadocs += ['misc-utils/namei.1.adoc']
2584 bashcompletions += ['namei']
2589 include_directories : includes,
2590 link_with : [lib_common],
2591 install_dir : usrbin_exec_dir,
2594 manadocs += ['misc-utils/whereis.1.adoc']
2595 bashcompletions += ['whereis']
2600 include_directories : includes,
2601 link_with : [lib_common,
2604 install_dir : usrbin_exec_dir,
2606 if not is_disabler(exe)
2608 manadocs += ['misc-utils/lslocks.8.adoc']
2609 bashcompletions += ['lslocks']
2615 include_directories : includes,
2616 link_with : [lib_common,
2621 dependencies : lib_udev,
2623 if not is_disabler(exe)
2625 manadocs += ['misc-utils/lsblk.8.adoc']
2626 bashcompletions += ['lsblk']
2630 mq_libs += cc.find_library('rt', required : true)
2635 include_directories : includes,
2636 link_with : [lib_common,
2638 dependencies : mq_libs,
2639 install_dir : usrbin_exec_dir,
2641 if not is_disabler(exe)
2643 manadocs += ['misc-utils/lsfd.1.adoc']
2649 include_directories : includes,
2650 link_with : [lib_common,
2652 install_dir : usrbin_exec_dir,
2654 if not is_disabler(exe)
2656 manadocs += ['misc-utils/uuidgen.1.adoc']
2657 bashcompletions += ['uuidgen']
2663 include_directories : includes,
2664 link_with : [lib_common,
2667 install_dir : usrbin_exec_dir,
2669 if not is_disabler(exe)
2671 manadocs += ['misc-utils/uuidparse.1.adoc']
2672 bashcompletions += ['uuidparse']
2679 include_directories : includes,
2680 link_with : [lib_common,
2682 dependencies : [realtime_libs,
2684 install_dir : usrsbin_exec_dir,
2686 build_by_default : opt)
2690 include_directories : includes,
2691 link_with : [lib_common,
2693 dependencies : thread_libs,
2694 build_by_default : opt and program_tests)
2695 if not is_disabler(exe)
2697 manadocs += ['misc-utils/uuidd.8.adoc']
2698 bashcompletions += ['uuidd']
2701 opt = build_libblkid
2705 include_directories : includes,
2706 link_with : [lib_common,
2708 install_dir : sbindir,
2710 build_by_default : opt)
2711 if opt and not is_disabler(exe)
2713 manadocs += ['misc-utils/blkid.8.adoc']
2714 bashcompletions += ['blkid']
2717 opt = opt and 'blkid' in static_programs
2721 include_directories : includes,
2722 link_with : [lib_common,
2724 install_dir : sbindir,
2726 build_by_default : opt)
2727 if opt and not is_disabler(exe)
2733 'libblkid/samples/mkfs.c',
2734 include_directories : includes,
2735 link_with : lib_blkid)
2736 if not is_disabler(exe)
2741 'sample-partitions',
2742 'libblkid/samples/partitions.c',
2743 include_directories : includes,
2744 link_with : lib_blkid)
2745 if not is_disabler(exe)
2750 'sample-superblocks',
2751 'libblkid/samples/superblocks.c',
2752 include_directories : includes,
2753 link_with : lib_blkid)
2754 if not is_disabler(exe)
2760 'libblkid/samples/topology.c',
2761 include_directories : includes,
2762 link_with : lib_blkid)
2763 if not is_disabler(exe)
2768 'test_blkid_fuzz_sample',
2769 'libblkid/src/fuzz.c',
2770 include_directories: includes,
2771 link_with: lib_blkid,
2772 build_by_default: program_tests)
2773 if not is_disabler(exe)
2777 ############################################################
2782 include_directories : includes,
2783 link_with : [lib_blkid],
2784 install_dir : sbindir,
2786 if not is_disabler(exe)
2788 manadocs += ['misc-utils/findfs.8.adoc']
2789 bashcompletions += ['findfs']
2795 include_directories : includes,
2796 link_with : [lib_common,
2799 install_dir : sbindir,
2801 if not is_disabler(exe)
2803 manadocs += ['misc-utils/wipefs.8.adoc']
2804 bashcompletions += ['wipefs']
2810 include_directories : includes,
2811 link_with : [lib_common,
2815 dependencies : [lib_udev],
2817 if not is_disabler(exe)
2819 manadocs += ['misc-utils/findmnt.8.adoc']
2820 bashcompletions += ['findmnt']
2826 include_directories : includes,
2827 link_with : [lib_common],
2829 if not is_disabler(exe)
2831 manadocs += ['misc-utils/kill.1.adoc']
2834 opt = not get_option('build-rename').disabled()
2838 include_directories : includes,
2839 install_dir : usrbin_exec_dir,
2841 build_by_default : opt)
2842 if opt and not is_disabler(exe)
2844 manadocs += ['misc-utils/rename.1.adoc']
2845 bashcompletions += ['rename']
2851 include_directories : includes,
2852 link_with : [lib_common],
2853 install_dir : usrbin_exec_dir,
2856 manadocs += ['misc-utils/getopt.1.adoc']
2857 bashcompletions += ['getopt']
2862 include_directories : includes,
2863 link_with : [lib_common,
2865 install_dir : usrbin_exec_dir,
2867 if not is_disabler(exe)
2869 manadocs += ['misc-utils/fincore.1.adoc']
2870 bashcompletions += ['fincore']
2876 include_directories : includes,
2877 link_with : [lib_common],
2878 install_dir : usrbin_exec_dir,
2880 if not is_disabler(exe)
2882 manadocs += ['misc-utils/hardlink.1.adoc']
2883 bashcompletions += ['hardlink']
2886 opt = not get_option('build-pipesz').disabled()
2890 include_directories : includes,
2891 link_with : [lib_common],
2892 install_dir : usrbin_exec_dir,
2894 if opt and not is_disabler(exe)
2896 manadocs += ['misc-utils/pipesz.1.adoc']
2897 bashcompletions += ['pipesz']
2903 include_directories : includes,
2904 c_args : '-DTEST_CAL',
2905 link_with : [lib_common,
2907 dependencies : [curses_libs],
2908 build_by_default: program_tests)
2909 if not is_disabler(exe)
2916 include_directories : includes,
2917 link_with : [lib_common],
2918 install_dir : usrbin_exec_dir,
2920 if not is_disabler(exe)
2922 manadocs += ['misc-utils/fadvise.1.adoc']
2923 bashcompletions += ['fadvise']
2926 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2930 include_directories : includes,
2931 link_with : [lib_common],
2932 install_dir : usrbin_exec_dir,
2934 if not is_disabler(exe)
2936 manadocs += ['misc-utils/waitpid.1.adoc']
2937 bashcompletions += ['waitpid']
2941 syscalls_h = custom_target('syscalls.h',
2942 input : 'tools/all_syscalls',
2943 output : 'syscalls.h',
2944 command : ['tools/all_syscalls', cc.cmd_array()]
2947 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
2950 'misc-utils/enosys.c', syscalls_h,
2951 include_directories : includes,
2952 link_with : [lib_common],
2953 install_dir : usrbin_exec_dir,
2955 if not is_disabler(exe)
2957 manadocs += ['misc-utils/enosys.1.adoc']
2958 bashcompletions += ['enosys']
2965 include_directories : includes,
2966 link_with : [lib_common, lib_smartcols],
2967 install_dir : usrbin_exec_dir,
2969 if not is_disabler(exe)
2971 manadocs += ['misc-utils/lsclocks.1.adoc']
2972 bashcompletions += ['lsclocks']
2975 ############################################################
2977 opt = not get_option('build-schedutils').disabled()
2980 'schedutils/chrt.c',
2981 include_directories : includes,
2982 link_with : lib_common,
2983 install_dir : usrbin_exec_dir,
2985 build_by_default : opt)
2989 'schedutils/ionice.c',
2990 include_directories : includes,
2991 link_with : lib_common,
2992 install_dir : usrbin_exec_dir,
2994 build_by_default : opt)
2998 'schedutils/taskset.c',
2999 include_directories : includes,
3000 link_with : lib_common,
3001 install_dir : usrbin_exec_dir,
3003 build_by_default : opt)
3007 'schedutils/uclampset.c',
3008 include_directories : includes,
3009 link_with : lib_common,
3010 install_dir : usrbin_exec_dir,
3012 build_by_default : opt)
3014 if opt and not is_disabler(exe)
3015 exes += [exe, exe2, exe3, exe4]
3016 manadocs += ['schedutils/chrt.1.adoc',
3017 'schedutils/ionice.1.adoc',
3018 'schedutils/taskset.1.adoc',
3019 'schedutils/uclampset.1.adoc']
3020 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3023 ############################################################
3025 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3030 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3031 include_directories : dir_include,
3032 link_with : lib_common,
3033 build_by_default: program_tests)
3039 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3040 include_directories : dir_include,
3041 link_with : lib_common,
3042 build_by_default: program_tests)
3048 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3049 include_directories : dir_include,
3050 link_with : lib_common,
3051 build_by_default: program_tests)
3057 c_args : ['-DTEST_PROGRAM_MANGLE'],
3058 include_directories : dir_include,
3059 build_by_default: program_tests)
3065 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3066 include_directories : dir_include,
3067 build_by_default: program_tests)
3073 'lib/color-names.c',
3074 c_args : ['-DTEST_PROGRAM_COLORS'],
3075 include_directories : dir_include,
3076 link_with : [lib_common, lib_tcolors],
3077 build_by_default: program_tests)
3083 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3084 include_directories : dir_include,
3085 build_by_default: program_tests)
3088 if conf.get('HAVE_OPENAT').to_string() == '1' \
3089 and conf.get('HAVE_DIRFD').to_string() == '1'
3093 c_args : ['-DTEST_PROGRAM_PROCFS'],
3094 include_directories : dir_include,
3095 link_with : lib_common,
3096 build_by_default: program_tests)
3103 have_cpu_set_t ? 'lib/cpuset.c' : [],
3104 c_args : ['-DTEST_PROGRAM_PATH'],
3105 include_directories : dir_include,
3106 link_with : lib_common,
3107 build_by_default: program_tests)
3111 if conf.get('HAVE_PTY').to_string() == '1'
3116 c_args : ['-DTEST_PROGRAM_PTY'],
3117 include_directories : dir_include,
3118 link_with : [lib_common],
3119 dependencies : [lib_m,
3122 build_by_default: program_tests)
3130 c_args : ['-DTEST_PROGRAM_CPUSET'],
3131 include_directories : dir_include,
3132 build_by_default: program_tests)
3143 have_cpu_set_t ? 'lib/cpuset.c' : [],
3144 c_args : ['-DTEST_PROGRAM_SYSFS'],
3145 include_directories : dir_include,
3146 build_by_default: program_tests)
3152 c_args : ['-DTEST_PROGRAM_PAGER'],
3153 include_directories : dir_include,
3154 build_by_default: program_tests)
3158 'test_linux_version',
3159 'lib/linux_version.c',
3160 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3161 include_directories : dir_include,
3162 build_by_default: program_tests)
3168 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3169 include_directories : dir_include,
3170 build_by_default: program_tests)
3174 'test_canonicalize',
3175 'lib/canonicalize.c',
3176 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3177 include_directories : dir_include,
3178 build_by_default: program_tests)
3185 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3186 include_directories : dir_include,
3187 build_by_default: program_tests)
3193 c_args : ['-DTEST_PROGRAM'],
3194 include_directories : dir_include,
3195 link_with : lib_common,
3196 build_by_default: program_tests)
3202 c_args : ['-DTEST_PROGRAM'],
3203 include_directories : dir_include,
3204 link_with : [lib_common, logindefs_c],
3205 build_by_default: program_tests)
3209 ############################################################
3213 'libuuid/src/test_uuid.c',
3214 include_directories : [dir_include, dir_libuuid],
3215 link_with : lib_uuid,
3216 dependencies : socket_libs,
3217 build_by_default: program_tests)
3218 if not is_disabler(exe)
3222 ############################################################
3224 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3225 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3229 'libfdisk/src/ask.c',
3230 c_args : libfdisk_tests_cflags,
3231 include_directories : lib_fdisk_includes,
3232 link_with : libfdisk_tests_ldadd,
3233 build_by_default: program_tests)
3234 if not is_disabler(exe)
3240 'libfdisk/src/gpt.c',
3241 c_args : libfdisk_tests_cflags,
3242 include_directories : lib_fdisk_includes,
3243 link_with : libfdisk_tests_ldadd,
3244 build_by_default: program_tests)
3245 if not is_disabler(exe)
3251 'libfdisk/src/utils.c',
3252 c_args : libfdisk_tests_cflags,
3253 include_directories : lib_fdisk_includes,
3254 link_with : libfdisk_tests_ldadd,
3255 build_by_default: program_tests)
3256 if not is_disabler(exe)
3261 'test_fdisk_script',
3262 'libfdisk/src/script.c',
3263 c_args : libfdisk_tests_cflags,
3264 include_directories : lib_fdisk_includes,
3265 link_with : libfdisk_tests_ldadd,
3266 build_by_default: program_tests)
3267 if not is_disabler(exe)
3272 'test_fdisk_version',
3273 'libfdisk/src/version.c',
3274 c_args : libfdisk_tests_cflags,
3275 include_directories : lib_fdisk_includes,
3276 link_with : libfdisk_tests_ldadd,
3277 build_by_default: program_tests)
3278 if not is_disabler(exe)
3284 'libfdisk/src/item.c',
3285 c_args : libfdisk_tests_cflags,
3286 include_directories : lib_fdisk_includes,
3287 link_with : libfdisk_tests_ldadd,
3288 build_by_default: program_tests)
3289 if not is_disabler(exe)
3293 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3296 'sample-fdisk-mkpart',
3297 'libfdisk/samples/mkpart.c',
3298 include_directories : lib_fdisk_includes,
3299 link_with : sample_fdisk_ldadd)
3300 if not is_disabler(exe)
3305 'sample-fdisk-mkpart-fullspec',
3306 'libfdisk/samples/mkpart-fullspec.c',
3307 include_directories : lib_fdisk_includes,
3308 link_with : sample_fdisk_ldadd)
3309 if not is_disabler(exe)
3313 ############################################################
3317 'tests/helpers/test_cap.c',
3318 include_directories : includes,
3319 dependencies : [lib_cap_ng],
3320 build_by_default: program_tests)
3321 if not is_disabler(exe)
3327 'tests/helpers/test_mbsencode.c',
3328 include_directories : includes,
3329 link_with : lib_common,
3330 build_by_default: program_tests)
3335 'tests/helpers/test_byteswap.c',
3336 include_directories : includes,
3337 build_by_default: program_tests)
3342 'tests/helpers/test_md5.c',
3344 include_directories : includes,
3345 build_by_default: program_tests)
3350 'tests/helpers/test_sha1.c',
3352 include_directories : includes,
3353 build_by_default: program_tests)
3358 'tests/helpers/test_pathnames.c',
3359 include_directories : includes,
3360 build_by_default: program_tests)
3365 'tests/helpers/test_strerror.c',
3366 include_directories : includes,
3367 build_by_default: program_tests)
3372 'tests/helpers/test_sysinfo.c',
3373 include_directories : includes,
3374 build_by_default: program_tests)
3379 'tests/helpers/test_sigreceive.c',
3380 include_directories : includes,
3381 link_with : lib_common,
3382 build_by_default: program_tests)
3387 'tests/helpers/test_tiocsti.c',
3388 include_directories : includes,
3389 build_by_default: program_tests)
3393 'test_uuid_namespace',
3394 'tests/helpers/test_uuid_namespace.c',
3398 include_directories : includes,
3399 build_by_default: program_tests)
3405 'tests/helpers/test_mkfds.c',
3406 'tests/helpers/test_mkfds.h',
3407 'tests/helpers/test_mkfds_ppoll.c',
3408 include_directories : includes,
3409 dependencies : mq_libs,
3410 build_by_default: program_tests)
3416 'tests/helpers/test_enosys.c',
3417 include_directories : includes,
3418 build_by_default: program_tests)
3421 ############################################################
3423 if conf.get('HAVE_OPENAT').to_string() == '1'
3425 'sample-scols-tree',
3426 'libsmartcols/samples/tree.c',
3427 include_directories : includes,
3428 link_with : [lib_smartcols, lib_common],
3429 build_by_default: program_tests)
3430 if not is_disabler(exe)
3436 'sample-scols-title',
3437 'libsmartcols/samples/title.c',
3438 include_directories : includes,
3439 link_with : [lib_smartcols, lib_common])
3440 if not is_disabler(exe)
3445 'sample-scols-wrap',
3446 'libsmartcols/samples/wrap.c',
3447 include_directories : includes,
3448 link_with : [lib_smartcols, lib_common])
3449 if not is_disabler(exe)
3454 'sample-scols-continuous',
3455 'libsmartcols/samples/continuous.c',
3456 include_directories : includes,
3457 link_with : [lib_smartcols, lib_common])
3458 if not is_disabler(exe)
3463 'sample-scols-maxout',
3464 'libsmartcols/samples/maxout.c',
3465 include_directories : includes,
3466 link_with : [lib_smartcols, lib_common])
3467 if not is_disabler(exe)
3472 'sample-scols-fromfile',
3473 'libsmartcols/samples/fromfile.c',
3474 include_directories : includes,
3475 link_with : [lib_smartcols, lib_common])
3476 if not is_disabler(exe)
3481 'sample-scols-grouping-simple',
3482 'libsmartcols/samples/grouping-simple.c',
3483 include_directories : includes,
3484 link_with : [lib_smartcols, lib_common])
3485 if not is_disabler(exe)
3490 'sample-scols-grouping-overlay',
3491 'libsmartcols/samples/grouping-overlay.c',
3492 include_directories : includes,
3493 link_with : [lib_smartcols, lib_common])
3494 if not is_disabler(exe)
3498 ############################################################
3500 # Let the test runner know whether we're running under asan and export
3501 # some paths. We use a file on disk so that it is possible to run the
3502 # test scripts from commandline without setting any variables.
3503 configure_file(output : 'meson.conf',
3508 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3509 python.full_path())])
3511 run_sh = find_program('tests/run.sh')
3515 '--srcdir=' + meson.current_source_dir(),
3516 '--builddir=' + meson.current_build_dir(),
3522 manadocs += ['lib/terminal-colors.d.5.adoc']
3523 manadocs += ['libblkid/libblkid.3.adoc']
3527 'libuuid/man/uuid.3.adoc',
3528 'libuuid/man/uuid_clear.3.adoc',
3529 'libuuid/man/uuid_compare.3.adoc',
3530 'libuuid/man/uuid_copy.3.adoc',
3531 'libuuid/man/uuid_generate.3.adoc',
3532 'libuuid/man/uuid_is_null.3.adoc',
3533 'libuuid/man/uuid_parse.3.adoc',
3534 'libuuid/man/uuid_time.3.adoc',
3535 'libuuid/man/uuid_unparse.3.adoc']
3537 'uuid_generate_random.3': 'uuid_generate.3',
3538 'uuid_generate_time.3': 'uuid_generate.3',
3539 'uuid_generate_time_safe.3': 'uuid_generate.3',
3543 asciidoctor = find_program('asciidoctor', required : false)
3544 if asciidoctor.found()
3545 foreach adoc : manadocs
3546 name = adoc.split('/')[-1]
3547 page = name.split('.adoc')[0]
3548 section = page.split('.')[-1]
3549 mandirn = join_paths(mandir, 'man' + section)
3554 command : [ asciidoctor,
3556 '-a', 'VERSION=' + meson.project_version(),
3557 '-a', 'release-version=' + meson.project_version(),
3558 '-a', 'ADJTIME_PATH=/etc/adjtime',
3559 '-a', 'package-docdir=' + docdir,
3560 '--base-dir=' + meson.current_source_dir(),
3561 '--destination-dir=' + meson.current_build_dir(),
3562 '--load-path', '@SOURCE_ROOT@/tools',
3563 '--require', 'asciidoctor-includetracker',
3567 depfile : page + '.deps',
3569 install_dir : mandirn)
3572 foreach link_name, target : manlinks
3573 link_section = link_name.split('.')[-1]
3574 target_section = target.split('.')[-1]
3575 meson.add_install_script(meson_make_manpage_stub,
3576 join_paths('man' + target_section, target),
3577 join_paths(mandir, 'man' + link_section, link_name))
3581 if bash_completion.found()
3582 foreach completion : bashcompletions
3584 join_paths('bash-completion', completion),
3585 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3588 foreach link_name, target : bashcompletionslinks
3589 meson.add_install_script(meson_make_symlink,
3591 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))