snapcraft.yaml 4.8 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 18 19 20 21 22 23 24 25 26 27 28 29
slots:
  # Depending on in which environment we're running we either need
  # to use the system or session DBus so we also need to have one
  # slot for each.
  dbus-session:
    interface: dbus
    bus: system
    name: org.anbox
  dbus-system:
    interface: dbus
    bus: system
    name: org.anbox

S
Simon Fels 已提交
30
apps:
31
  anbox:
32
    command: bin/anbox-wrapper.sh
33
  container-manager:
34 35
    command: bin/container-manager.sh start
    stop-command: bin/container-manager.sh stop
S
Simon Fels 已提交
36
    daemon: simple
37 38
  collect-bug-info:
    command: bin/collect-bug-info.sh
S
Simon Fels 已提交
39 40

parts:
41
  android-images:
42
    plugin: dump
43 44 45
    # 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
46 47
    build-packages:
      - wget
48
    install: |
49
      LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img
50

51
      if [ -f $LOCAL_IMAGE ]; then
52

53 54 55 56 57 58 59 60
        echo "Using local image $LOCAL_IMAGE"
        cp $LOCAL_IMAGE $SNAPCRAFT_PART_INSTALL/android.img

      else

        IMAGE_PATH=
        IMAGE_NAME=
        ARCH=$(uname -m)
61

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
        case "$ARCH" in
          x86_64)
            IMAGE_PATH="2017/07/13"
            IMAGE_NAME="android_3_amd64.img"
            ;;
          arm*)
            IMAGE_PATH="2017/06/12"
            IMAGE_NAME="android_1_armhf.img"
            ;;
          *)
            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
        mv $IMAGE_NAME $SNAPCRAFT_PART_INSTALL/android.img

      fi
84 85
    prime:
      - android.img
86
  anbox-common:
87
    plugin: dump
88
    source: scripts
89 90 91 92
    organize:
      snap-wrapper.sh: bin/anbox-wrapper.sh
      container-manager.sh: bin/container-manager.sh
      anbox-bridge.sh: bin/anbox-bridge.sh
93
      collect-bug-info.sh: bin/collect-bug-info.sh
94
    prime:
S
Simon Fels 已提交
95
      - bin/anbox-bridge.sh
96
      - bin/anbox-wrapper.sh
97
      - bin/container-manager.sh
98
      - bin/collect-bug-info.sh
99 100 101 102
  apparmor:
    plugin: nil
    stage-packages:
      - apparmor
103
  lxc:
104 105 106
    source: https://github.com/lxc/lxc
    source-type: git
    source-tag: lxc-2.0.7
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
    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/
128 129 130
      - --libexecdir=/snap/anbox/current/libexec/
    organize:
      snap/anbox/current/libexec: libexec
131
    prime:
132 133 134
      - lib/liblxc.so.1
      - lib/liblxc.so.1.2.0
      - libexec/lxc/lxc-monitord
135 136 137 138 139 140
      - bin/lxc-start
      - bin/lxc-stop
      - bin/lxc-info
      - bin/lxc-attach
      - bin/lxc-ls
      - bin/lxc-top
141 142 143 144
  anbox:
    plugin: cmake
    after:
      - lxc
145
    source: .
146 147 148 149
    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
150
      - -DANBOX_VERSION=$SNAPCRAFT_PROJECT_VERSION
151 152 153 154
    build-packages:
      - build-essential
      - cmake
      - cmake-data
155
      - cmake-extras
156 157 158 159 160 161 162 163 164
      - debhelper
      - dbus
      - google-mock
      - libboost-dev
      - libboost-filesystem-dev
      - libboost-log-dev
      - libboost-iostreams-dev
      - libboost-program-options-dev
      - libboost-system-dev
165
      - libboost-test-dev
166 167 168 169 170 171 172
      - libboost-thread-dev
      - libcap-dev
      - libdbus-1-dev
      - libdbus-cpp-dev
      - libegl1-mesa-dev
      - libgles2-mesa-dev
      - libglib2.0-dev
S
Simon Fels 已提交
173
      - libglm-dev
174 175
      - libgtest-dev
      - libprotobuf-dev
S
Simon Fels 已提交
176
      - libproperties-cpp-dev
177
      - libsdl2-dev
178
      - libsdl2-image-dev
179 180 181 182 183 184 185 186
      - pkg-config
      - protobuf-compiler
    stage-packages:
      - libegl1-mesa
      - libgles2-mesa
      - libgl1-mesa-glx
      - libsdl2-2.0-0
      - libsdl2-gfx-1.0-0
187 188
    install: |
      make test
189
    prime:
190
      - usr/bin/anbox
191
      - usr/share/anbox
192
      - usr/lib/*-linux-*/