wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.28k stars 781 forks source link

Include more data and asset files in AUR build #3008

Closed Mange closed 1 year ago

Mange commented 1 year ago

Applies to the wezterm-git AUR package.

Is your feature request related to a problem? Please describe.

I'd like to use the included terminfo file, and possibly also the shell-integration/wezterm.sh files, but they are not installed in the package.

Describe the solution you'd like

I suggest all data/ and assets/ files are installed in the package under /usr/share/wezterm so I can use them. Optionally, if the terminfo is installed in the global terminfo database (/usr/share/terminfo) then no user on the system will have to manually add it to their personal database.

Shell completions are usually also automatically installed globally.

I do not suggest automatically adding the shell-integration files to profile.d. This could be something a user opts-in to.

Describe alternatives you've considered

I could write a script that downloads the files from Github, but then the files won't necessarily be synced to the version from the current release that is installed on the machine.

It also duplicates effort that could be easily solved by including the files in the built package.

Additional context

I can submit a patch to the PKGBUILD on request. AUR does not have any sort of "PR" system in place, so either I send it by email or I paste it here. Let me know if you want it, how you want it delivered too. :slightly_smiling_face:

TheZoq2 commented 1 year ago

+1 The shell-integration files would be awesome to have included in the package

wez commented 1 year ago

I do not suggest automatically adding the shell-integration files to profile.d. This could be something a user opts-in to.

FWIW, the shell integration is minimally invasive, by design, so I think it is safe to install by default. Notably: gnome-terminal installs its own similar shell integration by default on Fedora/CentOS. In addition, it is very simple to completely disable without uninstalling it if that is desired.

I don't know how much of this translates to PKGBUILD, but you may find it useful to look at what the RPMs are installing and where:

https://github.com/wez/wezterm/blob/fcace3d5e3c9e9a65c9fcd0dce1cb9cf70fbee91/ci/deploy.sh#L161-L187

I can submit a patch to the PKGBUILD on request. AUR does not have any sort of "PR" system in place, so either I send it by email or I paste it here. Let me know if you want it, how you want it delivered too.

Yes please; I don't use arch so updating that stuff is extremely high friction for me, and I appreciate input from real users :)

In terms of submission, let's try using git format-patch; that should allow you to export a 1 or more commits as a file that you can attach here, and that I should be able to apply via git am.

Thanks!

Mange commented 1 year ago

include-assets-patches.zip


From 6a28589b0693f244b01517ba47f3f806a71c9739 Mon Sep 17 00:00:00 2001
From: Magnus Bergmark <me@mange.dev>
Date: Thu, 26 Jan 2023 20:09:45 +0100
Subject: [PATCH 1/3] Install terminfo file

---
 PKGBUILD | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PKGBUILD b/PKGBUILD
index ba8af70..10e98e6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -51,17 +51,22 @@ build() {
   cd $srcdir/wezterm
   bash ci/check-rust-version.sh
   cargo build --frozen --release
+  tic -x -o "$srcdir/terminfo" "$srcdir/wezterm/termwiz/data/wezterm.terminfo"
 }

 package() {
   cd $srcdir/wezterm
+
   install -Dsm755 target/release/wezterm $pkgdir/usr/bin/wezterm
   install -Dsm755 target/release/wezterm-gui $pkgdir/usr/bin/wezterm-gui
   install -Dsm755 target/release/wezterm-mux-server $pkgdir/usr/bin/wezterm-mux-server
   install -Dsm755 target/release/strip-ansi-escapes $pkgdir/usr/bin/strip-ansi-escapes
+
   install -Dm644 assets/icon/terminal.png $pkgdir/usr/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png
   install -Dm644 assets/wezterm.desktop $pkgdir/usr/share/applications/org.wezfurlong.wezterm.desktop
   install -Dm644 assets/wezterm.appdata.xml $pkgdir/usr/share/metainfo/org.wezfurlong.wezterm.appdata.xml
+  install -Dm644 ../terminfo/w/wezterm "$pkgdir/usr/share/terminfo/w/wezterm"
+
   install -Dm644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
 }

-- 
2.39.0

From 47800f607b2d5f6d24ee5095e6a747170cf465a2 Mon Sep 17 00:00:00 2001
From: Magnus Bergmark <me@mange.dev>
Date: Thu, 26 Jan 2023 20:11:03 +0100
Subject: [PATCH 2/3] Install extra assets

Install shell completions for Bash, ZSH, and Fish. Also install nautilus
plugin, the same way as it is done in the RPM packages.
---
 PKGBUILD | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PKGBUILD b/PKGBUILD
index 10e98e6..dc071ec 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -65,8 +65,14 @@ package() {
   install -Dm644 assets/icon/terminal.png $pkgdir/usr/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png
   install -Dm644 assets/wezterm.desktop $pkgdir/usr/share/applications/org.wezfurlong.wezterm.desktop
   install -Dm644 assets/wezterm.appdata.xml $pkgdir/usr/share/metainfo/org.wezfurlong.wezterm.appdata.xml
+  install -Dm644 assets/wezterm-nautilus.py $pkgdir/usr/share/nautilus-python/extensions/wezterm-nautilus.py
   install -Dm644 ../terminfo/w/wezterm "$pkgdir/usr/share/terminfo/w/wezterm"

+  install -Dm644 assets/shell-integration/wezterm.sh "$pkgdir/etc/profile.d/wezterm.sh"
+  install -Dm644 assets/shell-completion/bash "$pkgdir/usr/share/bash-completion/completions/wezterm"
+  install -Dm644 assets/shell-completion/zsh "$pkgdir/usr/share/zsh/site-functions/_wezterm"
+  install -Dm644 assets/shell-completion/fish "$pkgdir/usr/share/fish/completions/wezterm.fish"
+
   install -Dm644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
 }

-- 
2.39.0

From 99af97872ded625f1807256b15b6f65073da8b6b Mon Sep 17 00:00:00 2001
From: Magnus Bergmark <me@mange.dev>
Date: Thu, 26 Jan 2023 20:12:01 +0100
Subject: [PATCH 3/3] Reformat script file to prevent mistakes

Although on a standard configuration `makepkg` might use directories
without any spaces or special characters, these directores can be
overridden on some user's machines. Quoting variables that may contain
spaces prevents that from causing incorrect output.

Also exit if a `cd` fails for any reason.

Bumped all versions in the script.
---
 .SRCINFO |  4 ++--
 PKGBUILD | 37 ++++++++++++++++++-------------------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/.SRCINFO b/.SRCINFO
index 10e57d1..6fcb8b1 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
 pkgbase = wezterm-git
    pkgdesc = A terminal emulator implemented in Rust, using OpenGL ES 2 for rendering.
-   pkgver = 20210916.085405.e36cf754
-   pkgrel = 3
+   pkgver = 20230125.180646.f15bb186
+   pkgrel = 1
    url = https://github.com/wez/wezterm
    arch = x86_64
    arch = i686
diff --git a/PKGBUILD b/PKGBUILD
index dc071ec..6b85d22 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,8 +3,8 @@

 pkgname=("wezterm-git")
 pkgdesc="A terminal emulator implemented in Rust, using OpenGL ES 2 for rendering."
-pkgver=20210916.085405.e36cf754
-pkgrel=3
+pkgver=20230125.180646.f15bb186
+pkgrel=1
 arch=("x86_64" "i686")
 url="https://github.com/wez/wezterm"
 license=("MIT")
@@ -32,40 +32,40 @@ source=(
 sha256sums=("SKIP" "SKIP" "SKIP" "SKIP" "SKIP")

 prepare() {
-  cd $srcdir/wezterm
+  cd "$srcdir/wezterm"
   git submodule init
-  git config -f .gitmodules "submodule.harfbuzz/harfbuzz.url" $srcdir/harfbuzz
-  git config -f .gitmodules "submodule.freetype/libpng.url" $srcdir/libpng
-  git config -f .gitmodules "submodule.deps/freetype/zlib.url" $srcdir/zlib
-  git config -f .gitmodules "submodule.freetype2.url" $srcdir/freetype2
+  git config -f .gitmodules "submodule.harfbuzz/harfbuzz.url" "$srcdir/harfbuzz"
+  git config -f .gitmodules "submodule.freetype/libpng.url" "$srcdir/libpng"
+  git config -f .gitmodules "submodule.deps/freetype/zlib.url" "$srcdir/zlib"
+  git config -f .gitmodules "submodule.freetype2.url" "$srcdir/freetype2"
   git submodule update
   cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
 }

 pkgver() {
-  cd $srcdir/wezterm
+  cd "$srcdir/wezterm" || exit 1
   git -c "core.abbrev=8" show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S" | tr - .
 }

 build() {
-  cd $srcdir/wezterm
+  cd "$srcdir/wezterm" || exit 1
   bash ci/check-rust-version.sh
   cargo build --frozen --release
   tic -x -o "$srcdir/terminfo" "$srcdir/wezterm/termwiz/data/wezterm.terminfo"
 }

 package() {
-  cd $srcdir/wezterm
+  cd "$srcdir/wezterm" || exit 1

-  install -Dsm755 target/release/wezterm $pkgdir/usr/bin/wezterm
-  install -Dsm755 target/release/wezterm-gui $pkgdir/usr/bin/wezterm-gui
-  install -Dsm755 target/release/wezterm-mux-server $pkgdir/usr/bin/wezterm-mux-server
-  install -Dsm755 target/release/strip-ansi-escapes $pkgdir/usr/bin/strip-ansi-escapes
+  install -Dsm755 target/release/wezterm "$pkgdir/usr/bin/wezterm"
+  install -Dsm755 target/release/wezterm-gui "$pkgdir/usr/bin/wezterm-gui"
+  install -Dsm755 target/release/wezterm-mux-server "$pkgdir/usr/bin/wezterm-mux-server"
+  install -Dsm755 target/release/strip-ansi-escapes "$pkgdir/usr/bin/strip-ansi-escapes"

-  install -Dm644 assets/icon/terminal.png $pkgdir/usr/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png
-  install -Dm644 assets/wezterm.desktop $pkgdir/usr/share/applications/org.wezfurlong.wezterm.desktop
-  install -Dm644 assets/wezterm.appdata.xml $pkgdir/usr/share/metainfo/org.wezfurlong.wezterm.appdata.xml
-  install -Dm644 assets/wezterm-nautilus.py $pkgdir/usr/share/nautilus-python/extensions/wezterm-nautilus.py
+  install -Dm644 assets/icon/terminal.png "$pkgdir/usr/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png"
+  install -Dm644 assets/wezterm.desktop "$pkgdir/usr/share/applications/org.wezfurlong.wezterm.desktop"
+  install -Dm644 assets/wezterm.appdata.xml "$pkgdir/usr/share/metainfo/org.wezfurlong.wezterm.appdata.xml"
+  install -Dm644 assets/wezterm-nautilus.py "$pkgdir/usr/share/nautilus-python/extensions/wezterm-nautilus.py"
   install -Dm644 ../terminfo/w/wezterm "$pkgdir/usr/share/terminfo/w/wezterm"

   install -Dm644 assets/shell-integration/wezterm.sh "$pkgdir/etc/profile.d/wezterm.sh"
@@ -75,4 +75,3 @@ package() {

   install -Dm644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
 }
-
-- 
2.39.0
Mange commented 1 year ago

I've installed this package myself and everything seems to be working. I get autocompletion in bash and zsh (I don't have fish installed to test), and I can now set TERM=wezterm and start Neovim and get undercurls with no extra configuration.

The namcap will warn about missing package dependencies for the nautilus-python file that is now installed, but I don't think that's a problem as it's an optional thing to install. I don't have nautilus installed to test the file with; I just installed it the same was as with the RPM files.

Thank you for the pointer!

wez commented 1 year ago

Many Thanks! I have applied and pushed these to the AUR repo! Do you know what the process is for getting the equivalent changes in to the community wezterm package?

Mange commented 1 year ago

I think you need to email whoever maintains the community package and let them know about the packaging changes.

You could link to this issue to give full context and motivation. Perhaps they are skilled enough to catch any mistakes I made in my patch.

You can see the maintainer on the package page. Following the "View source" link reveals this maintainer contact information:

https://github.com/archlinux/svntogit-community/blob/4aaa449f728266929ca5103b939e1ce844ff5696/trunk/PKGBUILD#L1

eugenesvk commented 1 year ago

Could this issue be expanded to macOS as well? The auto-installed/updated shell completions would be nice

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.