From aa10b1d2da3ecf9672ae915a49073bd30ee0a785 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 23 Sep 2022 20:24:04 +0200 Subject: Add support for creating utmp records MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support for creating utmp records using the ‘utempter’ helper binary from the ‘libutempter’ package. * New config option ‘main.utempter’ * New meson command line option, -Ddefault-utempter-path. Defaults to auto-detecting the path. The default value of the new ‘main.utempter’ config option depends on the meson command line option ‘-Ddefault-utempter-path’. If ‘main.utempter’ is *not* set to ‘none’, foot will try to execute the utempter helper binary to create utmp records when a new terminal is instantiated. The record is removed when the terminal instance is destroyed. --- meson.build | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 61837459..4d3b6213 100644 --- a/meson.build +++ b/meson.build @@ -16,9 +16,30 @@ if cc.has_function('memfd_create') add_project_arguments('-DMEMFD_CREATE', language: 'c') endif +utempter_path = get_option('default-utempter-path') +if utempter_path == '' + utempter = find_program( + 'utempter', + required: false, + dirs: [join_paths(get_option('prefix'), get_option('libdir'), 'utempter'), + join_paths(get_option('prefix'), get_option('libexecdir'), 'utempter'), + '/usr/lib/utempter', + '/usr/libexec/utempter', + '/lib/utempter'] + ) + if utempter.found() + utempter_path = utempter.full_path() + else + utempter_path = '' + endif +elif utempter_path == 'none' + utempter_path = '' +endif + add_project_arguments( ['-D_GNU_SOURCE=200809L', - '-DFOOT_DEFAULT_TERM="@0@"'.format(get_option('default-terminfo'))] + + '-DFOOT_DEFAULT_TERM="@0@"'.format(get_option('default-terminfo')), + '-DFOOT_DEFAULT_UTEMPTER_PATH="@0@"'.format(utempter_path)] + (is_debug_build ? ['-D_DEBUG'] : [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) + @@ -321,6 +342,7 @@ summary( 'Themes': get_option('themes'), 'IME': get_option('ime'), 'Grapheme clustering': utf8proc.found(), + 'Utempter path': utempter_path, 'Build terminfo': tic.found(), 'Terminfo install location': terminfo_install_location, 'Default TERM': get_option('default-terminfo'), -- cgit v1.3