Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | .github/workflows/release.yml | 33 | ||||
| -rw-r--r-- | Cargo.toml | 3 | ||||
| -rw-r--r-- | book/src/building-from-source.md | 37 | ||||
| -rw-r--r-- | book/src/package-managers.md | 12 | ||||
| -rwxr-xr-x | contrib/hx_launcher.sh | 3 | ||||
| -rw-r--r-- | helix-term/Cargo.toml | 18 |
6 files changed, 88 insertions, 18 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1c9bc03..de0a25f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -147,16 +147,8 @@ jobs: if: "!matrix.skip_tests" run: ${{ env.CARGO }} test --release --locked --target ${{ matrix.target }} --workspace - - name: Set profile.release.strip = true - shell: bash - run: | - cat >> .cargo/config.toml <<EOF - [profile.release] - strip = true - EOF - - name: Build release binary - run: ${{ env.CARGO }} build --release --locked --target ${{ matrix.target }} + run: ${{ env.CARGO }} build --profile opt --locked --target ${{ matrix.target }} - name: Build AppImage shell: bash @@ -183,7 +175,7 @@ jobs: mkdir -p "$APP.AppDir"/usr/{bin,lib/helix} - cp "target/${{ matrix.target }}/release/hx" "$APP.AppDir/usr/bin/hx" + cp "target/${{ matrix.target }}/opt/hx" "$APP.AppDir/usr/bin/hx" rm -rf runtime/grammars/sources cp -r runtime "$APP.AppDir/usr/lib/helix/runtime" @@ -206,14 +198,25 @@ jobs: mv "$APP-$VERSION-$ARCH.AppImage" \ "$APP-$VERSION-$ARCH.AppImage.zsync" dist + - name: Build Deb + shell: bash + if: matrix.build == 'x86_64-linux' + run: | + cargo install cargo-deb + mkdir -p target/release + cp target/${{ matrix.target }}/opt/hx target/release/ + cargo deb --no-build + mkdir -p dist + mv target/debian/*.deb dist/ + - name: Build archive shell: bash run: | mkdir -p dist if [ "${{ matrix.os }}" = "windows-2019" ]; then - cp "target/${{ matrix.target }}/release/hx.exe" "dist/" + cp "target/${{ matrix.target }}/opt/hx.exe" "dist/" else - cp "target/${{ matrix.target }}/release/hx" "dist/" + cp "target/${{ matrix.target }}/opt/hx" "dist/" fi if [ -d runtime/grammars/sources ]; then rm -rf runtime/grammars/sources @@ -241,6 +244,7 @@ jobs: set -ex source="$(pwd)" + tag=${GITHUB_REF_NAME//\//} mkdir -p runtime/grammars/sources tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources rm -rf grammars @@ -254,7 +258,7 @@ jobs: if [[ $platform =~ "windows" ]]; then exe=".exe" fi - pkgname=helix-$GITHUB_REF_NAME-$platform + pkgname=helix-$tag-$platform mkdir -p $pkgname cp $source/LICENSE $source/README.md $pkgname mkdir $pkgname/contrib @@ -265,6 +269,7 @@ jobs: if [[ "$platform" = "x86_64-linux" ]]; then mv bins-$platform/helix-*.AppImage* dist/ + mv bins-$platform/*.deb dist/ fi if [ "$exe" = "" ]; then @@ -274,7 +279,7 @@ jobs: fi done - tar cJf dist/helix-$GITHUB_REF_NAME-source.tar.xz -C $source . + tar cJf dist/helix-$tag-source.tar.xz -C $source . mv dist $source/ - name: Upload binaries to release @@ -22,13 +22,12 @@ default-members = [ [profile.release] lto = "thin" -# debug = true [profile.opt] inherits = "release" lto = "fat" codegen-units = 1 -# strip = "debuginfo" # TODO: or strip = true +strip = true opt-level = 3 [profile.integration] diff --git a/book/src/building-from-source.md b/book/src/building-from-source.md index 539e9cf8..b422f4bf 100644 --- a/book/src/building-from-source.md +++ b/book/src/building-from-source.md @@ -7,6 +7,7 @@ - [Note to packagers](#note-to-packagers) - [Validating the installation](#validating-the-installation) - [Configure the desktop shortcut](#configure-the-desktop-shortcut) +- [Building the Debian package](#building-the-debian-package) Requirements: @@ -162,3 +163,39 @@ file. For example, to use `kitty`: sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop ``` + +### Building the Debian package + +If the `.deb` file provided on the release page uses a `libc` version higher +than that used by your Debian, Ubuntu, or Mint system, you can build the package +from source to match your system's dependencies. + +Install `cargo-deb`, the tool used for building the `.deb` file: + +```sh +cargo install cargo-deb +``` + +After cloning and entering the Helix repository as previously described, +use the following command to build the release binary and package it into a `.deb` file in a single step. + +```sh +cargo deb -- --locked +``` + +> 💡 This locks you into the `--release` profile. But you can also build helix in any way you like. +> As long as you leave a `target/release/hx` file, it will get packaged with `cargo deb --no-build` + +> 💡 Don't worry about the repeated +> ``` +> warning: Failed to find dependency specification +> ``` +> warnings. Cargo deb just reports which packaged files it didn't derive dependencies for. But +> so far the dependency deriving seams very good, even if some of the grammar files are skipped. + +You can find the resulted `.deb` in `target/debian/`. It should contain everything it needs, including the + +- completions for bash, fish, zsh +- .desktop file +- icon (though desktop environments might use their own since the name of the package is correctly `helix`) +- launcher to the binary with the runtime diff --git a/book/src/package-managers.md b/book/src/package-managers.md index 478fe6cb..c3b1f4e7 100644 --- a/book/src/package-managers.md +++ b/book/src/package-managers.md @@ -1,7 +1,8 @@ ## Package managers - [Linux](#linux) - - [Ubuntu](#ubuntu) + - [Ubuntu/Debian](#ubuntudebian) + - [Ubuntu (PPA)](#ubuntu-ppa) - [Fedora/RHEL](#fedorarhel) - [Arch Linux extra](#arch-linux-extra) - [NixOS](#nixos) @@ -23,7 +24,14 @@ The following third party repositories are available: -### Ubuntu +### Ubuntu/Debian + +Install the Debian package from the release page. + +If you are running a system older than Ubuntu 22.04, Mint 21, or Debian 12, you can build the `.deb` file locally +[from source](./building-from-source.md#building-the-debian-package). + +### Ubuntu (PPA) Add the `PPA` for Helix: diff --git a/contrib/hx_launcher.sh b/contrib/hx_launcher.sh new file mode 100755 index 00000000..148f7776 --- /dev/null +++ b/contrib/hx_launcher.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +HELIX_RUNTIME=/usr/lib/helix/runtime exec /usr/lib/helix/hx "$@" diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 83d6ccc9..dffee147 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -12,6 +12,24 @@ categories.workspace = true repository.workspace = true homepage.workspace = true +[package.metadata.deb] +# generate a .deb in target/debian/ with the command: cargo deb --no-build +name = "helix" +assets = [ + { source = "target/release/hx", dest = "/usr/lib/helix/", mode = "755" }, + { source = "../contrib/hx_launcher.sh", dest = "/usr/bin/hx", mode = "755" }, + { source = "../runtime/*", dest = "/usr/lib/helix/runtime/", mode = "644" }, + { source = "../runtime/grammars/*", dest = "/usr/lib/helix/runtime/grammars/", mode = "644" }, # to avoid sources/ + { source = "../runtime/queries/**/*", dest = "/usr/lib/helix/runtime/queries/", mode = "644" }, + { source = "../runtime/themes/**/*", dest = "/usr/lib/helix/runtime/themes/", mode = "644" }, + { source = "../README.md", dest = "/usr/share/doc/helix/", mode = "644" }, + { source = "../contrib/completion/hx.bash", dest = "/usr/share/bash-completion/completions/hx", mode = "644" }, + { source = "../contrib/completion/hx.fish", dest = "/usr/share/fish/vendor_completions.d/hx.fish", mode = "644" }, + { source = "../contrib/completion/hx.zsh", dest = "/usr/share/zsh/vendor-completions/_hx", mode = "644" }, + { source = "../contrib/Helix.desktop", dest = "/usr/share/applications/Helix.desktop", mode = "644" }, + { source = "../contrib/helix.png", dest = "/usr/share/icons/hicolor/256x256/apps/helix.png", mode = "644" }, +] + [features] default = ["git"] unicode-lines = ["helix-core/unicode-lines", "helix-view/unicode-lines"] |