From 7dde2d9fdf1bc31447c209942507b6ae7ed80db4 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Wed, 16 May 2018 07:23:56 +0200 Subject: [PATCH] snap: cleanup and small refactoring We're using the desktop helpers now to setup all necessary environment variables for GL drivers etc. and only keep a small set of extra changes on top for things the desktop-helpers don't support yet. --- scripts/container-manager.sh | 3 ++ scripts/snap-wrapper.sh | 30 ++-------------- snapcraft.yaml => snap/snapcraft.yaml | 51 +++++++++++++++++---------- 3 files changed, 39 insertions(+), 45 deletions(-) rename snapcraft.yaml => snap/snapcraft.yaml (92%) diff --git a/scripts/container-manager.sh b/scripts/container-manager.sh index 44b4352..0ac99be 100755 --- a/scripts/container-manager.sh +++ b/scripts/container-manager.sh @@ -35,6 +35,9 @@ start() { AA_EXEC="" fi + # liblxc.so.1 is in $SNAP/lib + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/lib + exec $AA_EXEC $SNAP/bin/anbox-wrapper.sh container-manager \ --data-path=$DATA_PATH \ --android-image=$ANDROID_IMG \ diff --git a/scripts/snap-wrapper.sh b/scripts/snap-wrapper.sh index b1f1e3b..5cb0db0 100755 --- a/scripts/snap-wrapper.sh +++ b/scripts/snap-wrapper.sh @@ -8,38 +8,14 @@ else ARCH="$SNAP_ARCH-linux-gnu" fi -export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH - -# Mesa Libs -export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH - -# XDG Config -export XDG_CONFIG_DIRS=$SNAP/etc/xdg:$XDG_CONFIG_DIRS -export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$XDG_CONFIG_DIRS - -# Note: this doesn't seem to work, QML's LocalStorage either ignores -# or fails to use $SNAP_USER_DATA if defined here -export XDG_DATA_DIRS=$SNAP_USER_DATA:$XDG_DATA_DIRS -export XDG_DATA_DIRS=$SNAP/usr/share:$XDG_DATA_DIRS - -# Tell libGL where to find the drivers -export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri - -# ensure the snappy gl libs win -export LD_LIBRARY_PATH="$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH" - -# Workaround in snapd for proprietary nVidia drivers mounts the drivers in -# /var/lib/snapd/lib/gl that needs to be in LD_LIBRARY_PATH -# Without that OpenGL using apps do not work with the nVidia drivers. -# Ref.: https://bugs.launchpad.net/snappy/+bug/1588192 -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/snapd/lib/gl - # With recent builds on Ubuntu 16.04 the snap does not find the path to # libpulsecommon-8.0.so anymore so we have to teach the linker manually # where it can be found export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/usr/lib/$ARCH/pulseaudio +# liblxc.so.1 is in $SNAP/lib +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/lib + # We set XDG_DATA_HOME to SNAP_USER_COMMON here as this will be the location we will # create all our application launchers in. The system application launcher will # be configured by our installer to look into this directory for available diff --git a/snapcraft.yaml b/snap/snapcraft.yaml similarity index 92% rename from snapcraft.yaml rename to snap/snapcraft.yaml index 3349124..7717b4d 100644 --- a/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -29,7 +29,7 @@ slots: apps: anbox: - command: bin/anbox-wrapper.sh + command: desktop-launch $SNAP/bin/anbox-wrapper.sh container-manager: command: bin/container-manager.sh start stop-command: bin/container-manager.sh stop @@ -38,14 +38,14 @@ apps: command: bin/collect-bug-info.sh parts: - android-images: + android: plugin: dump # This needs to be any directory but not the root one as if we use # it we get superious permissions errors with the copied .git tree source: data build-packages: - wget - install: | + override-build: | LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img if [ -f $LOCAL_IMAGE ]; then @@ -83,23 +83,12 @@ parts: fi prime: - android.img - anbox-common: - plugin: dump - source: scripts - organize: - snap-wrapper.sh: bin/anbox-wrapper.sh - container-manager.sh: bin/container-manager.sh - anbox-bridge.sh: bin/anbox-bridge.sh - collect-bug-info.sh: bin/collect-bug-info.sh - prime: - - bin/anbox-bridge.sh - - bin/anbox-wrapper.sh - - bin/container-manager.sh - - bin/collect-bug-info.sh + apparmor: plugin: nil stage-packages: - apparmor + lxc: source: https://github.com/lxc/lxc source-type: git @@ -138,10 +127,32 @@ parts: - bin/lxc-attach - bin/lxc-ls - bin/lxc-top + + anbox-scripts: + plugin: dump + source: scripts + organize: + snap-wrapper.sh: bin/anbox-wrapper.sh + container-manager.sh: bin/container-manager.sh + anbox-bridge.sh: bin/anbox-bridge.sh + collect-bug-info.sh: bin/collect-bug-info.sh + prime: + - bin/anbox-bridge.sh + - bin/anbox-wrapper.sh + - bin/container-manager.sh + - bin/collect-bug-info.sh + + anbox-data: + plugin: dump + source: data + prime: + - glvnd + anbox: plugin: cmake after: - lxc + - desktop-glib-only source: . configflags: # FIXME: Anbox currently has some paths with hard coded prefixes. Once @@ -178,13 +189,17 @@ parts: - pkg-config - protobuf-compiler stage-packages: + - libboost-log1.58.0 + - libboost-program-options1.58.0 + - libboost-thread1.58.0 + - libdb5.3 + - libdbus-cpp5 - libegl1-mesa - libgles2-mesa - libgl1-mesa-glx - libsdl2-2.0-0 - libsdl2-gfx-1.0-0 - install: | - make test + - libsdl2-image-2.0-0 prime: - usr/bin/anbox - usr/share/anbox