From f376a744fe51eac5d26c5ae27c3f463016616d5f Mon Sep 17 00:00:00 2001 From: janos-r <30606201+janos-r@users.noreply.github.com> Date: Fri, 17 Jan 2025 08:37:53 +0900 Subject: [PATCH] Generate a .deb file (#12453) --- .github/workflows/release.yml | 33 ++++++++++++++++------------ Cargo.toml | 3 +-- book/src/building-from-source.md | 37 ++++++++++++++++++++++++++++++++ book/src/package-managers.md | 12 +++++++++-- contrib/hx_launcher.sh | 3 +++ helix-term/Cargo.toml | 18 ++++++++++++++++ 6 files changed, 88 insertions(+), 18 deletions(-) create mode 100755 contrib/hx_launcher.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1c9bc03183aa..de0a25f67721b 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 < 💡 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 478fe6cb34f33..c3b1f4e7d254a 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 0000000000000..148f7776a916d --- /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 83d6ccc9269bc..dffee14724823 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"]