Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT(WIP): build,snap,CI: create a snap package #301

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 22 additions & 35 deletions .github/workflows/auto-ci-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,41 +297,6 @@ jobs:
run: |
dpkg-buildpackage -us -uc -rfakeroot --build=binary --no-check-builddeps

build_debs_Debian-unstable:
runs-on: ubuntu-latest
container: debian:unstable
continue-on-error: true
steps:
- uses: actions/checkout@v1
- name: check Debian version
run: |
cat /etc/debian_version
- name: install sudo and moreutils (for chronic)
run: |
echo "Detected APT sources:"
grep deb /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -v ":#"
apt update
apt install --yes sudo moreutils
- name: install build dependencies from debian/control
run: |
sudo apt install --yes devscripts equivs
sudo mk-build-deps debian/control
dpkg --info ./smuxi-build-deps_*.deb
sudo apt install --yes ./smuxi-build-deps_*.deb
- name: check mono version
run: |
mono --version
- name: workaround failing git ownership check
run: |
sudo apt install --yes git > /dev/null
git config --global --add safe.directory '*'
- name: prepare build
run: |
./autogen.sh
- name: build debs
run: |
dpkg-buildpackage -us -uc -rfakeroot --build=binary

build_nix_NixOS-stable-23_11:
runs-on: ubuntu-latest
container: nixos/nix
Expand Down Expand Up @@ -370,3 +335,25 @@ jobs:
- name: build nix pkg
run: |
nix-build --expr 'let pkgs = import <nixpkgs> { }; 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
#TODO: test with `smuxi --version`?
- uses: actions/upload-artifact@v3
name: Upload snap package as artifact
with:
name: snap
path: ./*.snap
8 changes: 8 additions & 0 deletions build/install-deps-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euxo pipefail

DEBIAN_FRONTEND=noninteractive apt install --yes \
intltool \
pkg-config \
libstfl-dev \
libgtk2.0-cil-dev
11 changes: 11 additions & 0 deletions build/install-snapcraft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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

snapcraft --version
13 changes: 13 additions & 0 deletions build/snap-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euxo pipefail

sudo ./build/install-deps-ubuntu.sh

# just in case this is a retry-run, we want to clean artifacts from previous try
rm -rf ./staging

./autogen.sh --prefix=`pwd`/staging "$@"
make
make install

snapcraft --destructive-mode
99 changes: 99 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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: ./images/icon.svg

# 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-frontend-gnome
plugs:
- network
- desktop
- desktop-legacy
- wayland
- unity7

parts:
smuxi:
plugin: dump
source: ./staging
stage-packages:
- mono-devel
- libgtk2.0-cil
- liblog4net-cil-dev
- libnini-cil-dev

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
21 changes: 20 additions & 1 deletion src/Frontend-GNOME/smuxi-frontend-gnome.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ if ! mono -V | grep -q -e "version [4-9]\."; then
export MONO_ENV_OPTIONS
fi

# needed for getting mono to work inside snap's sandbox
if [ -n "${SNAP}" ]; then
PKG_DIR=$SNAP/usr
export MONO_PATH=$PKG_DIR/lib/mono/4.5:$PKG_DIR/lib/cli/log4net-1.2:$PKG_DIR/lib/cli/Nini-1.1:$PKG_DIR/lib/cli/gtk-sharp-2.0:$PKG_DIR/lib/cli/glib-sharp-2.0:$PKG_DIR/lib/cli/atk-sharp-2.0:$PKG_DIR/lib/cli/gdk-sharp-2.0:$PKG_DIR/lib/cli/pango-sharp-2.0:$MONO_PATH
export MONO_CONFIG=$SNAP/etc/mono/config
export MONO_CFG_DIR=$SNAP/etc
export MONO_REGISTRY_PATH=~/.mono/registry
export MONO_GAC_PREFIX=$PKG_DIR/lib/mono/gac/
fi

# Smuxi uses an IPC channel for the single application instance feature and it
# also allows to pass links from commandline to an existing Smuxi instance. This
# IPC channel must be private to the user that executes Smuxi, else other system
Expand All @@ -32,4 +42,13 @@ chmod 700 $SMUXI_TMP
TMP=$SMUXI_TMP
export TMP

exec mono "@expanded_libdir@/@PACKAGE@/smuxi-frontend-gnome.exe" "$@"
EXE_FILENAME=smuxi-frontend-gnome.exe
UNIX_NAME=smuxi

if [ -n "${SNAP}" ]; then
DIR_OF_THIS_SCRIPT=$(dirname "$(realpath "$0")")
FRONTEND_PATH="$DIR_OF_THIS_SCRIPT/../lib/$UNIX_NAME/$EXE_FILENAME"
exec mono "$FRONTEND_PATH" "$@"
fi

exec mono "@expanded_libdir@/@PACKAGE@/$EXE_FILENAME" "$@"
Loading