Skip to content

Commit

Permalink
chore: update rpath of crashpad handler
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Mar 7, 2023
1 parent ba18fc4 commit 0346e2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 51 deletions.
51 changes: 12 additions & 39 deletions resources/linux/snap/electron-launch
Original file line number Diff line number Diff line change
Expand Up @@ -112,31 +112,10 @@ function update_xdg_dirs_values() {
done
}

# Tell libGL and libva where to find the drivers
export LIBGL_DRIVERS_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/dri"
append_dir LIBVA_DRIVERS_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/dri"

# Set where the VDPAU drivers are located
export VDPAU_DRIVER_PATH="/usr/lib/$ARCH/vdpau/"
if [ -e "/var/lib/snapd/lib/gl/vdpau/libvdpau_nvidia.so" ]; then
export VDPAU_DRIVER_PATH="/var/lib/snapd/lib/gl/vdpau"
if [ "$__NV_PRIME_RENDER_OFFLOAD" = 1 ]; then
# Prevent picking VA-API (Intel/AMD) over NVIDIA VDPAU
# https://download.nvidia.com/XFree86/Linux-x86_64/510.54/README/primerenderoffload.html#configureapplications
unset LIBVA_DRIVERS_PATH
fi
fi

# EGL vendor files on glvnd enabled systems
prepend_dir __EGL_VENDOR_LIBRARY_DIRS "/var/lib/snapd/lib/glvnd/egl_vendor.d"
append_dir __EGL_VENDOR_LIBRARY_DIRS "$SNAP_DESKTOP_RUNTIME/usr/share/glvnd/egl_vendor.d"

# XDG Config
prepend_dir XDG_CONFIG_DIRS "$SNAP_DESKTOP_RUNTIME/etc/xdg"
prepend_dir XDG_CONFIG_DIRS "$SNAP/etc/xdg"

# Define snaps' own data dir
prepend_dir XDG_DATA_DIRS "$SNAP_DESKTOP_RUNTIME/usr/share"
prepend_dir XDG_DATA_DIRS "$SNAP/usr/share"
prepend_dir XDG_DATA_DIRS "$SNAP/share"
prepend_dir XDG_DATA_DIRS "$SNAP/data-dir"
Expand All @@ -163,7 +142,7 @@ ensure_dir_exists "$XDG_CACHE_HOME"
ensure_dir_exists "$XDG_RUNTIME_DIR" -m 700

# Ensure the app finds locale definitions (requires locales-all to be installed)
append_dir LOCPATH "$SNAP_DESKTOP_RUNTIME/usr/lib/locale"
append_dir LOCPATH "$SNAP/usr/lib/locale"

# If any, keep track of where XDG dirs were so we can potentially migrate the content later
if [ "$needs_update" = true ]; then
Expand Down Expand Up @@ -200,17 +179,13 @@ fi
# Keep an array of data dirs, for looping through them
IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS"

# Font Config and themes
export FONTCONFIG_PATH="$SNAP_DESKTOP_RUNTIME/etc/fonts"
export FONTCONFIG_FILE="$SNAP_DESKTOP_RUNTIME/etc/fonts/fonts.conf"

# Build mime.cache
# needed for gtk and qt icon
if [ "$needs_update" = true ]; then
rm -rf "$XDG_DATA_HOME/mime"
if [ ! -f "$SNAP_DESKTOP_RUNTIME/usr/share/mime/mime.cache" ]; then
if [ ! -f "$SNAP/usr/share/mime/mime.cache" ]; then
if command -v update-mime-database >/dev/null; then
cp --preserve=timestamps -dR "$SNAP_DESKTOP_RUNTIME/usr/share/mime" "$XDG_DATA_HOME"
cp --preserve=timestamps -dR "$SNAP/usr/share/mime" "$XDG_DATA_HOME"
async_exec update-mime-database "$XDG_DATA_HOME/mime"
fi
fi
Expand All @@ -227,7 +202,7 @@ function compile_giomodules {
fi
}
if [ "$needs_update" = true ]; then
async_exec compile_giomodules "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH"
async_exec compile_giomodules "$SNAP/usr/lib/$ARCH"
fi

# Setup compiled gsettings schema
Expand Down Expand Up @@ -256,16 +231,16 @@ function compile_schemas {
fi
}
if [ "$needs_update" = true ]; then
async_exec compile_schemas "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/glib-2.0/glib-compile-schemas"
async_exec compile_schemas "$SNAP/usr/lib/$ARCH/glib-2.0/glib-compile-schemas"
fi

# Gdk-pixbuf loaders
export GDK_PIXBUF_MODULE_FILE="$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache"
export GDK_PIXBUF_MODULEDIR="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders"
export GDK_PIXBUF_MODULEDIR="$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders"
if [ "$needs_update" = true ] || [ ! -f "$GDK_PIXBUF_MODULE_FILE" ]; then
rm -f "$GDK_PIXBUF_MODULE_FILE"
if [ -f "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" ]; then
async_exec "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" > "$GDK_PIXBUF_MODULE_FILE"
if [ -f "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" ]; then
async_exec "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" > "$GDK_PIXBUF_MODULE_FILE"
fi
fi

Expand All @@ -284,10 +259,8 @@ if [ "$wayland_available" = true ]; then
export QT_QPA_PLATFORM=wayland-egl
fi

append_dir GTK_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/gtk-2.0"
append_dir GTK_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/gtk-2.0"
append_dir GTK_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/gtk-3.0"
append_dir GTK_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/gtk-3.0"
append_dir GTK_PATH "$SNAP/usr/lib/$ARCH/gtk-3.0"
append_dir GTK_PATH "$SNAP/usr/lib/gtk-3.0"

# ibus and fcitx integration
GTK_IM_MODULE_DIR="$XDG_CACHE_HOME/immodules"
Expand All @@ -296,8 +269,8 @@ export GTK_IM_MODULE_FILE="$GTK_IM_MODULE_DIR/immodules.cache"
if [ "$needs_update" = true ]; then
rm -rf "$GTK_IM_MODULE_DIR"
ensure_dir_exists "$GTK_IM_MODULE_DIR"
ln -s "$SNAP_DESKTOP_RUNTIME"/usr/lib/"$ARCH"/gtk-3.0/3.0.0/immodules/*.so "$GTK_IM_MODULE_DIR"
async_exec "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/libgtk-3-0/gtk-query-immodules-3.0" > "$GTK_IM_MODULE_FILE"
ln -s "$SNAP"/usr/lib/"$ARCH"/gtk-3.0/3.0.0/immodules/*.so "$GTK_IM_MODULE_DIR"
async_exec "$SNAP/usr/lib/$ARCH/libgtk-3-0/gtk-query-immodules-3.0" > "$GTK_IM_MODULE_FILE"
fi

# shellcheck disable=SC2154
Expand Down
20 changes: 8 additions & 12 deletions resources/linux/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ parts:
- libatk1.0-0
- libatspi2.0-0
- libcairo2
- libcanberra-gtk3-module
- libcurl3-gnutls
- libcurl3-nss
- libcurl4
- libdrm2
- libgbm1
- libgl1
- libglib2.0-0
- libgtk-3-0
- libnss3
- libpango-1.0-0
Expand All @@ -43,25 +45,18 @@ parts:
- libxkbfile1
- libxrandr2
- libxss1
- locales-all
- packagekit-gtk3-module
- xdg-utils
prime:
- -usr/share/doc
- -usr/share/fonts
- -usr/share/icons
- -usr/share/lintian
- -usr/share/man
gnome-platform:
plugin: nil
build-packages:
- snapd
override-build: |
set -eu
snap download gnome-3-38-2004
unsquashfs -f -d $SNAPCRAFT_PART_INSTALL/gnome-platform gnome-*.snap
cleanup:
after:
- code
- gnome-platform
plugin: nil
build-snaps:
- core20
Expand All @@ -70,18 +65,19 @@ parts:
for snap in "core20"; do
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done
patchelf --print-rpath $SNAPCRAFT_PRIME/usr/share/code-insiders/code-insiders
export BASE_EXE_RPATH=$(patchelf --print-rpath $SNAPCRAFT_PRIME/usr/share/@@NAME@@/@@NAME@@)
patchelf --force-rpath --set-rpath $BASE_EXE_RPATH $SNAPCRAFT_PRIME/usr/share/@@NAME@@/chrome_crashpad_handler
patchelf --print-rpath $SNAPCRAFT_PRIME/usr/share/@@NAME@@/chrome_crashpad_handler
apps:
@@NAME@@:
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --no-sandbox
common-id: @@NAME@@.desktop
environment:
GTK_USE_PORTAL: 1
SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform

url-handler:
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url --no-sandbox
environment:
GTK_USE_PORTAL: 1
SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform

0 comments on commit 0346e2b

Please sign in to comment.