project('util-linux', 'c',
version : run_command('tools/git-version-gen', check: true).stdout(),
- meson_version: '>=0.57.0',
- license : 'GPLv2+')
+ meson_version: '>=0.60.0',
+ license : 'GPLv2+',
+ default_options : [
+ 'c_std=c99',
+ 'cpp_std=c++11',
+ ])
fs = import('fs')
pkgconfig = import('pkgconfig')
conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
-have_struct_statx = cc.sizeof('struct statx', prefix : '#include <linux/stat.h>') > 0
+have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
build_libmount = not get_option('build-libmount').disabled()
linux/fiemap.h
linux/gsmmux.h
linux/if_alg.h
+ linux/landlock.h
linux/kcmp.h
linux/net_namespace.h
linux/nsfs.h
linux/mount.h
linux/pr.h
- linux/stat.h
linux/securebits.h
linux/tiocl.h
linux/version.h
conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
+have = cc.has_function(
+ 'sd_session_get_username',
+ dependencies : lib_systemd)
+conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
+
lib_udev = dependency(
'libudev',
required : get_option('systemd'))
lib_cap_ng = dependency(
'libcap-ng',
required : get_option('build-setpriv'))
+if not lib_cap_ng.found()
+ lib_cap_ng = disabler()
+endif
lib_selinux = dependency(
'libselinux',
getsgnam
inotify_init
jrand48
+ landlock_create_ruleset
+ landlock_add_rule
+ landlock_restrict_self
lchown
lgetxattr
llistxattr
posix_fadvise
prctl
qsort_r
+ reallocarray
+ renameat2
rpmatch
scandirat
setprogname
conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
have = cc.has_member('struct statx', 'stx_mnt_id',
- prefix : '#include <linux/stat.h>')
+ prefix : '#include <sys/stat.h>')
conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
# replacement for AC_STRUCT_TIMEZONE
have = cc.compiles(code, name : 'using __progname')
conf.set('HAVE___PROGNAME', have ? 1 : false)
-have = conf.get('HAVE_PTY_H') != false and conf.get('HAVE_SYS_SIGNALFD_H') != false
+have = conf.get('HAVE_PTY_H').to_string() == '1' \
+ and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
conf.set('HAVE_PTY', have ? 1 : false)
have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
+is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
+
############################################################
have = get_option('use-tty-group')
conf.set('USE_TTY_GROUP', have ? 1 : false)
+bison = find_program('bison')
+flex = find_program('flex')
+
build_hwclock = not get_option('build-hwclock').disabled()
-bison = find_program('bison', required: build_hwclock)
bison_gen = generator(
bison,
output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
-
-
meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
'-Wunused-parameter',
'-Wunused-result',
'-Wunused-variable',
+ '-Wvla',
+ '-Walloca',
]
foreach compiler_flag : compiler_flags
if cc.has_argument(compiler_flag)
############################################################
-exe = executable(
- 'col',
- col_sources,
- include_directories : includes,
- link_with : lib_common,
- install_dir : usrbin_exec_dir,
- install : true)
-exes += exe
-manadocs += ['text-utils/col.1.adoc']
-bashcompletions += ['col']
+if is_glibc
+ exe = executable(
+ 'col',
+ col_sources,
+ include_directories : includes,
+ link_with : lib_common,
+ install_dir : usrbin_exec_dir,
+ install : true)
+ exes += exe
+ manadocs += ['text-utils/col.1.adoc']
+ bashcompletions += ['col']
+endif
exe = executable(
'colcrt',
bashcompletions += ['renice']
endif
+exe = executable(
+ 'setpgid',
+ setpgid_sources,
+ include_directories: includes,
+ link_with : [lib_common,
+ lib_smartcols],
+ install_dir : usrbin_exec_dir,
+ install : true)
+if opt and not is_disabler(exe)
+ exes += exe
+ manadocs += ['sys-utils/setpgid.1.adoc']
+ bashcompletions += ['setpgid']
+endif
+
exe = executable(
'setsid',
setsid_sources,
agetty_sources,
include_directories : includes,
link_with : [lib_common, logindefs_c],
- dependencies : BSD ? lib_util : [],
+ dependencies : [BSD ? lib_util : [], lib_systemd],
install_dir : sbindir,
install : opt,
build_by_default : opt)
wall_sources,
include_directories : includes,
link_with : [lib_common],
+ dependencies : [lib_systemd],
install_dir : usrbin_exec_dir,
- install_mode : 'rwxr-sr-x',
+ install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
install : opt,
build_by_default : opt)
if opt
write_sources,
include_directories : includes,
link_with : [lib_common],
+ dependencies : [lib_systemd],
install_dir : usrbin_exec_dir,
- install_mode : 'rwxr-sr-x',
+ install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
install : opt,
build_by_default : opt)
if opt
link_with : [lib_common,
lib_blkid,
lib_mount,
+ lib_tcolors,
lib_smartcols],
dependencies : lib_udev,
install : true)
bashcompletions += ['lsblk']
endif
+mq_libs = []
+mq_libs += cc.find_library('rt', required : true)
+
exe = executable(
'lsfd',
lsfd_sources,
include_directories : includes,
link_with : [lib_common,
lib_smartcols],
+ dependencies : mq_libs,
install_dir : usrbin_exec_dir,
install : true)
if not is_disabler(exe)
'uuidgen',
uuidgen_sources,
include_directories : includes,
- link_with : [lib_uuid],
+ link_with : [lib_common,
+ lib_uuid],
install_dir : usrbin_exec_dir,
install : true)
if not is_disabler(exe)
bashcompletions += ['fadvise']
endif
-if LINUX and conf.get('HAVE_PIDFD_OPEN') != false
+if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
exe = executable(
'waitpid',
waitpid_sources,
bashcompletions += ['lsclocks']
endif
+if conf.get('HAVE_RENAMEAT2').to_string() == '1'
+exe = executable(
+ 'exch',
+ exch_sources,
+ include_directories : includes,
+ link_with : [lib_common],
+ install_dir : usrbin_exec_dir,
+ install : true)
+if not is_disabler(exe)
+ exes += exe
+ manadocs += ['misc-utils/exch.1.adoc']
+ bashcompletions += ['exch']
+endif
+endif
+
############################################################
opt = not get_option('build-schedutils').disabled()
build_by_default: program_tests)
exes += exe
-if conf.get('HAVE_OPENAT') != false and conf.get('HAVE_DIRFD') != false
+if conf.get('HAVE_OPENAT').to_string() == '1' \
+ and conf.get('HAVE_DIRFD').to_string() == '1'
exe = executable(
'test_procfs',
'lib/procfs.c',
exes += exe
endif
-if conf.get('HAVE_PTY') != false
+if conf.get('HAVE_PTY').to_string() == '1'
exe = executable(
'test_pty',
pty_session_c,
############################################################
-libfdisk_tests_cflags = ['-DTEST_PROGRAM',
- '-Wno-unused']
+libfdisk_tests_cflags = ['-DTEST_PROGRAM']
libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
exe = executable(
exes += exe
endif
-sample_fdisk_cflags = ['-Wno-unused']
sample_fdisk_ldadd = [lib_common, lib_fdisk]
exe = executable(
'sample-fdisk-mkpart',
'libfdisk/samples/mkpart.c',
- c_args : sample_fdisk_cflags,
include_directories : lib_fdisk_includes,
link_with : sample_fdisk_ldadd)
if not is_disabler(exe)
exe = executable(
'sample-fdisk-mkpart-fullspec',
'libfdisk/samples/mkpart-fullspec.c',
- c_args : sample_fdisk_cflags,
include_directories : lib_fdisk_includes,
link_with : sample_fdisk_ldadd)
if not is_disabler(exe)
############################################################
+exe = executable(
+ 'test_cap',
+ 'tests/helpers/test_cap.c',
+ include_directories : includes,
+ dependencies : [lib_cap_ng],
+ build_by_default: program_tests)
+if not is_disabler(exe)
+ exes += exe
+endif
+
exe = executable(
'test_mbsencode',
'tests/helpers/test_mbsencode.c',
build_by_default: program_tests)
exes += exe
-mq_libs = []
-mq_libs += cc.find_library('rt', required : true)
-
if LINUX
exe = executable(
'test_mkfds',
'tests/helpers/test_mkfds.c',
+ 'tests/helpers/test_mkfds.h',
+ 'tests/helpers/test_mkfds_ppoll.c',
include_directories : includes,
dependencies : mq_libs,
build_by_default: program_tests)
############################################################
-if conf.get('HAVE_OPENAT') != false
+if conf.get('HAVE_OPENAT').to_string() == '1'
exe = executable(
'sample-scols-tree',
'libsmartcols/samples/tree.c',
exes += exe
endif
+exe = executable(
+ 'sample-scols-continuous-json',
+ 'libsmartcols/samples/continuous-json.c',
+ include_directories : includes,
+ link_with : [lib_smartcols, lib_common])
+if not is_disabler(exe)
+ exes += exe
+endif
+
exe = executable(
'sample-scols-maxout',
'libsmartcols/samples/maxout.c',