snapcraft.yaml 4.0 KB
Newer Older
S
Simon Fels 已提交
1
name: anbox
S
Simon Fels 已提交
2
version: 3
3 4 5 6 7 8
version-script: |
  if [ "$SNAPCRAFT_GRADE" = "stable" ]; then
    echo $SNAPCRAFT_PROJECT_VERSION
  else
    echo $SNAPCRAFT_PROJECT_VERSION-$(git rev-parse --short HEAD)
  fi
S
Simon Fels 已提交
9 10 11 12 13 14
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
15
grade: devel
S
Simon Fels 已提交
16 17

apps:
18
  anbox:
19
    command: bin/anbox-wrapper.sh
20
  container-manager:
21 22
    command: bin/container-manager.sh start
    stop-command: bin/container-manager.sh stop
S
Simon Fels 已提交
23
    daemon: simple
S
Simon Fels 已提交
24 25

parts:
26
  android-images:
27
    plugin: dump
28 29 30
    # 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
31 32
    build-packages:
      - wget
33
    install: |
34 35 36 37 38 39
      IMAGE_PATH=
      IMAGE_NAME=
      ARCH=$(uname -m)

      case "$ARCH" in
        x86_64)
S
Simon Fels 已提交
40 41
          IMAGE_PATH="2017/07/07"
          IMAGE_NAME="android_2_amd64"
42 43 44 45 46 47 48 49 50 51 52 53
          ;;
        arm*)
          IMAGE_PATH="2017/06/12"
          IMAGE_NAME="android_1_armhf"
          ;;
      esac

      if [ -z "$IMAGE_PATH" ] || [ -z "$IMAGE_NAME" ]; then
        echo "ERROR: Unknown architecture $ARCH"
        exit 1
      fi

54 55
      # FIXME: downloading with a source: field doesn't work as snapcraft
      # expects the downloaded file to be an archive it can extract.
56 57
      wget http://build.anbox.io/android-images/$IMAGE_PATH/$IMAGE_NAME.img
      mv $IMAGE_NAME.img $SNAPCRAFT_PART_INSTALL/android.img
58 59
    prime:
      - android.img
60
  anbox-common:
61
    plugin: dump
62
    source: scripts
63 64 65 66 67
    organize:
      snap-wrapper.sh: bin/anbox-wrapper.sh
      container-manager.sh: bin/container-manager.sh
      anbox-bridge.sh: bin/anbox-bridge.sh
    prime:
S
Simon Fels 已提交
68
      - bin/anbox-bridge.sh
69
      - bin/anbox-wrapper.sh
70
      - bin/container-manager.sh
71 72 73 74
  apparmor:
    plugin: nil
    stage-packages:
      - apparmor
75
  lxc:
76 77 78
    source: https://github.com/lxc/lxc
    source-type: git
    source-tag: lxc-2.0.7
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    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
      - --disable-apparmor
      - --disable-seccomp
      - --enable-capabilities
      - --with-rootfs-path=/var/snap/anbox/common/lxc/
100 101 102
      - --libexecdir=/snap/anbox/current/libexec/
    organize:
      snap/anbox/current/libexec: libexec
103
    prime:
104 105 106 107 108 109 110
      - lib/liblxc.so.1
      - lib/liblxc.so.1.2.0
      - libexec/lxc/lxc-monitord
  anbox:
    plugin: cmake
    after:
      - lxc
111
    source: .
112 113 114 115
    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
116
      - -DANBOX_VERSION=$SNAPCRAFT_PROJECT_VERSION
117 118 119 120
    build-packages:
      - build-essential
      - cmake
      - cmake-data
121
      - cmake-extras
122 123 124 125 126 127 128 129 130
      - debhelper
      - dbus
      - google-mock
      - libboost-dev
      - libboost-filesystem-dev
      - libboost-log-dev
      - libboost-iostreams-dev
      - libboost-program-options-dev
      - libboost-system-dev
131
      - libboost-test-dev
132 133 134 135 136 137 138
      - libboost-thread-dev
      - libcap-dev
      - libdbus-1-dev
      - libdbus-cpp-dev
      - libegl1-mesa-dev
      - libgles2-mesa-dev
      - libglib2.0-dev
S
Simon Fels 已提交
139
      - libglm-dev
140 141
      - libgtest-dev
      - libprotobuf-dev
S
Simon Fels 已提交
142
      - libproperties-cpp-dev
143
      - libsdl2-dev
144
      - libsdl2-image-dev
145 146 147 148 149 150 151 152
      - pkg-config
      - protobuf-compiler
    stage-packages:
      - libegl1-mesa
      - libgles2-mesa
      - libgl1-mesa-glx
      - libsdl2-2.0-0
      - libsdl2-gfx-1.0-0
153 154
    install: |
      make test
155
    prime:
156
      - usr/bin/anbox
157
      - usr/share/anbox
158
      - usr/lib/*-linux-*/