Skip to content

Commit

Permalink
snap works in devmode now!
Browse files Browse the repository at this point in the history
  • Loading branch information
GloriousEggroll committed Jul 9, 2024
1 parent 9e9cca9 commit 592304d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packaging/snap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ snapcraft

4. Install:

snap install --dangerous umu-launcher*.snap
snap install --dangerous --devmode umu-launcher*.snap

5. Test:

Expand Down
45 changes: 45 additions & 0 deletions packaging/snap/hooks/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

# https://github.com/canonical/steam-snap/issues/19#issuecomment-1171984524
# https://gist.github.com/jhenstridge/425c769949d034033f3d5d90acc2f181

set -e

mkdir -p $SNAP_DATA/etc

snap_ld_so_conf=$SNAP_DATA/etc/snap-ld.so.conf
snap_ld_so_cache=$SNAP_DATA/etc/snap-ld.so.cache
real_ld_so_cache=$SNAP_DATA/etc/ld.so.cache

RUNTIME=$SNAP/gnome-platform

cat > "$snap_ld_so_conf" <<EOF
/var/lib/snapd/lib/gl
/var/lib/snapd/lib/gl32
$SNAP/lib/x86_64-linux-gnu
$SNAP/lib/i386-linux-gnu
$SNAP/lib
$SNAP/usr/lib/x86_64-linux-gnu
$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio
$SNAP/usr/lib/i386-linux-gnu
$SNAP/usr/lib
$SNAP/usr/lib/x86_64-linux-gnu/dri
$SNAP/usr/lib/i386-linux-gnu/dri
$SNAP/usr/lib/i386-linux-gnu/pulseaudio
$SNAP/graphics/lib
$SNAP/graphics/usr/lib
$SNAP/graphics/usr/lib/i386-linux-gnu
$SNAP/graphics/usr/lib/x86_64-linux-gnu
$SNAP/graphics/usr/lib/i386-linux-gnu/dri
$SNAP/graphics/usr/lib/x86_64-linux-gnu/dri
/lib/x86_64-linux-gnu
/lib/i386-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
EOF

ldconfig -X -f $snap_ld_so_conf -C $snap_ld_so_cache

# We need to update the real ld.so.cache in place rather than moving
# over the top of it, since it is the source of a bind mount.
cat $snap_ld_so_cache > $real_ld_so_cache
29 changes: 14 additions & 15 deletions packaging/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: |
UMU Launcher is a tool for managing and launching applications.
base: core22 # or core18, core22 depending on your needs
confinement: strict # You can change this to 'classic' if needed
confinement: devmode # You can change this to 'classic' if needed
architectures:
- build-on: amd64
grade: stable
Expand Down Expand Up @@ -128,7 +128,10 @@ parts:
- gcc
- scdoc
- dpkg-dev
- dirmngr # Needed for launchpad builds
- dirmngr
- python3-build
- python3-hatchling
- python3-installer
stage-packages:
- libappindicator3-1
- libxcb-dri3-0:amd64
Expand All @@ -154,16 +157,17 @@ parts:
- psmisc
- python3-gi
- gir1.2-gtk-3.0
stage:
- bin/*
- usr/lib/python3/dist-packages/*
- usr/share/umu
- usr/bin
override-build: |
set -e
git submodule update --init --recursive
./configure.sh --prefix=$SNAPCRAFT_PART_INSTALL/usr
make install
./configure.sh --prefix=$SNAPCRAFT_PART_INSTALL
make
make install DESTDIR=umu_build
cp -R umu_build$SNAPCRAFT_PART_INSTALL/* $SNAPCRAFT_PART_INSTALL/
cp -R umu_build$SNAPCRAFT_PART_INSTALL/* $SNAPCRAFT_PART_INSTALL/
cp -R umu_build/usr/local/bin $SNAPCRAFT_PART_INSTALL/usr/
cp -R umu_build/usr/local/lib/python*/* $SNAPCRAFT_PART_INSTALL/usr/lib/python3/
rm -Rf umu_build
prime:
- -usr/share/doc
- -usr/share/man
Expand All @@ -180,18 +184,13 @@ parts:
- -usr/lib/*/libvulkan*
- -usr/lib/*/libVk*
- -usr/lib/*/libLLVM*
- usr/share/umu
- usr/bin
build-snaps: [core22]
# For some braindead stupid reason sed doesn't work here so we have to overwrite the file instead.
override-prime: |
set -eux
craftctl default
ls -la usr/lib/
cp -a /snap/core22/current/usr/lib/i386-linux-gnu usr/lib/
chmod +x usr/share/umu/umu_run.py
echo '#!/usr/bin/env sh' > usr/bin/umu-run
echo '$SNAP/usr/share/umu/umu_run.py "$@"' >> usr/bin/umu-run
py-deps:
after: [umu-run]
Expand Down

0 comments on commit 592304d

Please sign in to comment.