fix(snap): fix snapcraft build files (#2543)

This commit is contained in:
Baptiste Augrain
2025-10-09 02:29:58 +02:00
committed by GitHub
parent 73046b84aa
commit 94a6ad5495
2 changed files with 30 additions and 27 deletions

View File

@@ -109,7 +109,6 @@ copy_env_variable GDK_BACKEND
copy_env_variable GTK_PATH copy_env_variable GTK_PATH
copy_env_variable GTK_EXE_PREFIX copy_env_variable GTK_EXE_PREFIX
copy_env_variable GTK_IM_MODULE_FILE copy_env_variable GTK_IM_MODULE_FILE
copy_env_variable LIBGL_DRIVERS_PATH
# XDG Config # XDG Config
prepend_dir XDG_CONFIG_DIRS "$SNAP/etc/xdg" prepend_dir XDG_CONFIG_DIRS "$SNAP/etc/xdg"
@@ -121,16 +120,12 @@ prepend_dir XDG_DATA_DIRS "$SNAP/data-dir"
prepend_dir XDG_DATA_DIRS "$SNAP_USER_DATA" prepend_dir XDG_DATA_DIRS "$SNAP_USER_DATA"
# Set XDG_DATA_HOME to local path # Set XDG_DATA_HOME to local path
ensure_dir_exists "$SNAP_USER_DATA/.local/share" export XDG_DATA_HOME="$SNAP_USER_DATA/.local/share"
ensure_dir_exists "$XDG_DATA_HOME"
# Workaround for GLib < 2.53.2 not searching for schemas in $XDG_DATA_HOME: # Workaround for GLib < 2.53.2 not searching for schemas in $XDG_DATA_HOME:
# https://bugzilla.gnome.org/show_bug.cgi?id=741335 # https://bugzilla.gnome.org/show_bug.cgi?id=741335
prepend_dir XDG_DATA_DIRS "$SNAP_USER_DATA/.local/share" prepend_dir XDG_DATA_DIRS "$XDG_DATA_HOME"
# Use the snap MESA drivers to launch the snap.
# This is required by wayland, but electron will make better use under X11 too
prepend_dir LIBGL_DRIVERS_PATH "$SNAP/usr/lib/dri"
prepend_dir LIBGL_DRIVERS_PATH "$SNAP/usr/lib/$ARCH/dri"
# Set cache folder to local path # Set cache folder to local path
if [[ -d "$SNAP_USER_DATA/.cache" && ! -e "$SNAP_USER_COMMON/.cache" ]]; then if [[ -d "$SNAP_USER_DATA/.cache" && ! -e "$SNAP_USER_COMMON/.cache" ]]; then
@@ -158,28 +153,45 @@ if [[ -n "$XDG_RUNTIME_DIR" && -z "$DISABLE_WAYLAND" ]] && \
if [ -n "$WAYLAND_DISPLAY" ]; then if [ -n "$WAYLAND_DISPLAY" ]; then
wdisplay="$WAYLAND_DISPLAY" wdisplay="$WAYLAND_DISPLAY"
fi fi
wayland_sockpath="$XDG_RUNTIME_DIR/../$wdisplay"
wayland_snappath="$XDG_RUNTIME_DIR/$wdisplay" wayland_snappath="$XDG_RUNTIME_DIR/$wdisplay"
if [ -S "$wayland_snappath" ]; then if [ -S "$wayland_sockpath" ]; then
# if running under wayland, use it # if running under wayland, use it
#export WAYLAND_DEBUG=1 #export WAYLAND_DEBUG=1
# shellcheck disable=SC2034 # shellcheck disable=SC2034
wayland_available=true wayland_available=true
# create the compat symlink for now
if [ ! -e "$wayland_snappath" ]; then
ln -s "$wayland_sockpath" "$wayland_snappath"
fi
fi fi
fi fi
# Keep an array of data dirs, for looping through them # Keep an array of data dirs, for looping through them
IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS" IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS"
# Build mime.cache # Font Config
# needed for gtk and qt icon export FONTCONFIG_PATH="/etc/fonts"
export FONTCONFIG_FILE="/etc/fonts/fonts.conf"
if [ "$needs_update" = true ]; then
rm -rf "$XDG_DATA_HOME"/fonts
if [ -d "$SNAP_REAL_HOME/.local/share/fonts" ]; then
ln -s "$SNAP_REAL_HOME/.local/share/fonts" "$XDG_DATA_HOME/fonts"
fi
fi
# Build mime.cache needed for gtk and qt icon
# @TODO: Re-enable this once we move to core22
if [ "$needs_update" = true ]; then if [ "$needs_update" = true ]; then
rm -rf "$SNAP_USER_DATA/.local/share/mime" rm -rf "$SNAP_USER_DATA/.local/share/mime"
if [ ! -f "$SNAP/usr/share/mime/mime.cache" ]; then # if [ ! -f "$SNAP/usr/share/mime/mime.cache" ]; then
if command -v update-mime-database >/dev/null; then # if command -v update-mime-database >/dev/null; then
cp --preserve=timestamps -dR "$SNAP/usr/share/mime" "$SNAP_USER_DATA/.local/share" # cp --preserve=timestamps -dR "$SNAP/usr/share/mime" "$SNAP_USER_DATA/.local/share"
async_exec update-mime-database "$SNAP_USER_DATA/.local/share/mime" # async_exec update-mime-database "$SNAP_USER_DATA/.local/share/mime"
fi # fi
fi # fi
fi fi
# Gio modules and cache (including gsettings module) # Gio modules and cache (including gsettings module)

View File

@@ -59,7 +59,6 @@ parts:
- libnss3 - libnss3
- libpango-1.0-0 - libpango-1.0-0
- libsecret-1-0 - libsecret-1-0
- libvulkan1
- libwayland-egl1 - libwayland-egl1
- libxcomposite1 - libxcomposite1
- libxdamage1 - libxdamage1
@@ -70,20 +69,14 @@ parts:
- libxss1 - libxss1
- locales-all - locales-all
- packagekit-gtk3-module - packagekit-gtk3-module
- gnome-settings-daemon-common
- xdg-utils - xdg-utils
prime: prime:
- -lib/udev
- -usr/lib/systemd
- -usr/share/doc - -usr/share/doc
- -usr/share/fonts - -usr/share/fonts
- -usr/share/icons - -usr/share/icons
- -usr/share/lintian - -usr/share/lintian
- -usr/share/man - -usr/share/man
- -usr/share/codium/chrome-sandbox - -usr/share/codium-insiders/chrome-sandbox
- -usr/share/@@NAME@@/libEGL.so*
- -usr/share/@@NAME@@/libGLESv2.so*
- -usr/share/@@NAME@@/libvulkan.so*
build-attributes: build-attributes:
- enable-patchelf - enable-patchelf
override-prime: | override-prime: |
@@ -104,8 +97,6 @@ apps:
codium: codium:
command: electron-launch $SNAP/usr/share/codium-insiders/bin/codium-insiders --no-sandbox command: electron-launch $SNAP/usr/share/codium-insiders/bin/codium-insiders --no-sandbox
desktop: usr/share/applications/codium-insiders.desktop desktop: usr/share/applications/codium-insiders.desktop
common-id: codium-insiders.desktop
url-handler: url-handler:
command: electron-launch $SNAP/usr/share/codium-insiders/bin/codium-insiders --open-url --no-sandbox command: electron-launch $SNAP/usr/share/codium-insiders/bin/codium-insiders --open-url --no-sandbox
desktop: usr/share/applications/codium-insiders-url-handler.desktop