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.
This commit is contained in:
Simon Fels 2018-05-16 07:23:56 +02:00
commit 7dde2d9fdf
3 changed files with 39 additions and 45 deletions

View file

@ -35,6 +35,9 @@ start() {
AA_EXEC="" AA_EXEC=""
fi 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 \ exec $AA_EXEC $SNAP/bin/anbox-wrapper.sh container-manager \
--data-path=$DATA_PATH \ --data-path=$DATA_PATH \
--android-image=$ANDROID_IMG \ --android-image=$ANDROID_IMG \

View file

@ -8,38 +8,14 @@ else
ARCH="$SNAP_ARCH-linux-gnu" ARCH="$SNAP_ARCH-linux-gnu"
fi 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 # 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 # libpulsecommon-8.0.so anymore so we have to teach the linker manually
# where it can be found # where it can be found
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/usr/lib/$ARCH/pulseaudio 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 # 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 # create all our application launchers in. The system application launcher will
# be configured by our installer to look into this directory for available # be configured by our installer to look into this directory for available

View file

@ -29,7 +29,7 @@ slots:
apps: apps:
anbox: anbox:
command: bin/anbox-wrapper.sh command: desktop-launch $SNAP/bin/anbox-wrapper.sh
container-manager: container-manager:
command: bin/container-manager.sh start command: bin/container-manager.sh start
stop-command: bin/container-manager.sh stop stop-command: bin/container-manager.sh stop
@ -38,14 +38,14 @@ apps:
command: bin/collect-bug-info.sh command: bin/collect-bug-info.sh
parts: parts:
android-images: android:
plugin: dump plugin: dump
# This needs to be any directory but not the root one as if we use # 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 # it we get superious permissions errors with the copied .git tree
source: data source: data
build-packages: build-packages:
- wget - wget
install: | override-build: |
LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img
if [ -f $LOCAL_IMAGE ]; then if [ -f $LOCAL_IMAGE ]; then
@ -83,23 +83,12 @@ parts:
fi fi
prime: prime:
- android.img - 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: apparmor:
plugin: nil plugin: nil
stage-packages: stage-packages:
- apparmor - apparmor
lxc: lxc:
source: https://github.com/lxc/lxc source: https://github.com/lxc/lxc
source-type: git source-type: git
@ -138,10 +127,32 @@ parts:
- bin/lxc-attach - bin/lxc-attach
- bin/lxc-ls - bin/lxc-ls
- bin/lxc-top - 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: anbox:
plugin: cmake plugin: cmake
after: after:
- lxc - lxc
- desktop-glib-only
source: . source: .
configflags: configflags:
# FIXME: Anbox currently has some paths with hard coded prefixes. Once # FIXME: Anbox currently has some paths with hard coded prefixes. Once
@ -178,13 +189,17 @@ parts:
- pkg-config - pkg-config
- protobuf-compiler - protobuf-compiler
stage-packages: stage-packages:
- libboost-log1.58.0
- libboost-program-options1.58.0
- libboost-thread1.58.0
- libdb5.3
- libdbus-cpp5
- libegl1-mesa - libegl1-mesa
- libgles2-mesa - libgles2-mesa
- libgl1-mesa-glx - libgl1-mesa-glx
- libsdl2-2.0-0 - libsdl2-2.0-0
- libsdl2-gfx-1.0-0 - libsdl2-gfx-1.0-0
install: | - libsdl2-image-2.0-0
make test
prime: prime:
- usr/bin/anbox - usr/bin/anbox
- usr/share/anbox - usr/share/anbox