snap: use core22 as base

Use core22 (Ubuntu 22.04) instead of core20 (Ubuntu 20.04) as the base
for the snap build. This will allow us to stop building libqt-jami for
Ubuntu 20.04, which has reached its EOL.

The changes made in snapcraft.yaml are based on the following guide:
https://documentation.ubuntu.com/snapcraft/latest/how-to/change-bases/change-from-core20-to-core22/

GitLab: #1944
Change-Id: Ib1af9c28a1ca9d0c3b8e693c5b2e50fb6cbead64
This commit is contained in:
François-Simon Fauteux-Chapleau
2025-08-06 10:19:44 -04:00
parent f1895b31b8
commit 25c9f0ef5c
3 changed files with 40 additions and 51 deletions

View File

@@ -2,7 +2,7 @@
# https://snapcraft.io/docs/build-on-docker # https://snapcraft.io/docs/build-on-docker
# https://github.com/canonical/snapcraft/issues/5079#issuecomment-2414199613 # https://github.com/canonical/snapcraft/issues/5079#issuecomment-2414199613
ARG UBUNTU=focal ARG UBUNTU=jammy
FROM ubuntu:$UBUNTU AS builder FROM ubuntu:$UBUNTU AS builder
ARG UBUNTU ARG UBUNTU
@@ -21,11 +21,6 @@ RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/sna
RUN mkdir -p /snap/core22 RUN mkdir -p /snap/core22
RUN unsquashfs -d /snap/core22/current core22.snap RUN unsquashfs -d /snap/core22/current core22.snap
# Download and unpack the core20 snap
RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core20' | jq '.download_url' -r) --output core20.snap
RUN mkdir -p /snap/core20
RUN unsquashfs -d /snap/core20/current core20.snap
# Download and unpack the core24 snap # Download and unpack the core24 snap
RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core24' | jq '.download_url' -r) --output core24.snap RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core24' | jq '.download_url' -r) --output core24.snap
RUN mkdir -p /snap/core24 RUN mkdir -p /snap/core24
@@ -48,7 +43,6 @@ RUN chmod +x /snap/bin/snapcraft
# time so they can be cached. # time so they can be cached.
FROM ubuntu:$UBUNTU FROM ubuntu:$UBUNTU
COPY --from=builder /snap/core20 /snap/core20
COPY --from=builder /snap/core22 /snap/core22 COPY --from=builder /snap/core22 /snap/core22
COPY --from=builder /snap/core24 /snap/core24 COPY --from=builder /snap/core24 /snap/core24
COPY --from=builder /snap/snapcraft /snap/snapcraft COPY --from=builder /snap/snapcraft /snap/snapcraft
@@ -57,10 +51,6 @@ COPY --from=builder /snap/bin/snapcraft /snap/bin/snapcraft
# Generate locale and install dependencies. # Generate locale and install dependencies.
RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes snapd sudo apt-transport-https locales wget && locale-gen en_US.UTF-8 RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes snapd sudo apt-transport-https locales wget && locale-gen en_US.UTF-8
# Install CMake 3.21 for Qt 6
ADD extras/packaging/gnu-linux/scripts/install-cmake.sh /opt/install-cmake.sh
RUN /opt/install-cmake.sh
# Set the proper environment. # Set the proper environment.
ENV LANG="en_US.UTF-8" ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en" ENV LANGUAGE="en_US:en"
@@ -69,6 +59,7 @@ ENV PATH="/snap/bin:/snap/snapcraft/current/usr/bin:/snap/snapcraft/current/libe
ENV SNAP="/snap/snapcraft/current" ENV SNAP="/snap/snapcraft/current"
ENV SNAP_NAME="snapcraft" ENV SNAP_NAME="snapcraft"
ENV SNAP_ARCH="amd64" ENV SNAP_ARCH="amd64"
ENV SNAPCRAFT_BUILD_ENVIRONMENT=host
ADD extras/packaging/gnu-linux/scripts/build-package-snap.sh /opt/build-package-snap.sh ADD extras/packaging/gnu-linux/scripts/build-package-snap.sh /opt/build-package-snap.sh
CMD ["/opt/build-package-snap.sh"] CMD ["/opt/build-package-snap.sh"]

View File

@@ -98,7 +98,7 @@ description: |
confinement: strict confinement: strict
grade: stable grade: stable
base: core20 base: core22
plugs: plugs:
gnome-3-38-2004: gnome-3-38-2004:
@@ -129,8 +129,8 @@ slots:
name: cx.ring.Ring name: cx.ring.Ring
layout: layout:
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib: /usr/lib/$CRAFT_ARCH_TRIPLET/alsa-lib:
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/alsa-lib
/usr/share/alsa: /usr/share/alsa:
bind: $SNAP/usr/share/alsa bind: $SNAP/usr/share/alsa
/usr/share/X11/xkb: /usr/share/X11/xkb:
@@ -139,7 +139,7 @@ layout:
environment: environment:
XDG_CURRENT_DESKTOP: Unity XDG_CURRENT_DESKTOP: Unity
QT_BASE_DIR: "/usr/lib/libqt-jami" QT_BASE_DIR: "/usr/lib/libqt-jami"
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP$QT_BASE_DIR/lib" LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$SNAP$QT_BASE_DIR/lib"
apps: apps:
jami: jami:
@@ -153,8 +153,8 @@ apps:
desktop: usr/share/applications/net.jami.Jami.desktop desktop: usr/share/applications/net.jami.Jami.desktop
environment: environment:
PIPEWIRE_CONFIG_NAME: "$SNAP/usr/share/pipewire/pipewire.conf" PIPEWIRE_CONFIG_NAME: "$SNAP/usr/share/pipewire/pipewire.conf"
PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pipewire-0.3" PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/pipewire-0.3"
SPA_PLUGIN_DIR: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/spa-0.2" SPA_PLUGIN_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/spa-0.2"
slots: slots:
- dbus-jami - dbus-jami
- dbus-ring - dbus-ring
@@ -185,7 +185,7 @@ package-repositories:
components: [main] components: [main]
suites: [jami] suites: [jami]
key-id: A295D773307D25A33AE72F2F64CD5FA175348F84 key-id: A295D773307D25A33AE72F2F64CD5FA175348F84
url: https://dl.jami.net/internal/ubuntu_20.04/ url: https://dl.jami.net/internal/ubuntu_22.04/
parts: parts:
desktop-launch: desktop-launch:
@@ -201,14 +201,14 @@ parts:
- devscripts - devscripts
- equivs - equivs
override-pull: | override-pull: |
snapcraftctl pull craftctl default
sed -i -E 's|\. \$SNAP/flavor-select|USE_gtk3=true|' gtk/launcher-specific sed -i -E 's|\. \$SNAP/flavor-select|USE_gtk3=true|' gtk/launcher-specific
sed -i -E 's|\. \$SNAP/flavor-select|USE_qt5=true|' qt/launcher-specific sed -i -E 's|\. \$SNAP/flavor-select|USE_qt5=true|' qt/launcher-specific
sed -i -E 's|(append_dir GTK_PATH \$RUNTIME/usr/lib/\$ARCH/gtk-2.0)|#\1|' qt/launcher-specific sed -i -E 's|(append_dir GTK_PATH \$RUNTIME/usr/lib/\$ARCH/gtk-2.0)|#\1|' qt/launcher-specific
sed -i -E 's|\$RUNTIME|$SNAP|g' qt/launcher-specific sed -i -E 's|\$RUNTIME|$SNAP|g' qt/launcher-specific
sed -i -E 's|\$WITH_RUNTIME|no|g' qt/launcher-specific sed -i -E 's|\$WITH_RUNTIME|no|g' qt/launcher-specific
override-build: | override-build: |
snapcraftctl build craftctl default
gcc -Wall -O2 -o bindtextdomain.so -fPIC -shared src/bindtextdomain.c -ldl gcc -Wall -O2 -o bindtextdomain.so -fPIC -shared src/bindtextdomain.c -ldl
echo "#!/bin/bash" > desktop-launch echo "#!/bin/bash" > desktop-launch
@@ -224,10 +224,10 @@ parts:
cat common/mark-and-exec >> desktop-launch cat common/mark-and-exec >> desktop-launch
install -D -m755 desktop-launch $SNAPCRAFT_PART_INSTALL/bin/desktop-launch install -D -m755 desktop-launch $CRAFT_PART_INSTALL/bin/desktop-launch
install -D -m644 bindtextdomain.so $SNAPCRAFT_PART_INSTALL/lib/bindtextdomain.so install -D -m644 bindtextdomain.so $CRAFT_PART_INSTALL/lib/bindtextdomain.so
mkdir -pv $SNAPCRAFT_PART_INSTALL/gnome-platform mkdir -pv $CRAFT_PART_INSTALL/gnome-platform
scripts: scripts:
plugin: dump plugin: dump
@@ -264,45 +264,47 @@ parts:
build-environment: build-environment:
- QT_BASE_DIR: "/usr/lib/libqt-jami" - QT_BASE_DIR: "/usr/lib/libqt-jami"
- PATH: "$QT_BASE_DIR/bin:$PATH" - PATH: "$QT_BASE_DIR/bin:$PATH"
- LD_LIBRARY_PATH: "$QT_BASE_DIR/lib:$LD_LIBRARY_PATH" - LD_LIBRARY_PATH: "$QT_BASE_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
- PKG_CONFIG_PATH: "$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH" - PKG_CONFIG_PATH: "$QT_BASE_DIR/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
override-pull: | override-pull: |
ls ls
snapcraftctl pull craftctl default
sed -i -E 's|(tmpName) << (PACKAGE_NAME << "_shm_")|\1 << "snap.jami." << \2|' ./daemon/src/media/video/sinkclient.cpp sed -i -E 's|(tmpName) << (PACKAGE_NAME << "_shm_")|\1 << "snap.jami." << \2|' ./daemon/src/media/video/sinkclient.cpp
sed -i -E 's|^Icon=.*|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/net.jami.Jami.svg|' extras/data/net.jami.Jami.desktop sed -i -E 's|^Icon=.*|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/net.jami.Jami.svg|' extras/data/net.jami.Jami.desktop
override-build: | override-build: |
$SNAPCRAFT_PART_BUILD/extras/packaging/gnu-linux/scripts/install-pipewire-from-source.sh $CRAFT_PART_BUILD/extras/packaging/gnu-linux/scripts/install-pipewire-from-source.sh
cd $SNAPCRAFT_PART_BUILD/daemon/contrib cd $CRAFT_PART_BUILD/daemon/contrib
mkdir -p native mkdir -p native
cd native cd native
../bootstrap ../bootstrap
make .ffmpeg make .ffmpeg
make make
cd $SNAPCRAFT_PART_BUILD/daemon cd $CRAFT_PART_BUILD/daemon
./autogen.sh ./autogen.sh
./configure --prefix=/usr --without-dbus ./configure --prefix=/usr --without-dbus
make -j$SNAPCRAFT_PARALLEL_BUILD_COUNT make -j$CRAFT_PARALLEL_BUILD_COUNT
DESTDIR=$SNAPCRAFT_PART_INSTALL make install DESTDIR=$CRAFT_PART_INSTALL make install
cd $SNAPCRAFT_PART_BUILD/ cd $CRAFT_PART_BUILD/
mkdir build mkdir build
cd build cd build
cmake .. -DENABLE_LIBWRAP=true \ cmake .. -DENABLE_LIBWRAP=true \
-DLIBJAMI_BUILD_DIR=$SNAPCRAFT_PART_BUILD/daemon/src \ -DLIBJAMI_BUILD_DIR=$CRAFT_PART_BUILD/daemon/src \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$QT_BASE_DIR \
-DBUILD_VERSION=BUILD_VERSION_PLACEHOLDER -DBUILD_VERSION=BUILD_VERSION_PLACEHOLDER
make -j$SNAPCRAFT_PARALLEL_BUILD_COUNT make -j$CRAFT_PARALLEL_BUILD_COUNT
DESTDIR=$SNAPCRAFT_PART_INSTALL make install DESTDIR=$CRAFT_PART_INSTALL make install
build-packages: build-packages:
- autoconf - autoconf
- autoconf-archive - autoconf-archive
- automake - automake
- autopoint - autopoint
- bzip2 - bzip2
- cmake
- curl - curl
- gcc - gcc
- g++ - g++
@@ -340,6 +342,7 @@ parts:
- gnutls-bin - gnutls-bin
- libssl-dev - libssl-dev
- git # PipeWire build dependencies - git # PipeWire build dependencies
- meson #
- libasound2-dev # - libasound2-dev #
- libdbus-1-dev # These packages are needed by the - libdbus-1-dev # These packages are needed by the
- libglib2.0-dev # install-pipewire-from-source.sh - libglib2.0-dev # install-pipewire-from-source.sh
@@ -352,7 +355,7 @@ parts:
- libegl1 - libegl1
- libgbm1 - libgbm1
- libgudev-1.0-0 - libgudev-1.0-0
- libjsoncpp1 - libjsoncpp25
- libllvm12 - libllvm12
- libminizip1 - libminizip1
- libnm0 - libnm0
@@ -385,6 +388,6 @@ parts:
- -usr/lib/libqt-jami/bin/ - -usr/lib/libqt-jami/bin/
- -usr/lib/libqt-jami/docs/ - -usr/lib/libqt-jami/docs/
- -usr/lib/libqt-jami/examples/ - -usr/lib/libqt-jami/examples/
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libLLVM-*.so* - -usr/lib/$CRAFT_ARCH_TRIPLET/libLLVM-*.so*
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libclang-*.so* - -usr/lib/$CRAFT_ARCH_TRIPLET/libclang-*.so*
- -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libflite*.so* - -usr/lib/$CRAFT_ARCH_TRIPLET/libflite*.so*

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# The purpose of this script is to build PipeWire from source in a snap based on core20 / Ubuntu 20.04 # The purpose of this script is to build PipeWire from source in a snap based on core22 / Ubuntu 22.04
# It must be called in the "override-build" section of the relevant part in snapcraft.yaml # It must be called in the "override-build" section of the relevant part in snapcraft.yaml
set -e set -e
@@ -8,28 +8,23 @@ set -e
OLD_WD=$(pwd) OLD_WD=$(pwd)
cd /tmp cd /tmp
# Get a version of Meson that's recent enough to build PipeWire 1.0.5 (the one available via apt is too old)
wget -q https://github.com/mesonbuild/meson/releases/download/0.61.1/meson-0.61.1.tar.gz
echo "feb2cefb325b437dbf36146df7c6b87688ddff0b0205caa31dc64055c6da410c meson-0.61.1.tar.gz" | sha256sum --check
tar xzf meson-0.61.1.tar.gz
# Build PipeWire 1.0.5 and install it in the /usr directory of the build environment # Build PipeWire 1.0.5 and install it in the /usr directory of the build environment
wget -q https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/1.0.5/pipewire-1.0.5.tar.gz wget -q https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/1.0.5/pipewire-1.0.5.tar.gz
echo "c5a5de26d684a1a84060ad7b6131654fb2835e03fccad85059be92f8e3ffe993 pipewire-1.0.5.tar.gz" | sha256sum --check echo "c5a5de26d684a1a84060ad7b6131654fb2835e03fccad85059be92f8e3ffe993 pipewire-1.0.5.tar.gz" | sha256sum --check
tar xzf pipewire-1.0.5.tar.gz tar xzf pipewire-1.0.5.tar.gz
cd pipewire-1.0.5 cd pipewire-1.0.5
../meson-0.61.1/meson.py setup builddir -Dsession-managers=media-session -Dalsa=disabled -Dprefix=/usr meson setup builddir -Dsession-managers=media-session -Dalsa=disabled -Dprefix=/usr
../meson-0.61.1/meson.py compile -C builddir meson compile -C builddir
../meson-0.61.1/meson.py install -C builddir meson install -C builddir
# The files installed by the previous command are only for the "Build" step of the snap # The files installed by the previous command are only for the "Build" step of the snap
# creation process (https://snapcraft.io/docs/how-snapcraft-builds). In order to ensure # creation process (https://snapcraft.io/docs/how-snapcraft-builds). In order to ensure
# that PipeWire is installed in the final snap archive, we also need to copy all the # that PipeWire is installed in the final snap archive, we also need to copy all the
# required files under the $SNAPCRAFT_PART_INSTALL directory. # required files under the $SNAPCRAFT_PART_INSTALL directory.
../meson-0.61.1/meson.py configure builddir -Dprefix=$SNAPCRAFT_PART_INSTALL/usr/ meson configure builddir -Dprefix=$SNAPCRAFT_PART_INSTALL/usr/
../meson-0.61.1/meson.py install -C builddir meson install -C builddir
# Cleanup # Cleanup
cd /tmp cd /tmp
rm -rf meson-0.61.1 meson-0.61.1.tar.gz pipewire-1.0.5 pipewire-1.0.5.tar.gz rm -rf pipewire-1.0.5 pipewire-1.0.5.tar.gz
cd $OLD_WD cd $OLD_WD