Add a http performance test script based on wrk
[iec.git] / src / type3_AndroidCloud / anbox-master / snap / snapcraft.yaml
1 name: anbox
2 version: 4
3 version-script: |
4   if [ "$SNAPCRAFT_GRADE" = "stable" ]; then
5     echo $SNAPCRAFT_PROJECT_VERSION
6   else
7     echo $SNAPCRAFT_PROJECT_VERSION-$(git rev-parse --short HEAD)
8   fi
9 summary: Android in a Box
10 description: |
11   Runtime for Android applications which runs a full Android system
12   in a container using Linux namespaces (user, ipc, net, mount) to
13   separate the Android system fully from the host.
14 confinement: devmode
15 grade: devel
16 architectures: [amd64]
17
18 slots:
19   dbus-session-slot:
20     interface: dbus
21     bus: session
22     name: org.anbox
23
24 plugs:
25   dbus-session-plug:
26     interface: dbus
27     bus: session
28     name: org.anbox
29
30 apps:
31   anbox:
32     command: desktop-launch $SNAP/bin/anbox-wrapper.sh
33     slots:
34       - dbus-session-slot
35     plugs:
36       - x11
37       - unity7
38       - network
39       - opengl
40       - wayland
41       - pulseaudio
42       - home
43       - process-control
44       - desktop
45
46   container-manager:
47     command: bin/container-manager.sh start
48     stop-command: bin/container-manager.sh stop
49     daemon: simple
50     plugs:
51       - firewall-control
52       - mount-observe
53       - network-control
54       - network-bind
55
56   collect-bug-info:
57     command: bin/collect-bug-info.sh
58   shell:
59     command: bin/anbox-shell.sh
60   android-settings:
61     command: desktop-launch $SNAP/bin/app-android-settings.sh
62     desktop: desktop/android-settings.desktop
63     slots:
64       - dbus-session-slot
65     plugs:
66       - dbus-session-plug
67       - x11
68       - unity7
69       - network
70       - opengl
71       - wayland
72       - pulseaudio
73       - home
74       - process-control
75       - desktop
76
77   appmgr:
78     command: desktop-launch $SNAP/bin/app-appmgr.sh
79     desktop: desktop/appmgr.desktop
80     slots:
81       - dbus-session-slot
82     plugs:
83       - dbus-session-plug
84       - x11
85       - unity7
86       - network
87       - opengl
88       - wayland
89       - pulseaudio
90       - home
91       - process-control
92       - desktop
93
94 parts:
95   android:
96     plugin: dump
97     # This needs to be any directory but not the root one as if we use
98     # it we get superious permissions errors with the copied .git tree
99     source: data
100     build-packages:
101       - wget
102     override-build: |
103       LOCAL_IMAGE=$SNAPCRAFT_PART_INSTALL/../../../android-images/android.img
104
105       if [ -f $LOCAL_IMAGE ]; then
106
107         echo "Using local image $LOCAL_IMAGE"
108         cp $LOCAL_IMAGE $SNAPCRAFT_PART_INSTALL/android.img
109
110       else
111
112         IMAGE_PATH=
113         IMAGE_NAME=
114         ARCH=$(uname -m)
115
116         case "$ARCH" in
117           x86_64)
118             IMAGE_PATH="2018/07/19"
119             IMAGE_NAME="android_amd64.img"
120             IMAGE_HASH="6b04cd33d157814deaf92dccf8a23da4dc00b05ca6ce982a03830381896a8cca"
121             ;;
122           *)
123             echo "ERROR: Unknown architecture $ARCH"
124             exit 1
125             ;;
126         esac
127
128         # FIXME: downloading with a source: field doesn't work as snapcraft
129         # expects the downloaded file to be an archive it can extract.
130         echo "Downloading image..."
131         wget http://build.anbox.io/android-images/$IMAGE_PATH/$IMAGE_NAME
132
133         echo "$IMAGE_HASH $IMAGE_NAME" > image-hash
134         sha256sum -c image-hash || exit 1
135
136         mv $IMAGE_NAME $SNAPCRAFT_PART_INSTALL/android.img
137
138       fi
139     prime:
140       - android.img
141
142   apparmor:
143     plugin: nil
144     stage-packages:
145       - apparmor
146
147   zip:
148     plugin: nil
149     stage-packages:
150       - zip
151     prime:
152       - usr/bin/zip
153
154   lxc:
155     source: https://github.com/lxc/lxc
156     source-type: git
157     source-tag: lxc-3.0.1
158     build-packages:
159       - libapparmor-dev
160       - libcap-dev
161       - libgnutls28-dev
162       - libseccomp-dev
163       - pkg-config
164     plugin: autotools
165     configflags:
166       - --disable-selinux
167       - --disable-python
168       - --disable-lua
169       - --disable-tests
170       - --disable-examples
171       - --disable-doc
172       - --disable-api-docs
173       - --disable-bash
174       - --disable-cgmanager
175       - --enable-apparmor
176       - --enable-seccomp
177       - --enable-capabilities
178       - --with-rootfs-path=/var/snap/anbox/common/lxc/
179       - --libexecdir=/snap/anbox/current/libexec/
180     override-build: |
181       set -ex
182       git config user.email "buildbot@anbox.io"
183       git config user.name "Anbox Buildbot"
184       git remote add anbox https://github.com/anbox/lxc
185       git fetch anbox
186       # apparmor: don't require a transition for Anbox child profiles
187       git cherry-pick 2f81fb7c91560b32e506bb874f8cd63e37985906
188       set +ex
189       snapcraftctl build
190     organize:
191       snap/anbox/current/libexec: libexec
192     prime:
193       - lib/liblxc.so.1
194       - lib/liblxc.so.1.4.0
195       - libexec/lxc/lxc-monitord
196       - bin/lxc-start
197       - bin/lxc-stop
198       - bin/lxc-info
199       - bin/lxc-attach
200       - bin/lxc-ls
201       - bin/lxc-top
202
203   swiftshader:
204     plugin: cmake
205     source: https://swiftshader.googlesource.com/SwiftShader
206     source-type: git
207     source-commit: b6e8c3f0f4830887d69ba765a922ac3c40e81dd9
208     override-build: |
209       git submodule update --init
210       snapcraftctl build
211     artifacts:
212       - libEGL.so
213       - libGLES_CM.so
214       - libGLESv2.so
215     organize:
216       libEGL.so: lib/anbox/swiftshader/libEGL.so
217       libGLES_CM.so: lib/anbox/swiftshader/libGLES_CM.so
218       libGLESv2.so: lib/anbox/swiftshader/libGLESv2.so
219
220   anbox-scripts:
221     plugin: dump
222     source: scripts
223     organize:
224       snap-wrapper.sh: bin/anbox-wrapper.sh
225       container-manager.sh: bin/container-manager.sh
226       anbox-bridge.sh: bin/anbox-bridge.sh
227       collect-bug-info.sh: bin/collect-bug-info.sh
228       app-android-settings.sh: bin/app-android-settings.sh
229       app-appmgr.sh: bin/app-appmgr.sh
230       anbox-shell.sh: bin/anbox-shell.sh
231     prime:
232       - bin/anbox-bridge.sh
233       - bin/anbox-shell.sh
234       - bin/anbox-wrapper.sh
235       - bin/container-manager.sh
236       - bin/collect-bug-info.sh
237       - bin/app-*.sh
238
239   anbox-data:
240     plugin: dump
241     source: data
242     prime:
243       - glvnd
244       - desktop
245       - apparmor
246       - seccomp
247
248   anbox:
249     plugin: cmake
250     after:
251       - lxc
252       - desktop-glib-only
253     source: .
254     configflags:
255       # FIXME: Anbox currently has some paths with hard coded prefixes. Once
256       # that is fixed we can avoid using a prefix here.
257       - -DCMAKE_INSTALL_PREFIX:PATH=/usr
258       - -DANBOX_VERSION=$SNAPCRAFT_PROJECT_VERSION
259       - -DBINDERFS_PATH=/var/snap/anbox/common/binderfs
260       # FIXME: Once we have everything in place for full snap confinement we
261       # can securely enable this.
262       # - -DSNAP_CONFINEMENT=ON
263     build-packages:
264       - build-essential
265       - cmake
266       - cmake-data
267       - cmake-extras
268       - debhelper
269       - dbus
270       - google-mock
271       - libboost-dev
272       - libboost-filesystem-dev
273       - libboost-log-dev
274       - libboost-iostreams-dev
275       - libboost-program-options-dev
276       - libboost-system-dev
277       - libboost-test-dev
278       - libboost-thread-dev
279       - libcap-dev
280       - libdbus-1-dev
281       - libegl1-mesa-dev
282       - libgles2-mesa-dev
283       - libglm-dev
284       - libgtest-dev
285       - libprotobuf-dev
286       - libproperties-cpp-dev
287       - libsdl2-dev
288       - libsdl2-image-dev
289       - libsystemd-dev
290       - pkg-config
291       - protobuf-compiler
292     stage-packages:
293       - libboost-log1.58.0
294       - libboost-iostreams1.58.0
295       - libboost-program-options1.58.0
296       - libboost-thread1.58.0
297       - libdb5.3
298       - libegl1-mesa
299       - libgles2-mesa
300       - libgl1-mesa-glx
301       - libsdl2-2.0-0
302       - libsdl2-gfx-1.0-0
303       - libsdl2-image-2.0-0
304       - libsystemd0
305     prime:
306       - usr/bin/anbox
307       - usr/share/anbox
308       - usr/lib/*-linux-*/