Skip to content

Commit

Permalink
common/environment/setup/install.sh: add vterminfo
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Benden <joe@benden.us>
  • Loading branch information
jbenden committed Oct 26, 2022
1 parent 59ab3e1 commit c77c1b9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 8 deletions.
9 changes: 8 additions & 1 deletion Manual.md
Expand Up @@ -323,13 +323,20 @@ The following functions are defined by `xbps-src` and can be used on any templat
Note that vsed will call the sed command for every regex specified against
every file specified, in the order that they are given.

- *vcompletion()* `<file> <shell> [<command>]`
- *vcompletion()* `vcompletion <file> <shell> [<command>]`

Installs shell completion from `file` for `command`, in the correct location
and with the appropriate filename for `shell`. If `command` isn't specified,
it will default to `pkgname`. The `shell` argument can be one of `bash`,
`fish` or `zsh`.

- *vterminfo()* `vterminfo <file> [entries]`

Processes `file` document via `tic(1)` to generate a terminfo database entry,
optionally for each of the specified `entries` terminfo entries. The produced
terminfo file is written to `masterdir/destdir` ready for package inclusion,
using say `vmove usr/share/terminfo`.

> Shell wildcards must be properly quoted, Example: `vmove "usr/lib/*.a"`.
<a id="global_vars"></a>
Expand Down
32 changes: 31 additions & 1 deletion common/environment/setup/install.sh
Expand Up @@ -13,7 +13,7 @@ _noglob_helper() {
}

# Apply _noglob to v* commands
for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv; do
for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv vterminfo; do
alias ${cmd}="set -f; _noglob_helper _${cmd}"
done

Expand Down Expand Up @@ -265,3 +265,33 @@ _vcompletion() {
;;
esac
}

_vterminfo() {
local file="$1" entries="$2"
local _terminfo_dir=usr/share/terminfo
local _args=

if [ $# -lt 1 ]; then
msg_red "$pkgver: vterminfo: at least 1 argument expected: <file> [entries]\n"
return 1
elif ! [ -f "$file" ]; then
msg_red "$pkgver: vterminfo: file '$file' does not exist.\n"
return 1
elif ! [ -r "$file" ]; then
msg_red "$pkgver: vterminfo: file '$file' is not readable.\n"
return 1
elif [ -z "$PKGDESTDIR" ]; then
msg_red "$pkgver: vterminfo: PKGDESTDIR unset, can't continue...\n"
return 1
elif ! [ -x /usr/bin/tic ]; then
msg_red "$pkgver: vterminfo: 'tic' binary is missing, can't continue...\n"
return 1
fi

if ! [ -z "$entries" ]; then
_args="-e ${entries}"
fi

vmkdir "${_terminfo_dir}"
/usr/bin/tic -sx ${_args} -o "${PKGDESTDIR}/${_terminfo_dir}" "$file"
}
3 changes: 1 addition & 2 deletions srcpkgs/alacritty/template
Expand Up @@ -30,8 +30,7 @@ post_install() {
vinstall extra/logo/alacritty-term.svg 644 usr/share/icons/hicolor/scalable/apps Alacritty.svg
vman extra/alacritty.man alacritty.1
vsconf alacritty.yml

tic -o ${DESTDIR}/usr/share/terminfo -xe alacritty,alacritty-direct extra/alacritty.info
vterminfo extra/alacritty.info alacritty,alacritty-direct
}

alacritty-terminfo_package() {
Expand Down
3 changes: 1 addition & 2 deletions srcpkgs/mtm/template
Expand Up @@ -17,8 +17,7 @@ do_build() {

do_install() {
vbin mtm
mkdir -p ${DESTDIR}/usr/share/terminfo
tic -sx -o ${DESTDIR}/usr/share/terminfo mtm.ti
vterminfo mtm.ti mtm,mtm-256color,mtm-noutf
vman mtm.1
}

Expand Down
1 change: 1 addition & 0 deletions srcpkgs/ncurses/template
Expand Up @@ -103,6 +103,7 @@ post_install() {
rm ${DESTDIR}/usr/share/terminfo/d/dvtm{,-256color}
rm ${DESTDIR}/usr/share/terminfo/s/st{,-256color}
rm ${DESTDIR}/usr/share/terminfo/f/foot{,-direct,+base}
rm ${DESTDIR}/usr/share/terminfo/w/wezterm
}

ncurses-libs_package() {
Expand Down
3 changes: 1 addition & 2 deletions srcpkgs/wezterm/template
Expand Up @@ -53,8 +53,7 @@ do_install() {
vcompletion assets/shell-completion/fish fish
vcompletion assets/shell-completion/zsh zsh

vmkdir usr/share/terminfo
tic -sx -o ${DESTDIR}/usr/share/terminfo termwiz/data/wezterm.terminfo
vterminfo termwiz/data/wezterm.terminfo

vdoc README.md
vlicense LICENSE.md
Expand Down

0 comments on commit c77c1b9

Please sign in to comment.