mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-27 06:46:44 -04:00
utmp: add suppport for FreeBSD
FreeBSD does not have utempter helper but instead have a ulog-helper which provides the same set of functionnality, but the call and arguments are slightly different.
This commit is contained in:
parent
c13495e26e
commit
aa2b29b1bd
4 changed files with 37 additions and 14 deletions
|
|
@ -344,8 +344,10 @@ empty string to be set, but it must be quoted: *KEY=""*)
|
||||||
some cases, the number of physical _cores_ is better.
|
some cases, the number of physical _cores_ is better.
|
||||||
|
|
||||||
*utempter*
|
*utempter*
|
||||||
Path to utempter helper binary. Set to *none* to disable utmp
|
Path to _@utempter_name@_ helper binary. Set to *none* to disable utmp
|
||||||
records. Default: _@utempter@_.
|
records. Default: _@utempter@_.
|
||||||
|
Foot will execute the binary with _@utempter_add@_ when starting
|
||||||
|
and with _@utempter_del@_ when exiting.
|
||||||
|
|
||||||
# SECTION: environment
|
# SECTION: environment
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ scdoc_prog = find_program(scdoc.get_variable('scdoc'), native: true)
|
||||||
|
|
||||||
if utempter_path == ''
|
if utempter_path == ''
|
||||||
default_utempter_value = 'not set'
|
default_utempter_value = 'not set'
|
||||||
|
utempter_name = 'none'
|
||||||
else
|
else
|
||||||
default_utempter_value = utempter_path
|
default_utempter_value = utempter_path
|
||||||
endif
|
endif
|
||||||
|
|
@ -12,6 +13,9 @@ conf_data = configuration_data(
|
||||||
{
|
{
|
||||||
'default_terminfo': get_option('default-terminfo'),
|
'default_terminfo': get_option('default-terminfo'),
|
||||||
'utempter': default_utempter_value,
|
'utempter': default_utempter_value,
|
||||||
|
'utempter_name': utempter_name,
|
||||||
|
'utempter_add': utempter_add,
|
||||||
|
'utempter_del': utempter_del,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
34
meson.build
34
meson.build
|
|
@ -18,28 +18,40 @@ endif
|
||||||
|
|
||||||
utempter_path = get_option('default-utempter-path')
|
utempter_path = get_option('default-utempter-path')
|
||||||
if utempter_path == ''
|
if utempter_path == ''
|
||||||
utempter = find_program(
|
host_system = host_machine.system()
|
||||||
'utempter',
|
if host_system == 'linux'
|
||||||
required: false,
|
utempter_path = join_paths(get_option('libdir'),'/utempter/utempter')
|
||||||
dirs: [join_paths(get_option('prefix'), get_option('libdir'), 'utempter'),
|
utempter_add = 'add'
|
||||||
join_paths(get_option('prefix'), get_option('libexecdir'), 'utempter'),
|
utempter_name = 'utempter'
|
||||||
'/usr/lib/utempter',
|
utempter_del_arguments = true
|
||||||
'/usr/libexec/utempter',
|
utempter_del = 'del'
|
||||||
'/lib/utempter']
|
elif host_system == 'freebsd'
|
||||||
)
|
utempter_path = '/usr/libexec/ulog-helper'
|
||||||
if utempter.found()
|
utempter_name = 'ulog-helper'
|
||||||
utempter_path = utempter.full_path()
|
utempter_add = 'login'
|
||||||
|
utempter_del_arguments = false
|
||||||
|
utempter_del = 'logout'
|
||||||
else
|
else
|
||||||
utempter_path = ''
|
utempter_path = ''
|
||||||
|
utempter_add = ''
|
||||||
|
utempter_del = ''
|
||||||
|
utempter_del_arguments = false
|
||||||
endif
|
endif
|
||||||
elif utempter_path == 'none'
|
elif utempter_path == 'none'
|
||||||
utempter_path = ''
|
utempter_path = ''
|
||||||
|
utempter_add = ''
|
||||||
|
utempter_del = ''
|
||||||
|
utempter_del_arguments = false
|
||||||
endif
|
endif
|
||||||
|
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
['-D_GNU_SOURCE=200809L',
|
['-D_GNU_SOURCE=200809L',
|
||||||
'-DFOOT_DEFAULT_TERM="@0@"'.format(get_option('default-terminfo')),
|
'-DFOOT_DEFAULT_TERM="@0@"'.format(get_option('default-terminfo')),
|
||||||
|
'-DFOOT_UTEMPTER_ADD="@0@"'.format(utempter_add),
|
||||||
|
'-DFOOT_UTEMPTER_DEL="@0@"'.format(utempter_del),
|
||||||
'-DFOOT_DEFAULT_UTEMPTER_PATH="@0@"'.format(utempter_path)] +
|
'-DFOOT_DEFAULT_UTEMPTER_PATH="@0@"'.format(utempter_path)] +
|
||||||
|
(utempter_del_arguments
|
||||||
|
? [ '-DFOOT_UTEMPTER_DEL_ARGUMENTS' ] : []) +
|
||||||
(is_debug_build
|
(is_debug_build
|
||||||
? ['-D_DEBUG']
|
? ['-D_DEBUG']
|
||||||
: [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
|
: [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
|
||||||
|
|
|
||||||
|
|
@ -212,19 +212,24 @@ add_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
|
||||||
if (conf->utempter_path == NULL)
|
if (conf->utempter_path == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
char *const argv[] = {conf->utempter_path, "add", getenv("WAYLAND_DISPLAY"), NULL};
|
char *const argv[] = {conf->utempter_path, FOOT_UTEMPTER_ADD, getenv("WAYLAND_DISPLAY"), NULL};
|
||||||
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
|
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
del_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
|
del_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
|
||||||
{
|
{
|
||||||
|
char *arg1 = NULL;
|
||||||
if (ptmx < 0)
|
if (ptmx < 0)
|
||||||
return true;
|
return true;
|
||||||
if (conf->utempter_path == NULL)
|
if (conf->utempter_path == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
#ifdef FOOT_UTEMPTER_DEL_ARGUMENTS
|
||||||
|
arg1 = getenv("WAYLAD_DISPLAY");
|
||||||
|
#endif
|
||||||
|
|
||||||
char *const argv[] = {conf->utempter_path, "del", getenv("WAYLAND_DISPLAY"), NULL};
|
char *const argv[] = {conf->utempter_path, FOOT_UTEMPTER_DEL, arg1, NULL};
|
||||||
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
|
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue