Allow installing terminfo files to a custom location #673

Manually merged
dnkl merged 1 commits from terminfo-dirs into master 4 months ago
dnkl commented 4 months ago
Owner

Ncurses 2021-07-31 added terminfo definitions for foot. Since they lack several non-standard capabilities (used by e.g. tmux), we still want to be able to use our own terminfo definitions.

The choices were to either rename our definitions, or install them to a custom location. Kitty, for example, calls its terminfo xterm-kitty, while ncurses calls it kitty. urxvt calls its terminfo rxvt-unicode{,-256color}, while ncurses calls it rxvt. Kitty also installs its terminfo to a custom location (/usr/lib/kitty/terminfo on Arch).

I'd rather not rename it. Being able to have the same name also means we can gracefully fallback to ncurses' version on e.g. remote systems where our terminfo hasn't been installed.

To facilitate this, the following changes have been made:

  • meson no longer builds or installs the terminfo files.
  • -Dterminfo has been changed to only control whether or not the terminfo definitions are built (and installed) or not. It no longer controls the default value of TERM.
  • INSTALL.md has been updated with information describing the terminfo situation, and how to actually build and package the terminfo files.
  • -Dterminfo has been removed (it controlled whether or not to build the terminfo definitions)
  • -Dterminfo-install-location has been renamed to -Dcustom-terminfo-install-location, and the custom value disabled is no longer supported.
  • When -Dcustom-terminfo-install-location is set to anything but no, foot will append this value to the TERMINFO_DIRS environment variable in the client application's process. The value is relative ${prefix}. The default is ${datadir}/foot/terminfo.

By appending to TERMINFO_DIRS, applications will search for the foot terminfo there first. If it can't find it there (for example, on remote systems where the foot terminfo definitions haven't been installed), the default location will be searched instead.

Thus, a distro that manually builds and packages (in a separate package) the terminfo files, could configure the foot build with:

meson -Dterminfo=disabled ...

This will result in a build that uses foot as the default TERM, with our terminfo files expected to be in ${prefix}/${datadir}/foot/terminfo (e.g. /usr/share/foot/terminfo).

To actually build the terminfo files you'd:

tic -o $DESTDIR/share/foot/terminfo -x -e foot,foot-direct foot.info

To complete disable "our" terminfo files, and instead rely completely on ncurses', you could do:

meson -Dterminfo=disabled -Dcustom-terminfo-install-location=no

Closes #671

Ncurses 2021-07-31 added terminfo definitions for foot. Since they lack several non-standard capabilities (used by e.g. tmux), we still want to be able to use our own terminfo definitions. The choices were to either rename our definitions, or install them to a custom location. Kitty, for example, calls its terminfo `xterm-kitty`, while ncurses calls it `kitty`. urxvt calls its terminfo `rxvt-unicode{,-256color}`, while ncurses calls it `rxvt`. Kitty _also_ installs its terminfo to a custom location (`/usr/lib/kitty/terminfo` on Arch). I'd rather _not_ rename it. Being able to have the same name also means we can gracefully fallback to ncurses' version on e.g. remote systems where our terminfo hasn't been installed. To facilitate this, the following changes have been made: * ~~meson no longer builds or installs the terminfo files.~~ * `-Dterminfo` has been changed to **only** control whether or not the terminfo definitions are built (and installed) or not. It no longer controls the default value of `TERM`. * INSTALL.md has been updated with information describing the terminfo situation, and how to actually build and package the terminfo files. * ~~`-Dterminfo` has been removed (it controlled whether or not to build the terminfo definitions)~~ * `-Dterminfo-install-location` has been renamed to `-Dcustom-terminfo-install-location`, and the custom value `disabled` is no longer supported. * When `-Dcustom-terminfo-install-location` is set to **anything but `no`**, foot will **append** this value to the `TERMINFO_DIRS` environment variable in the client application's process. The value is relative `${prefix}`. The default is `${datadir}/foot/terminfo`. By appending to `TERMINFO_DIRS`, applications will search for the `foot` terminfo there first. If it can't find it there (for example, on remote systems where the foot terminfo definitions haven't been installed), the default location will be searched instead. Thus, a distro that manually builds and packages (in a separate package) the terminfo files, could configure the foot build with: ```sh meson -Dterminfo=disabled ... ``` This will result in a build that uses `foot` as the default `TERM`, with our terminfo files expected to be in `${prefix}/${datadir}/foot/terminfo` (e.g. `/usr/share/foot/terminfo`). To actually build the terminfo files you'd: ```sh tic -o $DESTDIR/share/foot/terminfo -x -e foot,foot-direct foot.info ``` To complete disable "our" terminfo files, and instead rely completely on ncurses', you could do: ```sh meson -Dterminfo=disabled -Dcustom-terminfo-install-location=no ``` Closes #671
dnkl added the
enhancement
label 4 months ago
dnkl force-pushed terminfo-dirs from 2d56ee2e69 to 1aba2120de 4 months ago
Arnavion reviewed 4 months ago
INSTALL.md Outdated
* New capabilities added to the `xterm-256color` terminfo could
potentially break foot.
As of ncurses 2021-07-21, ncurses ships a version of foot’s
Poster
-As of ncurses 2021-07-21, ncurses ships a version of foot’s
+As of ncurses 2021-07-31, ncurses ships a version of foot’s
```diff -As of ncurses 2021-07-21, ncurses ships a version of foot’s +As of ncurses 2021-07-31, ncurses ships a version of foot’s ```
dnkl commented 4 months ago
Poster
Owner

Thanks! Fixed.

Thanks! Fixed.
dnkl marked this conversation as resolved
craigbarnes requested changes 4 months ago
craigbarnes left a comment

@dnkl The documentation looks good, aside from a few minor things noted below.

I'm running short of time, so I haven't looked at the other stuff for now.

INSTALL.md Outdated
The two `terminfo` options are related, but control different aspects
of how the terminfo files are built, installed and used.
`-Ddefault-terminfo`: I strongly recommend leaving the default
value. It is meant as a last resort on platforms where individual
Poster
Collaborator

It's slightly unclear what "it" is referring to here. I think it'd be clearer if the sentence started with e.g. "this option is meant to be used as a last resort...".

It's slightly unclear what "it" is referring to here. I think it'd be clearer if the sentence started with e.g. "this option is meant to be used as a last resort...".
dnkl commented 4 months ago
Poster
Owner

Changed to your suggested wording.

Changed to your suggested wording.
dnkl marked this conversation as resolved
INSTALL.md Outdated
`/usr/share/foot/terminfo`. Use `-Dcustom-terminfo-install-location`
to tell foot where the terminfo is. Foot will append this path to the
`TERMINFO_DIRS` environment variable in the client application’s
process. The value is **relative ${prefix}**.
Poster
Collaborator

I think this should be "relative to ${prefix}".

I think this should be "relative **to** ${prefix}".
dnkl commented 4 months ago
Poster
Owner

Fixed.

Fixed.
dnkl marked this conversation as resolved
INSTALL.md Outdated
`/usr/lib/foot/terminfo`. This is the value foot will append to the
`TERMINFO_DIRS` environment variable.
If `-Dterminfo` enabled (the default), then the terminfo files will be
Poster
Collaborator

s/enabled/is enabled/

s/enabled/is enabled/
dnkl commented 4 months ago
Poster
Owner

Fixed.

Fixed.
dnkl marked this conversation as resolved
dnkl force-pushed terminfo-dirs from c3ce16b10f to a35c5c2f77 4 months ago
dnkl force-pushed terminfo-dirs from 91f501af8e to 1048cdd74d 4 months ago
dnkl force-pushed terminfo-dirs from 1048cdd74d to 90b0d8bfd2 4 months ago
dnkl force-pushed terminfo-dirs from f9c071899e to 1f36120f8e 4 months ago
dnkl force-pushed terminfo-dirs from 1f36120f8e to da64010555 4 months ago
dnkl force-pushed terminfo-dirs from b6b816ee40 to 7639186865 4 months ago
dnkl merged commit f4da46350e into master manually 4 months ago

Reviewers

craigbarnes requested changes 4 months ago
The pull request has been manually merged as f4da46350e.
Sign in to join this conversation.
Loading…
There is no content yet.