From d0f94dc4a5ed245a29f3a877b6f60b72f21035c4 Mon Sep 17 00:00:00 2001 From: fsLeg Date: Sat, 14 Jun 2025 16:26:44 +0300 Subject: [PATCH] helix: added --- helix/README | 21 ++++ helix/disable-grammar-fetching.patch | 12 +++ helix/doinst.sh | 9 ++ helix/helix.SlackBuild | 149 +++++++++++++++++++++++++++ helix/helix.info | 12 +++ helix/slack-desc | 19 ++++ 6 files changed, 222 insertions(+) create mode 100644 helix/README create mode 100644 helix/disable-grammar-fetching.patch create mode 100644 helix/doinst.sh create mode 100644 helix/helix.SlackBuild create mode 100644 helix/helix.info create mode 100644 helix/slack-desc diff --git a/helix/README b/helix/README new file mode 100644 index 0000000..4c7ada9 --- /dev/null +++ b/helix/README @@ -0,0 +1,21 @@ +A Kakoune / Neovim inspired editor, written in Rust. + +Features: +- Vim-like modal editing +- Multiple selections +- Built-in language server support +- Smart, incremental syntax highlighting and code editing + via tree-sitter + +If you don't want to build grammar files which provide syntax +highlighting, use HELIX_DISABLE_AUTO_GRAMMAR_BUILD=yes. Those can be +built later with: + + hx --grammar fetch; hx --grammar build + +This will install them in the runtime directory within the user's helix +config directory. + +In order to use system clipboard in Wayland, wl-clipboard is needed. + +To build HTML documentation use DOCS=yes. This requires mdbook. diff --git a/helix/disable-grammar-fetching.patch b/helix/disable-grammar-fetching.patch new file mode 100644 index 0000000..e1b1246 --- /dev/null +++ b/helix/disable-grammar-fetching.patch @@ -0,0 +1,12 @@ +--- a/helix-term/build.rs 2025-01-20 00:25:42.000000000 +0300 ++++ b/helix-term/build.rs 2025-06-14 14:11:03.753775574 +0300 +@@ -1,8 +1,7 @@ +-use helix_loader::grammar::{build_grammars, fetch_grammars}; ++use helix_loader::grammar::build_grammars; + + fn main() { + if std::env::var("HELIX_DISABLE_AUTO_GRAMMAR_BUILD").is_err() { +- fetch_grammars().expect("Failed to fetch tree-sitter grammars"); + build_grammars(Some(std::env::var("TARGET").unwrap())) + .expect("Failed to compile tree-sitter grammars"); + } diff --git a/helix/doinst.sh b/helix/doinst.sh new file mode 100644 index 0000000..3e5691a --- /dev/null +++ b/helix/doinst.sh @@ -0,0 +1,9 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi + +if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1 + fi +fi diff --git a/helix/helix.SlackBuild b/helix/helix.SlackBuild new file mode 100644 index 0000000..56c7da5 --- /dev/null +++ b/helix/helix.SlackBuild @@ -0,0 +1,149 @@ +#!/bin/bash + +# Slackware build script for helix + +# Copyright 2025 Vladislav 'fsLeg' Borisov, Moscow, Russia +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=helix +VERSION=${VERSION:-25.01.1} +BUILD=${BUILD:-1} +TAG=${TAG:-fsleg} +PKGTYPE=${PKGTYPE:-txz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac + + if [ "$ARCH" = "i586" ]; then + if rustc -Vv | grep host | grep i686 > /dev/null ; then + ARCH=i686 + fi + fi +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG $TMP/$PRGNAM-$VERSION +mkdir -p $TMP/$PRGNAM-$VERSION $PKG $OUTPUT +cd $TMP/$PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION-source.tar.xz +tar xvf $CWD/$PRGNAM-$VERSION-vendored-sources.tar.xz -C ../ +chown -R root:root . + +# Grammar sources are bundled, no need to fetch them again +patch -p1 < $CWD/disable-grammar-fetching.patch + +# Use rust-opt instead of system rust if it's available +export PATH="/opt/rust/bin:$PATH" +if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX" +else + export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH" +fi + +# Compile the binaries +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +RUSTFLAGS="-C target-cpu=native" \ +CARGO_HOME=".cargo" \ +HELIX_DEFAULT_RUNTIME=/usr/lib$LIBDIRSUFFIX/$PRGNAM \ +cargo build --frozen --profile opt + +# Package everything +mkdir -p $PKG/usr/bin \ + $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM \ + $PKG/usr/share/bash-completion/completions \ + $PKG/usr/share/fish/vendor_completions.d \ + $PKG/usr/share/zsh/site-functions \ + $PKG/usr/share/applications +install -Dm 755 -t $PKG/usr/bin target/opt/hx +cp -R runtime/queries $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/ +cp -R runtime/themes $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/ +mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/grammars +find runtime/grammars -name "*.so" -type f -exec \ + install -Dm 755 -t $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/grammars {} \; +install -Dm 644 -t $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM runtime/tutor +install -Dm 644 contrib/completion/hx.bash $PKG/usr/share/bash-completion/completions/$PRGNAM +install -Dm 644 contrib/completion/hx.fish $PKG/usr/share/fish/vendor_completions.d/$PRGNAM.fish +install -Dm 644 contrib/completion/hx.zsh $PKG/usr/share/zsh/site-functions/_$PRGNAM +install -Dm 644 contrib/Helix.desktop $PKG/usr/share/applications/$PRGNAM.desktop +for geometry in 16x16 24x24 32x32 48x48 64x64 96x96 128x128 256x256; do + mkdir -p $PKG/usr/share/icons/hicolor/$geometry/apps + magick contrib/helix.png -resize $geometry $PKG/usr/share/icons/hicolor/$geometry/apps/$PRGNAM.png +done + +# Strip binaries and libraries +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Copy available documentation +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + LICENSE README.md CHANGELOG.md docs/*.md \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# Build additional documentation +if [ "${DOCS:-no}" != "no" ]; then + mdbook build --dest-dir $PKG/usr/doc/$PRGNAM-$VERSION/html book + rm -rf $PKG/usr/doc/$PRGNAM-$VERSION/html/{CNAME,404.html,.nojekyll,generated} +fi + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/helix/helix.info b/helix/helix.info new file mode 100644 index 0000000..5645534 --- /dev/null +++ b/helix/helix.info @@ -0,0 +1,12 @@ +PRGNAM="helix" +VERSION="25.01.1" +HOMEPAGE="https://helix-editor.com" +DOWNLOAD="https://github.com/helix-editor/helix/releases/download/25.01.1/helix-25.01.1-source.tar.xz \ + https://sbo.t-rg.ws/helix-25.01.1-vendored-sources.tar.xz" +MD5SUM="4a006271f3ef064d56bd50df5978b1ab \ + 146bc89348781c487734bce13572942f" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="rust-opt" +MAINTAINER="Vladislav 'fsLeg' Borisov" +EMAIL="fsleg@t-rg.ws" diff --git a/helix/slack-desc b/helix/slack-desc new file mode 100644 index 0000000..04ae280 --- /dev/null +++ b/helix/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +helix: helix (a post-modern modal text editor.) +helix: +helix: A Kakoune / Neovim inspired terminal-based editor, written in Rust. +helix: +helix: Helix provides vim-like modal editing, multiple selections, built-in +helix: language server support, smart, incremental syntax highlighting +helix: and code editing via tree-sitter. +helix: +helix: Homepage: https://helix-editor.com/ +helix: +helix: -- 2.46.3