From 25c9f0ef5cf9fbcc68920793042a828e3b9590c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Simon=20Fauteux-Chapleau?= Date: Wed, 6 Aug 2025 10:19:44 -0400 Subject: [PATCH] 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 --- .../gnu-linux/docker/Dockerfile_snap | 13 +--- .../gnu-linux/rules/snap/jami/snapcraft.yaml | 59 ++++++++++--------- .../scripts/install-pipewire-from-source.sh | 19 +++--- 3 files changed, 40 insertions(+), 51 deletions(-) diff --git a/extras/packaging/gnu-linux/docker/Dockerfile_snap b/extras/packaging/gnu-linux/docker/Dockerfile_snap index 2b14b54f9..8dece6bbc 100644 --- a/extras/packaging/gnu-linux/docker/Dockerfile_snap +++ b/extras/packaging/gnu-linux/docker/Dockerfile_snap @@ -2,7 +2,7 @@ # https://snapcraft.io/docs/build-on-docker # https://github.com/canonical/snapcraft/issues/5079#issuecomment-2414199613 -ARG UBUNTU=focal +ARG UBUNTU=jammy FROM ubuntu:$UBUNTU AS builder 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 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 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 @@ -48,7 +43,6 @@ RUN chmod +x /snap/bin/snapcraft # time so they can be cached. FROM ubuntu:$UBUNTU -COPY --from=builder /snap/core20 /snap/core20 COPY --from=builder /snap/core22 /snap/core22 COPY --from=builder /snap/core24 /snap/core24 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. 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. ENV LANG="en_US.UTF-8" 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_NAME="snapcraft" ENV SNAP_ARCH="amd64" +ENV SNAPCRAFT_BUILD_ENVIRONMENT=host ADD extras/packaging/gnu-linux/scripts/build-package-snap.sh /opt/build-package-snap.sh CMD ["/opt/build-package-snap.sh"] diff --git a/extras/packaging/gnu-linux/rules/snap/jami/snapcraft.yaml b/extras/packaging/gnu-linux/rules/snap/jami/snapcraft.yaml index 1e689fe9e..b1deab957 100644 --- a/extras/packaging/gnu-linux/rules/snap/jami/snapcraft.yaml +++ b/extras/packaging/gnu-linux/rules/snap/jami/snapcraft.yaml @@ -98,7 +98,7 @@ description: | confinement: strict grade: stable -base: core20 +base: core22 plugs: gnome-3-38-2004: @@ -129,8 +129,8 @@ slots: name: cx.ring.Ring layout: - /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib: - bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib + /usr/lib/$CRAFT_ARCH_TRIPLET/alsa-lib: + bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/alsa-lib /usr/share/alsa: bind: $SNAP/usr/share/alsa /usr/share/X11/xkb: @@ -139,7 +139,7 @@ layout: environment: XDG_CURRENT_DESKTOP: Unity 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: jami: @@ -153,8 +153,8 @@ apps: desktop: usr/share/applications/net.jami.Jami.desktop environment: PIPEWIRE_CONFIG_NAME: "$SNAP/usr/share/pipewire/pipewire.conf" - PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pipewire-0.3" - SPA_PLUGIN_DIR: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/spa-0.2" + PIPEWIRE_MODULE_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/pipewire-0.3" + SPA_PLUGIN_DIR: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/spa-0.2" slots: - dbus-jami - dbus-ring @@ -185,7 +185,7 @@ package-repositories: components: [main] suites: [jami] key-id: A295D773307D25A33AE72F2F64CD5FA175348F84 - url: https://dl.jami.net/internal/ubuntu_20.04/ + url: https://dl.jami.net/internal/ubuntu_22.04/ parts: desktop-launch: @@ -201,14 +201,14 @@ parts: - devscripts - equivs 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_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|\$RUNTIME|$SNAP|g' qt/launcher-specific sed -i -E 's|\$WITH_RUNTIME|no|g' qt/launcher-specific override-build: | - snapcraftctl build + craftctl default gcc -Wall -O2 -o bindtextdomain.so -fPIC -shared src/bindtextdomain.c -ldl echo "#!/bin/bash" > desktop-launch @@ -224,10 +224,10 @@ parts: cat common/mark-and-exec >> desktop-launch - install -D -m755 desktop-launch $SNAPCRAFT_PART_INSTALL/bin/desktop-launch - install -D -m644 bindtextdomain.so $SNAPCRAFT_PART_INSTALL/lib/bindtextdomain.so + install -D -m755 desktop-launch $CRAFT_PART_INSTALL/bin/desktop-launch + 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: plugin: dump @@ -264,45 +264,47 @@ parts: build-environment: - QT_BASE_DIR: "/usr/lib/libqt-jami" - PATH: "$QT_BASE_DIR/bin:$PATH" - - LD_LIBRARY_PATH: "$QT_BASE_DIR/lib:$LD_LIBRARY_PATH" - - PKG_CONFIG_PATH: "$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_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}" override-pull: | 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|^Icon=.*|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/net.jami.Jami.svg|' extras/data/net.jami.Jami.desktop 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 cd native ../bootstrap make .ffmpeg make - cd $SNAPCRAFT_PART_BUILD/daemon + cd $CRAFT_PART_BUILD/daemon ./autogen.sh ./configure --prefix=/usr --without-dbus - make -j$SNAPCRAFT_PARALLEL_BUILD_COUNT - DESTDIR=$SNAPCRAFT_PART_INSTALL make install + make -j$CRAFT_PARALLEL_BUILD_COUNT + DESTDIR=$CRAFT_PART_INSTALL make install - cd $SNAPCRAFT_PART_BUILD/ + cd $CRAFT_PART_BUILD/ mkdir build cd build 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_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$QT_BASE_DIR \ -DBUILD_VERSION=BUILD_VERSION_PLACEHOLDER - make -j$SNAPCRAFT_PARALLEL_BUILD_COUNT - DESTDIR=$SNAPCRAFT_PART_INSTALL make install + make -j$CRAFT_PARALLEL_BUILD_COUNT + DESTDIR=$CRAFT_PART_INSTALL make install build-packages: - autoconf - autoconf-archive - automake - autopoint - bzip2 + - cmake - curl - gcc - g++ @@ -340,6 +342,7 @@ parts: - gnutls-bin - libssl-dev - git # PipeWire build dependencies + - meson # - libasound2-dev # - libdbus-1-dev # These packages are needed by the - libglib2.0-dev # install-pipewire-from-source.sh @@ -352,7 +355,7 @@ parts: - libegl1 - libgbm1 - libgudev-1.0-0 - - libjsoncpp1 + - libjsoncpp25 - libllvm12 - libminizip1 - libnm0 @@ -385,6 +388,6 @@ parts: - -usr/lib/libqt-jami/bin/ - -usr/lib/libqt-jami/docs/ - -usr/lib/libqt-jami/examples/ - - -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libLLVM-*.so* - - -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libclang-*.so* - - -usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libflite*.so* + - -usr/lib/$CRAFT_ARCH_TRIPLET/libLLVM-*.so* + - -usr/lib/$CRAFT_ARCH_TRIPLET/libclang-*.so* + - -usr/lib/$CRAFT_ARCH_TRIPLET/libflite*.so* diff --git a/extras/packaging/gnu-linux/scripts/install-pipewire-from-source.sh b/extras/packaging/gnu-linux/scripts/install-pipewire-from-source.sh index 9bb9ed6dc..edc4d460d 100755 --- a/extras/packaging/gnu-linux/scripts/install-pipewire-from-source.sh +++ b/extras/packaging/gnu-linux/scripts/install-pipewire-from-source.sh @@ -1,6 +1,6 @@ #!/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 set -e @@ -8,28 +8,23 @@ set -e OLD_WD=$(pwd) 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 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 tar xzf pipewire-1.0.5.tar.gz cd pipewire-1.0.5 -../meson-0.61.1/meson.py setup builddir -Dsession-managers=media-session -Dalsa=disabled -Dprefix=/usr -../meson-0.61.1/meson.py compile -C builddir -../meson-0.61.1/meson.py install -C builddir +meson setup builddir -Dsession-managers=media-session -Dalsa=disabled -Dprefix=/usr +meson compile -C builddir +meson install -C builddir # 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 # that PipeWire is installed in the final snap archive, we also need to copy all the # required files under the $SNAPCRAFT_PART_INSTALL directory. -../meson-0.61.1/meson.py configure builddir -Dprefix=$SNAPCRAFT_PART_INSTALL/usr/ -../meson-0.61.1/meson.py install -C builddir +meson configure builddir -Dprefix=$SNAPCRAFT_PART_INSTALL/usr/ +meson install -C builddir # Cleanup 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 \ No newline at end of file