From 2229451f235b341bbfa97f3052f3ba7f0b1389c8 Mon Sep 17 00:00:00 2001 From: Joseph Benden Date: Wed, 26 Oct 2022 09:39:06 -0700 Subject: [PATCH] common/environment/setup/install.sh: add vterminfo Signed-off-by: Joseph Benden --- Manual.md | 9 +++++++- common/environment/setup/install.sh | 32 ++++++++++++++++++++++++++++- srcpkgs/alacritty/template | 3 +-- srcpkgs/mtm/template | 3 +-- srcpkgs/ncurses/template | 1 + srcpkgs/wezterm/template | 3 +-- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/Manual.md b/Manual.md index fa552f65ba5d..577911161d73 100644 --- a/Manual.md +++ b/Manual.md @@ -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()* ` []` +- *vcompletion()* `vcompletion []` 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 [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"`. diff --git a/common/environment/setup/install.sh b/common/environment/setup/install.sh index 5f0571de14ae..dfee3c9aafe0 100644 --- a/common/environment/setup/install.sh +++ b/common/environment/setup/install.sh @@ -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 @@ -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: [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 [ -n "$entries" ]; then + _args="-e ${entries}" + fi + + vmkdir "${_terminfo_dir}" + /usr/bin/tic -sx ${_args} -o "${PKGDESTDIR}/${_terminfo_dir}" "$file" +} diff --git a/srcpkgs/alacritty/template b/srcpkgs/alacritty/template index 57873e263b55..b993f7a6927b 100644 --- a/srcpkgs/alacritty/template +++ b/srcpkgs/alacritty/template @@ -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() { diff --git a/srcpkgs/mtm/template b/srcpkgs/mtm/template index 599fa463410d..c47c0e146904 100644 --- a/srcpkgs/mtm/template +++ b/srcpkgs/mtm/template @@ -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 } diff --git a/srcpkgs/ncurses/template b/srcpkgs/ncurses/template index 7a56c537bf2e..f6e0c8d471cd 100644 --- a/srcpkgs/ncurses/template +++ b/srcpkgs/ncurses/template @@ -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 -f ${DESTDIR}/usr/share/terminfo/w/wezterm } ncurses-libs_package() { diff --git a/srcpkgs/wezterm/template b/srcpkgs/wezterm/template index abd2a245845c..ab76fa37c5b1 100644 --- a/srcpkgs/wezterm/template +++ b/srcpkgs/wezterm/template @@ -44,8 +44,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