From fd01a948ba282fbed00a815a78c7cc1bced35ee7 Mon Sep 17 00:00:00 2001 From: Alyx Date: Sun, 25 Jan 2026 21:22:41 +0100 Subject: [PATCH] package: add support for deb/rpm --- .github/actions/package/action.yml | 16 ++++ .github/actions/release/action.yml | 16 ++++ docker/package.Dockerfile | 3 +- package/helium.desktop | 8 +- scripts/package.sh | 138 +++++++++++++++++++++++++++++ 5 files changed, 176 insertions(+), 5 deletions(-) diff --git a/.github/actions/package/action.yml b/.github/actions/package/action.yml index b5831ab..1a955c0 100644 --- a/.github/actions/package/action.yml +++ b/.github/actions/package/action.yml @@ -59,3 +59,19 @@ runs: build/release/helium-${{ steps.version.outputs.version }}-${{ env.ARCH }}_linux.tar.xz.asc if-no-files-found: error compression-level: 0 + + - name: Upload .deb artifact + uses: actions/upload-artifact@v4 + with: + name: helium-${{ steps.version.outputs.version }}-${{ env.ARCH }}-deb + path: build/release/*.deb + if-no-files-found: error + compression-level: 0 + + - name: Upload .rpm artifact + uses: actions/upload-artifact@v4 + with: + name: helium-${{ steps.version.outputs.version }}-${{ env.ARCH }}-rpm + path: build/release/*.rpm + if-no-files-found: error + compression-level: 0 diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index 658e052..06a73e3 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -25,6 +25,20 @@ runs: path: ./release/ merge-multiple: true + - name: Download .deb artifacts + uses: actions/download-artifact@v4 + with: + pattern: helium-*-deb + path: ./release/ + merge-multiple: true + + - name: Download .rpm artifacts + uses: actions/download-artifact@v4 + with: + pattern: helium-*-rpm + path: ./release/ + merge-multiple: true + - name: List release files shell: bash run: ls -la release/ @@ -62,4 +76,6 @@ runs: files: | release/helium-*.AppImage release/helium-*.AppImage.zsync + release/helium-*.deb + release/helium-*.rpm release/helium-*_linux.tar.xz* diff --git a/docker/package.Dockerfile b/docker/package.Dockerfile index d95263c..2b5b202 100644 --- a/docker/package.Dockerfile +++ b/docker/package.Dockerfile @@ -8,7 +8,8 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio RUN apt -y update && apt -y upgrade ## Install system dependencies -RUN apt -y install binutils elfutils desktop-file-utils dpkg file imagemagick wget xz-utils pv curl jq python3 zsync gnupg +RUN apt -y install binutils elfutils desktop-file-utils dpkg file imagemagick wget xz-utils pv curl jq python3 zsync gnupg ruby ruby-dev build-essential rpm +RUN gem install --no-document fpm RUN curl -s https://api.github.com/repos/AppImage/appimagetool/releases/tags/1.9.0 \ | jq -r '.assets[].browser_download_url' \ diff --git a/package/helium.desktop b/package/helium.desktop index 5c242d4..2c453c2 100644 --- a/package/helium.desktop +++ b/package/helium.desktop @@ -111,9 +111,9 @@ Comment[zh_CN]=访问互联网 Comment[zh_HK]=連線到網際網路 Comment[zh_TW]=連線到網際網路 -Exec=helium %U +Exec=helium --class=Helium %U StartupNotify=true -StartupWMClass=helium +StartupWMClass=Helium Terminal=false Icon=helium Type=Application @@ -173,7 +173,7 @@ Name[uk]=Нове вікно Name[vi]=Cửa sổ Mới Name[zh_CN]=新建窗口 Name[zh_TW]=開新視窗 -Exec=helium +Exec=helium --class=Helium [Desktop Action new-private-window] Name=New Incognito Window @@ -225,4 +225,4 @@ Name[uk]=Нове вікно в режимі анонімного перегля Name[vi]=Cửa sổ ẩn danh mới Name[zh_CN]=新建隐身窗口 Name[zh_TW]=新增無痕式視窗 -Exec=helium --incognito +Exec=helium --class=Helium --incognito diff --git a/scripts/package.sh b/scripts/package.sh index 5b2aa7e..e0ca2cb 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -23,6 +23,21 @@ if [ "$_arch" = "x64" ]; then _arch="x86_64" fi +case "$_arch" in + x86_64) + _deb_arch="amd64" + _rpm_arch="x86_64" + ;; + arm64) + _deb_arch="arm64" + _rpm_arch="aarch64" + ;; + *) + _deb_arch="$_arch" + _rpm_arch="$_arch" + ;; +esac + _release_name="$_app_name-$_version-$_arch" _update_info="gh-releases-zsync|imputnet|helium-linux|latest|$_app_name-*-$_arch.AppImage.zsync" _tarball_name="${_release_name}_linux" @@ -48,6 +63,54 @@ vk_swiftshader_icd.json xdg-mime xdg-settings" +_deb_deps=( + libnss3 + libnspr4 + libgtk-3-0 + libxss1 + libasound2 + libx11-xcb1 + libdrm2 + libgbm1 + libxdamage1 + libxcomposite1 + libxcursor1 + libxrandr2 + libxi6 + libatk-bridge2.0-0 + libatspi2.0-0 + libxcb-dri3-0 + libxcb-dri2-0 + libxcb-present0 + libxkbcommon0 + libxshmfence1 + ca-certificates + fonts-liberation +) + +_rpm_deps=( + nss + nspr + gtk3 + libXScrnSaver + libX11-xcb + libdrm + mesa-libgbm + libXdamage + libXcomposite + libXcursor + libXrandr + libXi + at-spi2-atk + at-spi2-core + libxcb + libxkbcommon + libxshmfence + ca-certificates + liberation-fonts + alsa-lib +) + echo "copying release files and creating $_tarball_name.tar.xz" rm -rf "$_tarball_dir" @@ -107,6 +170,81 @@ appimagetool \ -u "$_update_info" \ "$_app_dir" \ "$_release_name.AppImage" "$@" & + + +build_fpm_pkg() { + local _target=$1 + local _deps_flag=() + if [[ "$_target" == "deb" ]]; then + for d in "${_deb_deps[@]}"; do _deps_flag+=("-d" "$d"); done + else + for d in "${_rpm_deps[@]}"; do _deps_flag+=("-d" "$d"); done + fi + + local _stage_dir=$(mktemp -d) + local _pkg_name="helium" + local _install_path="/usr/lib/$_pkg_name" + + mkdir -p "$_stage_dir$_install_path" + cp -r "$_tarball_dir"/* "$_stage_dir$_install_path/" + + # Symlink binary + mkdir -p "$_stage_dir/usr/bin" + ln -sf "$_install_path/helium" "$_stage_dir/usr/bin/helium" + + # Desktop file + mkdir -p "$_stage_dir/usr/share/applications" + cp "$_root_dir/package/helium.desktop" "$_stage_dir/usr/share/applications/$_pkg_name.desktop" + + # Icon + mkdir -p "$_stage_dir/usr/share/icons/hicolor/256x256/apps" + cp "$_tarball_dir/product_logo_256.png" "$_stage_dir/usr/share/icons/hicolor/256x256/apps/helium.png" + + local _fpm_arch + if [[ "$_target" == "deb" ]]; then + _fpm_arch="$_deb_arch" + else + _fpm_arch="$_rpm_arch" + fi + + local _output_pkg="${_release_dir}/${_pkg_name}_${_version}_${_target}.pkg" + + fpm -s dir -t "$_target" \ + -n "$_pkg_name" \ + -v "$_version" \ + --architecture "$_fpm_arch" \ + --url "https://helium.computer" \ + --maintainer "Helium" \ + --description "Helium browser" \ + --provides "$_pkg_name" \ + --replaces "$_pkg_name" \ + "${_deps_flag[@]}" \ + -C "$_stage_dir" \ + --prefix / \ + --package "$_output_pkg" \ + . + + # Rename to friendly extension. + if [[ "$_target" == "deb" ]]; then + local _final_pkg="${_release_dir}/${_pkg_name}-${_version}-${_deb_arch}.deb" + mv "$_output_pkg" "$_final_pkg" + else + local _final_pkg="${_release_dir}/${_pkg_name}-${_version}-1.${_rpm_arch}.rpm" + mv "$_output_pkg" "$_final_pkg" + fi + + rm -rf "$_stage_dir" +} + +if command -v fpm >/dev/null 2>&1; then + echo "Building .deb package..." + build_fpm_pkg deb & + echo "Building .rpm package..." + build_fpm_pkg rpm & +else + echo "fpm not found, skipping .deb and .rpm generation" +fi + popd wait