From 76391868650240b2314a66d182e4d07cf8491f54 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 7 Aug 2021 16:42:51 +0200 Subject: terminfo: install to $datadir/foot/terminfo by default, append to TERMINFO_DIRS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of 2021-07-31, ncurses ships its own version of foot’s terminfo. Since: * It doesn’t have the non-standard Sync,Tc,setrgbf,setrgbb capabilities. * It doesn’t set hs,fsl,dsl (statusbar). * We want to be able to update our termminfo without waiting for an ncurses release. * Foot should be installable and usable on Linux systems that doesn’t have the latest ncurses. we still want to ship our own version. We can however not install it to the default terminfo location (e.g. /usr/share/terminfo), since it will collide with the ncurses provided files. Our options are to either rename our terminfo to something else, or to keep the name, but install our terminfo files somewhere else. The first option would be the easy one. However, I think it makes sense to use the same name. For example, a user that SSH’s into a remote system that does *not* have our own version installed, but *does* have the ncurses one, will gracefully fall back to that one, which is better than manually having to set e.g. TERM=xterm-256color. Now, if we want to use the same name, we need to install it somewhere else. But where? And how do we ensure our version is preferred over the ncurses one? I opted to $datadir/foot/terminfo (e.g. /usr/share/foot/terminfo) by default. It makes it namespaced to foot (i.e. we’re not introducing a new “standard” terminfo location), thus guaranteeing it wont collide with ncurses. To enable applications to find it, we export TERMINFO_DIRS. This is a list of *additional* directories to search for terminfo files. If it’s already defined, we *append* to it. The nice thing with this is, if there’s no terminfo in that location (e.g. when you SSH into a remote), the default terminfo location is *also* searched. But only *after* having searched through TERMINFO_DIRS. In short: our version is preferred, but the ncurses one (or an older version of our terminfo package!) will be used if ours cannot be found. To enable packagers full control over the new behavior, the existing meson command line options have been modified, and a new option added: -Dterminfo=disabled|enabled|auto: *build* and *install* the terminfo files. -Dcustom-terminfo-install-location=: *where* the terminfo files are expected to be found. This *needs* to be set *even* if -Dterminfo=disabled. For example, if the packaging script builds and packages the terminfo files separate from the regular foot build. The path is *relative to $prefix*, and defaults to $datadir/foot/terminfo. This is the value that will be appended to TERMINFO_DIRS. Note that you can set it to ‘no’, in which case foot will *not* set/modify TERMINFO_DIRS. Only do this if you don’t intend to package foot’s terminfo files at all (i.e. you plan on using the ncurses ones only). -Ddefault-terminfo=foot. Allows overriding the default TERM value. This should only be changed if the target platform doesn’t support terminfo files. Closes #671 --- doc/foot.1.scd | 2 +- doc/foot.ini.5.scd | 4 ++-- doc/footclient.1.scd | 2 +- doc/meson.build | 14 +++++++++++++- 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/foot.1.scd b/doc/foot.1.scd index afa6cf54..bbe784bc 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -57,7 +57,7 @@ the foot command line *-t*,*--term*=_TERM_ Value to set the environment variable *TERM* to (see *TERMINFO* - and *ENVIRONMENT*). Default: _foot_. + and *ENVIRONMENT*). Default: _@default_terminfo@_. *-T*,*--title*=_TITLE_ Initial window title. Default: _foot_. diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 1e9152aa..65a3a4dc 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -29,8 +29,8 @@ in this order: by prepending a '-' to argv[0]. Default: _no_. *term* - Value to set the environment variable *TERM* to. Default: _foot_ - or _xterm-256color_ if built with _-Dterminfo=disabled_ + Value to set the environment variable *TERM* to. Default: + _@default_terminfo@_ *font*, *font-bold*, *font-italic*, *font-bold-italic* Comma separated list of fonts to use, in fontconfig format. That diff --git a/doc/footclient.1.scd b/doc/footclient.1.scd index a002a899..b252d5e1 100644 --- a/doc/footclient.1.scd +++ b/doc/footclient.1.scd @@ -24,7 +24,7 @@ terminal has terminated. *-t*,*--term*=_TERM_ Value to set the environment variable *TERM* to (see *TERMINFO* - and *ENVIRONMENT*). Default: _foot_. + and *ENVIRONMENT*). Default: _@default_terminfo@_. *-T*,*--title*=_TITLE_ Initial window title. Default: _foot_. diff --git a/doc/meson.build b/doc/meson.build index a139d4c2..a8b086ef 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -2,6 +2,12 @@ sh = find_program('sh', native: true) scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) +conf_data = configuration_data( + { + 'default_terminfo': get_option('default-terminfo'), + } +) + foreach man_src : [{'name': 'foot', 'section' : 1}, {'name': 'foot.ini', 'section': 5}, {'name': 'footclient', 'section': 1}, @@ -10,10 +16,16 @@ foreach man_src : [{'name': 'foot', 'section' : 1}, section = man_src['section'] out = '@0@.@1@'.format(name, section) + preprocessed = configure_file( + input: '@0@.@1@.scd'.format(name, section), + output: '@0@.preprocessed'.format(out), + configuration: conf_data, + ) + custom_target( out, output: out, - input: '@0@.@1@.scd'.format(name, section), + input: preprocessed, command: [sh, '-c', '@0@ < @INPUT@'.format(scdoc_prog.path())], capture: true, install: true, -- cgit v1.3