From 9d1541f96b092e9fe239947ae77f5bbbde5c62a3 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Thu, 11 Apr 2024 15:13:59 +0800 Subject: [PATCH] build,snap,CI: create a snap package For now it is a single package that just runs the GTK frontend. Further commits will separate this into different snap packages for the server, and other frontends. --- .github/workflows/auto-ci-builds.yml | 22 +++++++ build/install-snapcraft.sh | 14 ++++ build/snap-build.sh | 15 +++++ snap/snapcraft.yaml | 97 ++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100755 build/install-snapcraft.sh create mode 100755 build/snap-build.sh create mode 100644 snap/snapcraft.yaml diff --git a/.github/workflows/auto-ci-builds.yml b/.github/workflows/auto-ci-builds.yml index f9f0d0d22..1d40ef4e1 100644 --- a/.github/workflows/auto-ci-builds.yml +++ b/.github/workflows/auto-ci-builds.yml @@ -339,3 +339,25 @@ jobs: - name: build nix pkg run: | nix-build --expr 'let pkgs = import { }; in pkgs.callPackage ./nix/default.nix { gitBranch = "${{ github.ref_name }}"; }' + + snap_build: + needs: build_Mono-6_8_0_105 + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v1 + - name: Install snap tools + run: | + sudo apt update --yes + ./build/install-snapcraft.sh + - name: Generate snap package + run: | + sudo ./build/snap-build.sh + - name: Test snap package + run: | + sudo snap install --dangerous *.snap + smuxi --version + - uses: actions/upload-artifact@v3 + name: Upload snap package as artifact + with: + name: snap + path: ./*.snap diff --git a/build/install-snapcraft.sh b/build/install-snapcraft.sh new file mode 100755 index 000000000..1193a5647 --- /dev/null +++ b/build/install-snapcraft.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euxo pipefail + +sudo apt install -y snapd +snap version + +# we can switch to a newer channel when we're ready to upgrade +# to use SNAPCRAFT_STORE_CREDENTIALS instead of --with when pushing +sudo snap install --classic snapcraft + +# workaround for GithubActionsCI+snapcraft, see https://forum.snapcraft.io/t/permissions-problem-using-snapcraft-in-azure-pipelines/13258/14?u=knocte +sudo chown root:root / + +snapcraft --version diff --git a/build/snap-build.sh b/build/snap-build.sh new file mode 100755 index 000000000..6a413fe41 --- /dev/null +++ b/build/snap-build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# this is the equivalent of using the 'build-packages' (not stage-packages) section in snapcraft +# but as we're not using the 'make' plugin, we need to this manually now +DEBIAN_FRONTEND=noninteractive sudo apt install -y build-essential pkg-config cli-common-dev mono-devel libgtk2.0-cil-dev + +# just in case this is a retry-run, we want to clean artifacts from previous try +rm -rf ./staging + +./configure.sh --prefix=./staging "$@" +make +make install + +snapcraft --destructive-mode diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 000000000..490570a0c --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,97 @@ +name: smuxi +base: core22 # the base snap is the execution environment for this snap +version: '1.2.1' # just for humans, typically '1.2+git' or '1.3.2' +summary: User-friendly and free IRC client for Linux/Windows/macOS based on GNOME/GTK+ # 79 char long summary +description: | + Smuxi is an irssi-inspired, flexible, user-friendly and + cross-platform IRC client for sophisticated users, targeting the GNOME desktop. + + Smuxi is based on the client-server model: The core application (engine) can be + placed onto a server which is connected to the Internet around-the-clock; one + or more frontends then connect to the core. This way, the connection to IRC can + be kept up even when all frontends have been closed. The combination of screen + and irssi served as example for this architecture. + + Smuxi also supports the regular single application mode. This behaves like a + typical IRC client; it doesn't need separate core management and utilizes a + local engine that is used by the local frontend client. + + Smuxi's GNOME homepage: https://wiki.gnome.org/Apps/Smuxi +license: GPL-2.0 +icon: logo.png + +# grade must be 'stable' (without the quotes) to release into candidate/stable channels +grade: stable +confinement: strict + +layout: + /usr/share/.mono: + symlink: $SNAP/etc/mono/certstore + /usr/lib/cli: + symlink: $SNAP/usr/lib/cli + +apps: + smuxi: + command: bin/desktop-launch $SNAP/bin/smuxi-gtk + plugs: + - network + - desktop + - desktop-legacy + - wayland + - unity7 + +parts: + smuxi: + plugin: dump + source: ./staging + stage-packages: + - mono-devel + - libgtk2.0-cil + + certs: + plugin: dump + source: /etc/mono + organize: + certstore: etc/mono/certstore + + gtk2: + source: https://github.com/ubuntu/snapcraft-desktop-helpers.git + source-subdir: gtk + plugin: make + make-parameters: ["FLAVOR=gtk2"] + build-packages: + - libgtk2.0-dev + stage-packages: + - libxkbcommon0 # XKB_CONFIG_ROOT + - dmz-cursor-theme + - light-themes + - adwaita-icon-theme + - gnome-themes-standard + - shared-mime-info + - libgtk2.0-0 + - libgdk-pixbuf2.0-0 + - libglib2.0-bin + - libgtk2.0-bin + - unity-gtk2-module + - libappindicator1 + - locales-all + - ibus-gtk + - libibus-1.0-5 + +plugs: + gtk-2-engines: + interface: content + target: $SNAP/lib/gtk-2.0 + default-provider: gtk2-common-themes + gtk-2-themes: + interface: content + target: $SNAP/data-dir/themes + default-provider: gtk-common-themes + icon-themes: + interface: content + target: $SNAP/data-dir/icons + default-provider: gtk-common-themes + sound-themes: + interface: content + target: $SNAP/data-dir/sounds + default-provider: gtk-common-themes