-
Notifications
You must be signed in to change notification settings - Fork 412
[Android Things] Using a local version of Mraa to build Upm for Android Things
Nicolas Oliver edited this page Oct 6, 2017
·
4 revisions
This wiki is an step-by-step guide on how to modify the default Docker image that builds Upm for Android Things, in order to use a local version of Mraa.
Note: for the example, this wiki will use some specific folders, you should change them to your proper folders to make this work.
The Docker image that builds Android Things has an Mraa repository in it. This Mraa repository is also built for Android Things, so Upm can just use that to build. But if for any reason you need to use a local version of Mraa to build Upm Android Things Packages, you can do:
- Clone the Mraa repository in i.e /home/user/mraa
$ cd /home/user
$ git clone https://github.com/intel-iot-devkit/mraa.git
$ cd mraa
- Build Mraa for Android Things
$ docker-compose run android
# After some time, mraa will be installed in /home/user/mraa/install
$ ls install/
bin include lib share
- Clone the Upm repository in /home/user/upm
$ cd /home/user
$ git clone https://github.com/intel-iot-devkit/upm.git
$ cd upm
- Change docker-compose.yaml, mount your local Mraa repository into the container:
android:
extends: java
image: dnoliver/upm-android
environment:
- BUILDTESTS=OFF
command: bash -c "./scripts/build-android.sh"
volumes:
# Using a global path
- /home/user/mraa:/opt/mraa
# You can also use a relative path
# - ./../mraa:/opt/mraa
- Modify
/home/user/mraa/install/lib/pkgconfig
files to point to mraa install folder inside the container. This is mandatory to allow cmake to find mraa files:
# Go to Mraa repository
$ cd /home/user/mraa
# Modify install/lib/pkgconfig/mraa.pc
$ sudo sed -i 's$/usr/src/app/install$/opt/mraa/install$' install/lib/pkgconfig/mraa.pc
# Modify install/lib/pkgconfig/mraajava.pc
$ sudo sed -i 's$/usr/src/app/install$/opt/mraa/install$' install/lib/pkgconfig/mraajava.pc
# In both files, prefix property should be /opt/mraa/install
# prefix=/opt/mraa/install
- Build Upm for Android Things
$ cd /home/user/upm
$ docker-compose run android
After you did the initial setup, you can keep building new versions of libmraa, and use it to re-build upm modules for Android Things.
This is a short example on how to achieve this:
- Modify a source file in Mraa repository
# Go to Mraa repository folder
$ cd /home/user/mraa
# Modify a file
$ nano CmakeLists.txt
- Execute Step 2, 5 and 6 from the Initial Setup