meson: add -Dterminfo-base-name option

This defines the base name of the generated terminfo files. It
defaults to the value of -Ddefault-terminfo (i.e. 'foot')

Example:

  meson -Ddefault-terminfo=foot-bananas -Dterminfo-base-name=foot-apples

The generated terminfo files will be

* terminfo/f/foot-apples
* terminfo/f/foot-apples-direct

The default value of $TERM will be 'foot-bananas'
This commit is contained in:
Daniel Eklöf 2023-07-26 16:14:38 +02:00
parent f3c5b82c82
commit 139fd6d55c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 29 additions and 6 deletions

View file

@ -48,6 +48,11 @@
### Added ### Added
* `[tweak].bold-text-in-bright-amount` option ([#1434][1434]). * `[tweak].bold-text-in-bright-amount` option ([#1434][1434]).
* `-Dterminfo-base-name` meson option, allowing you to name the
terminfo files to something other than `-Ddefault-terminfo`. Use
case: have foot default to using the terminfo from ncurses (`foot`,
`foot-direct`), while still packaging foot's terminfo files, but
under a different name (e.g. `foot-extra`, `foot-extra-direct`).
[1434]: https://codeberg.org/dnkl/foot/issues/1434 [1434]: https://codeberg.org/dnkl/foot/issues/1434

View file

@ -151,6 +151,7 @@ Available compile-time options:
| `-Dgrapheme-clustering` | feature | `auto` | Enables grapheme clustering | libutf8proc | | `-Dgrapheme-clustering` | feature | `auto` | Enables grapheme clustering | libutf8proc |
| `-Dterminfo` | feature | `enabled` | Build and install terminfo files | tic (ncurses) | | `-Dterminfo` | feature | `enabled` | Build and install terminfo files | tic (ncurses) |
| `-Ddefault-terminfo` | string | `foot` | Default value of `TERM` | None | | `-Ddefault-terminfo` | string | `foot` | Default value of `TERM` | None |
| `-Dterminfo-base-name` | string | `-Ddefault-terminfo` | Base name of the generated terminfo files | None |
| `-Dcustom-terminfo-install-location` | string | `${datadir}/terminfo` | Value to set `TERMINFO` to | None | | `-Dcustom-terminfo-install-location` | string | `${datadir}/terminfo` | Value to set `TERMINFO` to | None |
| `-Dsystemd-units-dir` | string | `${systemduserunitdir}` | Where to install the systemd service files (absolute) | None | | `-Dsystemd-units-dir` | string | `${systemduserunitdir}` | Where to install the systemd service files (absolute) | None |
| `-Dutmp-backend` | combo | `auto` | Which utmp backend to use (`none`, `libutempter`, `ulog` or `auto`) | libutempter or ulog | | `-Dutmp-backend` | combo | `auto` | Which utmp backend to use (`none`, `libutempter`, `ulog` or `auto`) | libutempter or ulog |
@ -165,8 +166,18 @@ under a different name. Setting this changes the default value of
`$TERM`, and the names of the terminfo files (if `$TERM`, and the names of the terminfo files (if
`-Dterminfo=enabled`). `-Dterminfo=enabled`).
`-Dcustom-terminfo-install-location` enables foots terminfo to If you want foot to use the terminfo files from ncurses, but still
co-exist with ncurses version, without changing the terminfo package foot's own terminfo files under a different name, you can use
the `-Dterminfo-base-name` option. Many distributions use the name
`foot-extra`, and thus it might be a good idea to re-use that:
```sh
meson ... -Ddefault-terminfo=foot -Dterminfo-base-name=foot-extra
```
(or just leave out `-Ddefault-terminfo`, since it defaults to `foot` anyway).
Finally, `-Dcustom-terminfo-install-location` enables foots terminfo
to co-exist with ncurses version, without changing the terminfo
names. The idea is that you install foots terminfo to a non-standard names. The idea is that you install foots terminfo to a non-standard
location, for example `/usr/share/foot/terminfo`. Use location, for example `/usr/share/foot/terminfo`. Use
`-Dcustom-terminfo-install-location` to tell foot where the terminfo `-Dcustom-terminfo-install-location` to tell foot where the terminfo

View file

@ -352,11 +352,16 @@ if get_option('themes')
install_subdir('themes', install_dir: join_paths(get_option('datadir'), 'foot')) install_subdir('themes', install_dir: join_paths(get_option('datadir'), 'foot'))
endif endif
terminfo_base_name = get_option('terminfo-base-name')
if terminfo_base_name == ''
terminfo_base_name = get_option('default-terminfo')
endif
tic = find_program('tic', native: true, required: get_option('terminfo')) tic = find_program('tic', native: true, required: get_option('terminfo'))
if tic.found() if tic.found()
conf_data = configuration_data( conf_data = configuration_data(
{ {
'default_terminfo': get_option('default-terminfo'), 'default_terminfo': terminfo_base_name
} }
) )
@ -367,9 +372,9 @@ if tic.found()
) )
custom_target( custom_target(
'terminfo', 'terminfo',
output: get_option('default-terminfo')[0], output: terminfo_base_name[0],
input: preprocessed, input: preprocessed,
command: [tic, '-x', '-o', '@OUTDIR@', '-e', '@0@,@0@-direct'.format(get_option('default-terminfo')), '@INPUT@'], command: [tic, '-x', '-o', '@OUTDIR@', '-e', '@0@,@0@-direct'.format(terminfo_base_name), '@INPUT@'],
install: true, install: true,
install_dir: terminfo_install_location install_dir: terminfo_install_location
) )
@ -395,6 +400,7 @@ summary(
'utmp backend': utmp_backend, 'utmp backend': utmp_backend,
'utmp helper default path': utmp_default_helper_path, 'utmp helper default path': utmp_default_helper_path,
'Build terminfo': tic.found(), 'Build terminfo': tic.found(),
'Terminfo base name': terminfo_base_name,
'Terminfo install location': terminfo_install_location, 'Terminfo install location': terminfo_install_location,
'Default TERM': get_option('default-terminfo'), 'Default TERM': get_option('default-terminfo'),
'Set TERMINFO': get_option('custom-terminfo-install-location') != '', 'Set TERMINFO': get_option('custom-terminfo-install-location') != '',

View file

@ -15,7 +15,8 @@ option('tests', type: 'boolean', value: true, description: 'Build tests')
option('terminfo', type: 'feature', value: 'enabled', description: 'Build and install foot\'s terminfo files.') option('terminfo', type: 'feature', value: 'enabled', description: 'Build and install foot\'s terminfo files.')
option('default-terminfo', type: 'string', value: 'foot', option('default-terminfo', type: 'string', value: 'foot',
description: 'Default value of the "term" option in foot.ini.') description: 'Default value of the "term" option in foot.ini.')
option('terminfo-base-name', type: 'string',
description: 'Base name of the generated terminfo files. Defaults to the value of the \'default-terminfo\' meson option')
option('custom-terminfo-install-location', type: 'string', value: '', 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.') description: 'Path to foot\'s terminfo, relative to ${prefix}. If set, foot will set $TERMINFO to this value in the client process.')