diff --git a/INSTALL.md b/INSTALL.md index 81e9ec3e..6a380803 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -128,23 +128,35 @@ reasons for this: used by e.g. tmux. * New capabilities added to the `xterm-256color` terminfo could potentially break foot. +* There may be future additions or changes to foot’s terminfo. -As of ncurses 2021-07-31, ncurses ships a version of foot’s -terminfo. I still recommend building and installing the version -shipped with foot, since: +As of ncurses 2021-07-31, ncurses includes a version of foot’s +terminfo. **The recommendation is to use those**, and only install the +terminfo definitions from this git repo if the system’s ncurses +predates 2021-07-31. -* It will be more up to date (and more importantly, guaranteed to - match the installed version of foot). -* The ncurses version is missing several of the non-standard capabilities. +But, note that the foot terminfo definitions in ncurses’ lack the +non-standard capabilities. This mostly affects tmux; without them, +`terminal-overrides` must be configured to enable truecolor +support. For this reason, it _is_ possible to install “our” terminfo +definitions as well, either in a non-default location, or under a +different name. -Foot’s terminfo will by default be built, and installed along with -foot itself. This can be disabled (for example, to simplify packaging -when the terminfo definitions are packaged in a separate -package). Instructions on how to do so is in [terminfo](#terminfo). +Both have their set of issues. When installing to a non-default +location, foot will set the environment variable `TERMINFO` in the +child process. However, there are many situations where this simply +does not work. See https://codeberg.org/dnkl/foot/issues/695 for +details. -I recommend packaging foot’s terminfo files in a separate package, to -allow them to be installed on remote systems without having to install -foot itself. +Installing them under a different name generally works well, but will +break applications that check if `$TERM == foot`. + +Hence the recommendation to simply use ncurses’ terminfo definitions +if available. + +If packaging “our” terminfo definitions, I recommend doing that as a +separate package, to allow them to be installed on remote systems +without having to install foot itself. ### Setup @@ -158,44 +170,43 @@ mkdir -p bld/release && cd bld/release Available compile-time options: -| Option | Type | Default | Description | Extra dependencies | -|--------------------------------------|---------|----------------------------|----------------------------------|--------------------| -| `-Ddocs` | feature | `auto` | Builds and install documentation | scdoc | -| `-Dime` | bool | `true` | Enables IME support | None | -| `-Dgrapheme-clustering` | feature | `auto` | Enables grapheme clustering | libutf8proc | -| `-Dterminfo` | feature | `enabled` | Build and install terminfo files | tic (ncurses) | -| `-Ddefault-terminfo` | string | `foot` | Default value of `TERM` | none | -| `-Dcustom-terminfo-install-location` | string | `${datadir}/foot/terminfo` | Value to set `TERMINFO` to | None | +| Option | Type | Default | Description | Extra dependencies | +|--------------------------------------|---------|-----------------------|----------------------------------|--------------------| +| `-Ddocs` | feature | `auto` | Builds and install documentation | scdoc | +| `-Dime` | bool | `true` | Enables IME support | None | +| `-Dgrapheme-clustering` | feature | `auto` | Enables grapheme clustering | libutf8proc | +| `-Dterminfo` | feature | `enabled` | Build and install terminfo files | tic (ncurses) | +| `-Ddefault-terminfo` | string | `foot` | Default value of `TERM` | none | +| `-Dcustom-terminfo-install-location` | string | `${datadir}/terminfo` | Value to set `TERMINFO` to | None | Documentation includes the man pages, the example `foot.ini`, readme, changelog and license files. `-Ddefault-terminfo`: I strongly recommend leaving the default -value. This option is meant to be used as a last resort on platforms -where individual terminfo files cannot easily be installed. +value. Use this option if you plan on installing the terminfo files +under a different name. Setting this changes the default value of +`$TERM`, and the names of the terminfo files (if +`-Dterminfo=enabled`). `-Dcustom-terminfo-install-location` enables foot’s terminfo to -co-exist with ncurses’ version. The idea is that you install foot’s -terminfo to a non-standard location, for example -`/usr/share/foot/terminfo`. Use `-Dcustom-terminfo-install-location` -to tell foot where the terminfo is. Foot will set the environment -variable `TERMINFO` to this value (with `${prefix}` added). The value -is **relative to ${prefix}**. +co-exist with ncurses’ version, without changing the terminfo +names. The idea is that you install foot’s terminfo to a non-standard +location, for example `/usr/share/foot/terminfo`. Use +`-Dcustom-terminfo-install-location` to tell foot where the terminfo +is. Foot will set the environment variable `TERMINFO` to this value +(with `${prefix}` added). The value is **relative to ${prefix}**. -Conforming applications _should_ look in `TERMINFO` first, and -fallback to the builtin default (e.g. `/usr/share/terminfo`) if not -found. Thus, it will prefer foot’s version, if it exists (which it -typically will on localhost), and fallback to ncurses’ version if not -(e.g. on remote systems, where foot’s terminfo package has not been -installed). +Note that there are several issues with this approach: +https://codeberg.org/dnkl/foot/issues/695. -If set to `no`, foot will **not** set or modify `TERMINFO` at all. Use -this if you do not intend to use/support foot’s terminfo definitions -at all. +If left unset, foot will **not** set or modify `TERMINFO`. `-Dterminfo` can be used to disable building the terminfo definitions in the meson build. It does **not** change the default value of -`TERM`, and it does **not** disable `TERMINFO`. +`TERM`, and it does **not** disable `TERMINFO`, if +`-Dcustom-terminfo-install-location` has been set. Use this if +packaging the terminfo definitions in a separate package (and the +build script isn’t shared with the ‘foot’ package). Example: diff --git a/doc/foot.1.scd b/doc/foot.1.scd index 26fee4a1..bbe784bc 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -402,36 +402,6 @@ The following environment variables are set in the child process: set according to either the *--term* command-line option or the *term* config option in *foot.ini*(5). -*TERMINFO* - Path to foot's terminfo definitions. These are typically installed - in a non-standard location (though distributions may override - this), to allow them to co-exist with the foot terminfo - definitions in ncurses. Note that applications will search the - default location(s) if *TERM* does not exist in *TERMINFO*. - - Note that applications like *sudo*, *doas* and *ssh* may remove - this environment variable. - - For *sudo*, you can create a file under _/etc/sudoers.d_ (name - does not matter) with the following content: - - *Defaults env_keep += "TERMINFO"* - - For *doas*, edit _/etc/doas.conf_ and add: - - *permit setenv { TERMINFO } :wheel* - - Or, if you are not in the *wheel* group, replace *:wheel* with - your username. - - For *ssh*, you can edit _/etc/ssh/sshd_config_ (on the *server*), - and add: - - *SetEnv TERMINFO=*__ - - Where path is the location of the terminfo definitions on the - *server*, typically /usr/share/foot/terminfo. - *COLORTERM* This variable is set to *truecolor*, to indicate to client applications that 24-bit RGB colors are supported. diff --git a/doc/footclient.1.scd b/doc/footclient.1.scd index 6d5839f0..b252d5e1 100644 --- a/doc/footclient.1.scd +++ b/doc/footclient.1.scd @@ -146,36 +146,6 @@ The following environment variables are set in the child process: set according to either the *--term* command-line option or the *term* config option in *foot.ini*(5). -*TERMINFO* - Path to foot's terminfo definitions. These are typically installed - in a non-standard location (though distributions may override - this), to allow them to co-exist with the foot terminfo - definitions in ncurses. Note that applications will search the - default location(s) if *TERM* does not exist in *TERMINFO*. - - Note that applications like *sudo*, *doas* and *ssh* may remove - this environment variable. - - For *sudo*, you can create a file under _/etc/sudoers.d_ (name - does not matter) with the following content: - - *Defaults env_keep += "TERMINFO"* - - For *doas*, edit _/etc/doas.conf_ and add: - - *permit setenv { TERMINFO } :wheel* - - Or, if you are not in the *wheel* group, replace *:wheel* with - your username. - - For *ssh*, you can edit _/etc/ssh/sshd_config_ (on the *server*), - and add: - - *SetEnv TERMINFO=*__ - - Where path is the location of the terminfo definitions on the - *server*, typically /usr/share/foot/terminfo. - *COLORTERM* This variable is set to *truecolor*, to indicate to client applications that 24-bit RGB colors are supported. diff --git a/foot.info b/foot.info index 30e9e3de..f99e2aab 100644 --- a/foot.info +++ b/foot.info @@ -1,17 +1,17 @@ -foot|foot terminal emulator, - use=foot+base, +@default_terminfo@|foot terminal emulator, + use=@default_terminfo@+base, colors#256, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48\:5\:%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38\:5\:%p1%d%;m, -foot-direct|foot with direct color indexing, - use=foot+base, +@default_terminfo@-direct|foot with direct color indexing, + use=@default_terminfo@+base, colors#16777216, RGB, setab=\E[%?%p1%{8}%<%t4%p1%d%e48\:2\:\:%p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e38\:2\:\:%p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%d%;m, -foot+base|foot base fragment, +@default_terminfo@+base|foot base fragment, am, bce, bw, diff --git a/meson.build b/meson.build index d9762f91..81dc9006 100644 --- a/meson.build +++ b/meson.build @@ -35,17 +35,15 @@ add_project_arguments( language: 'c', ) -default_terminfo_install_location = join_paths(get_option('datadir'), 'foot', 'terminfo') terminfo_install_location = get_option('custom-terminfo-install-location') -if terminfo_install_location == '' - terminfo_install_location = default_terminfo_install_location -endif -if terminfo_install_location != 'no' +if terminfo_install_location != '' add_project_arguments( ['-DFOOT_TERMINFO_PATH="@0@"'.format( join_paths(get_option('prefix'), terminfo_install_location))], language: 'c') +else + terminfo_install_location = join_paths(get_option('datadir'), 'terminfo') endif # Compute the relative path used by compiler invocations. @@ -246,15 +244,24 @@ endif tic = find_program('tic', native: true, required: get_option('terminfo')) if tic.found() + conf_data = configuration_data( + { + 'default_terminfo': get_option('default-terminfo'), + } + ) + + preprocessed = configure_file( + input: 'foot.info', + output: 'foot.info.preprocessed', + configuration: conf_data, + ) custom_target( 'terminfo', - output: 'f', - input: 'foot.info', - command: [tic, '-x', '-o', '@OUTDIR@', '-e', 'foot,foot-direct', '@INPUT@'], + output: get_option('default-terminfo')[0], + input: preprocessed, + command: [tic, '-x', '-o', '@OUTDIR@', '-e', '@0@,@0@-direct'.format(get_option('default-terminfo')), '@INPUT@'], install: true, - install_dir: (terminfo_install_location != 'no' - ? terminfo_install_location - : default_terminfo_install_location) + install_dir: terminfo_install_location ) endif @@ -267,8 +274,9 @@ summary( 'IME': get_option('ime'), 'Grapheme clustering': utf8proc.found(), 'Build terminfo': tic.found(), + 'Terminfo install location': terminfo_install_location, 'Default TERM': get_option('default-terminfo'), - 'Terminfo custom install location': terminfo_install_location, + 'Set TERMINFO': get_option('custom-terminfo-install-location') != '', }, bool_yn: true ) diff --git a/meson_options.txt b/meson_options.txt index d133f106..b47cfc7b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,5 +11,5 @@ option('terminfo', type: 'feature', value: 'enabled', description: 'Build and in option('default-terminfo', type: 'string', value: 'foot', description: 'Default value of the "term" option in foot.ini.') -option('custom-terminfo-install-location', type: 'string', - description: 'Path to foot\'s terminfo, relative to ${prefix}. If set to anything but “no“, foot will set TERMINFO to this value in the client process.') +option('custom-terminfo-install-location', type: 'string', value: '', + description: 'Path to foot\'s terminfo, relative to ${prefix}. If set, foot will set $TERMINFO to this value in the client process.')