TYPE3
[iec.git] / src / type3_AndroidCloud / anbox-master / snap / snapcraft.yaml
diff --git a/src/type3_AndroidCloud/anbox-master/snap/snapcraft.yaml b/src/type3_AndroidCloud/anbox-master/snap/snapcraft.yaml
new file mode 100644 (file)
index 0000000..3da323d
--- /dev/null
@@ -0,0 +1,308 @@
+name: anbox
+version: 4
+version-script: |
+  if [ "$SNAPCRAFT_GRADE" = "stable" ]; then
+    echo $SNAPCRAFT_PROJECT_VERSION
+  else
+    echo $SNAPCRAFT_PROJECT_VERSION-$(git rev-parse --short HEAD)
+  fi
+summary: Android in a Box
+description: |
+  Runtime for Android applications which runs a full Android system
+  in a container using Linux namespaces (user, ipc, net, mount) to
+  separate the Android system fully from the host.
+confinement: devmode
+grade: devel
+architectures: [amd64]
+
+slots:
+  dbus-session-slot:
+    interface: dbus
+    bus: session
+    name: org.anbox
+
+plugs:
+  dbus-session-plug:
+    interface: dbus
+    bus: session
+    name: org.anbox
+
+apps:
+  anbox:
+    command: desktop-launch $SNAP/bin/anbox-wrapper.sh
+    slots:
+      - dbus-session-slot
+    plugs:
+      - x11
+      - unity7
+      - network
+      - opengl
+      - wayland
+      - pulseaudio
+      - home
+      - process-control
+      - desktop
+
+  container-manager:
+    command: bin/container-manager.sh start
+    stop-command: bin/container-manager.sh stop
+    daemon: simple
+    plugs:
+      - firewall-control
+      - mount-observe
+      - network-control
+      - network-bind
+
+  collect-bug-info:
+    command: bin/collect-bug-info.sh
+  shell:
+    command: bin/anbox-shell.sh
+  android-settings:
+    command: desktop-launch $SNAP/bin/app-android-settings.sh
+    desktop: desktop/android-settings.desktop
+    slots:
+      - dbus-session-slot
+    plugs:
+      - dbus-session-plug
+      - x11
+      - unity7
+      - network
+      - opengl
+      - wayland
+      - pulseaudio
+      - home
+      - process-control
+      - desktop
+
+  appmgr:
+    command: desktop-launch $SNAP/bin/app-appmgr.sh
+    desktop: desktop/appmgr.desktop
+    slots:
+      - dbus-session-slot
+    plugs:
+      - dbus-session-plug
+      - x11
+      - unity7
+      - network
+      - opengl
+      - wayland
+      - pulseaudio
+      - home
+      - process-control
+      - desktop
+
+parts:
+  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
+    override-build: |
+      LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img
+
+      if [ -f $LOCAL_IMAGE ]; then
+
+        echo "Using local image $LOCAL_IMAGE"
+        cp $LOCAL_IMAGE $SNAPCRAFT_PART_INSTALL/android.img
+
+      else
+
+        IMAGE_PATH=
+        IMAGE_NAME=
+        ARCH=$(uname -m)
+
+        case "$ARCH" in
+          x86_64)
+            IMAGE_PATH="2018/07/19"
+            IMAGE_NAME="android_amd64.img"
+            IMAGE_HASH="6b04cd33d157814deaf92dccf8a23da4dc00b05ca6ce982a03830381896a8cca"
+            ;;
+          *)
+            echo "ERROR: Unknown architecture $ARCH"
+            exit 1
+            ;;
+        esac
+
+        # FIXME: downloading with a source: field doesn't work as snapcraft
+        # expects the downloaded file to be an archive it can extract.
+        echo "Downloading image..."
+        wget http://build.anbox.io/android-images/$IMAGE_PATH/$IMAGE_NAME
+
+        echo "$IMAGE_HASH $IMAGE_NAME" > image-hash
+        sha256sum -c image-hash || exit 1
+
+        mv $IMAGE_NAME $SNAPCRAFT_PART_INSTALL/android.img
+
+      fi
+    prime:
+      - android.img
+
+  apparmor:
+    plugin: nil
+    stage-packages:
+      - apparmor
+
+  zip:
+    plugin: nil
+    stage-packages:
+      - zip
+    prime:
+      - usr/bin/zip
+
+  lxc:
+    source: https://github.com/lxc/lxc
+    source-type: git
+    source-tag: lxc-3.0.1
+    build-packages:
+      - libapparmor-dev
+      - libcap-dev
+      - libgnutls28-dev
+      - libseccomp-dev
+      - pkg-config
+    plugin: autotools
+    configflags:
+      - --disable-selinux
+      - --disable-python
+      - --disable-lua
+      - --disable-tests
+      - --disable-examples
+      - --disable-doc
+      - --disable-api-docs
+      - --disable-bash
+      - --disable-cgmanager
+      - --enable-apparmor
+      - --enable-seccomp
+      - --enable-capabilities
+      - --with-rootfs-path=/var/snap/anbox/common/lxc/
+      - --libexecdir=/snap/anbox/current/libexec/
+    override-build: |
+      set -ex
+      git config user.email "buildbot@anbox.io"
+      git config user.name "Anbox Buildbot"
+      git remote add anbox https://github.com/anbox/lxc
+      git fetch anbox
+      # apparmor: don't require a transition for Anbox child profiles
+      git cherry-pick 2f81fb7c91560b32e506bb874f8cd63e37985906
+      set +ex
+      snapcraftctl build
+    organize:
+      snap/anbox/current/libexec: libexec
+    prime:
+      - lib/liblxc.so.1
+      - lib/liblxc.so.1.4.0
+      - libexec/lxc/lxc-monitord
+      - bin/lxc-start
+      - bin/lxc-stop
+      - bin/lxc-info
+      - bin/lxc-attach
+      - bin/lxc-ls
+      - bin/lxc-top
+
+  swiftshader:
+    plugin: cmake
+    source: https://swiftshader.googlesource.com/SwiftShader
+    source-type: git
+    source-commit: b6e8c3f0f4830887d69ba765a922ac3c40e81dd9
+    override-build: |
+      git submodule update --init
+      snapcraftctl build
+    artifacts:
+      - libEGL.so
+      - libGLES_CM.so
+      - libGLESv2.so
+    organize:
+      libEGL.so: lib/anbox/swiftshader/libEGL.so
+      libGLES_CM.so: lib/anbox/swiftshader/libGLES_CM.so
+      libGLESv2.so: lib/anbox/swiftshader/libGLESv2.so
+
+  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
+      app-android-settings.sh: bin/app-android-settings.sh
+      app-appmgr.sh: bin/app-appmgr.sh
+      anbox-shell.sh: bin/anbox-shell.sh
+    prime:
+      - bin/anbox-bridge.sh
+      - bin/anbox-shell.sh
+      - bin/anbox-wrapper.sh
+      - bin/container-manager.sh
+      - bin/collect-bug-info.sh
+      - bin/app-*.sh
+
+  anbox-data:
+    plugin: dump
+    source: data
+    prime:
+      - glvnd
+      - desktop
+      - apparmor
+      - seccomp
+
+  anbox:
+    plugin: cmake
+    after:
+      - lxc
+      - desktop-glib-only
+    source: .
+    configflags:
+      # FIXME: Anbox currently has some paths with hard coded prefixes. Once
+      # that is fixed we can avoid using a prefix here.
+      - -DCMAKE_INSTALL_PREFIX:PATH=/usr
+      - -DANBOX_VERSION=$SNAPCRAFT_PROJECT_VERSION
+      - -DBINDERFS_PATH=/var/snap/anbox/common/binderfs
+      # FIXME: Once we have everything in place for full snap confinement we
+      # can securely enable this.
+      # - -DSNAP_CONFINEMENT=ON
+    build-packages:
+      - build-essential
+      - cmake
+      - cmake-data
+      - cmake-extras
+      - debhelper
+      - dbus
+      - google-mock
+      - libboost-dev
+      - libboost-filesystem-dev
+      - libboost-log-dev
+      - libboost-iostreams-dev
+      - libboost-program-options-dev
+      - libboost-system-dev
+      - libboost-test-dev
+      - libboost-thread-dev
+      - libcap-dev
+      - libdbus-1-dev
+      - libegl1-mesa-dev
+      - libgles2-mesa-dev
+      - libglm-dev
+      - libgtest-dev
+      - libprotobuf-dev
+      - libproperties-cpp-dev
+      - libsdl2-dev
+      - libsdl2-image-dev
+      - libsystemd-dev
+      - pkg-config
+      - protobuf-compiler
+    stage-packages:
+      - libboost-log1.58.0
+      - libboost-iostreams1.58.0
+      - libboost-program-options1.58.0
+      - libboost-thread1.58.0
+      - libdb5.3
+      - libegl1-mesa
+      - libgles2-mesa
+      - libgl1-mesa-glx
+      - libsdl2-2.0-0
+      - libsdl2-gfx-1.0-0
+      - libsdl2-image-2.0-0
+      - libsystemd0
+    prime:
+      - usr/bin/anbox
+      - usr/share/anbox
+      - usr/lib/*-linux-*/