wiki:Developing your own applications

Version 84 (modified by Ben, 7 years ago) (diff)


Developing your own applications

This guide is aimed at the complete beginner who would like to know how to develop their own applications for SHR. Taking the usual Hello World program as an example, it will use Vala as the programming language which should be familiar to Java developers.

It is assumed that the reader has already successfully built SHR using the instructions at Building SHR.

1. Creating a source folder

$ cd /path/to/shr/build
$ mkdir myfirstapp
$ cd myfirstapp

2. Writing Hello World in Vala

Create and enter a sub folder for the source:

$ mkdir src
$ cd src

Create a file called myfirstapp.vala and insert the following text:

class Demo.HelloWorld : GLib.Object
    public static int main(string[] args)
        stdout.printf("Hello, World\n");
        return 0;

More information about Vala can be found here:

3. Setting up autotools

Create a file called and insert the following text:

bin_PROGRAMS = myfirstapp


AM_VALAFLAGS = --pkg "gio-2.0" --pkg "glib-2.0"

myfirstapp_SOURCES = myfirstapp.vala
myfirstapp_LDADD = $(INTI_LIBS)

myfirstapp_LDFLAGS = $(AM_LIBS)

	rm -f *.c *.o *.stamp

Go back to the previous folder:

$ cd ..

Create another file called and insert the following text:


Create a file called and insert the following text:



PKG_CHECK_MODULES([DEPS], [glib-2.0 gio-2.0])

AC_OUTPUT([Makefile src/Makefile])

Run the following commands:

$ aclocal
$ autoconf
$ automake --add-missing

4. Adding a bitbake recipe

Enter the third party recipes folder:

$ cd /path/to/shr/build/shr-unstable/openembedded/recipes/openmoko-3rdparty

Create a file called and insert the following text:

DESCRIPTION = "A hello world program written in Vala"
PR = "r0"

S = "${WORKDIR}/myfirstapp"

SRC_URI = "file:///path/to/shr/build/myfirstapp"

inherit autotools vala

Note: For building from local sources you can also use "inherit srctree" as it's used in conf/local-builds.conf

5. Building a package

$ cd /path/to/shr/build/shr-unstable
$ . setup-env
$ bitbake myfirstapp

You should find that you now have an ipk package like this: /path/to/shr/build/shr-unstable/tmp/deploy/ipk/armv4t/myfirstapp_0.1-r0.6_armv4t.ipk

In order to test your program, simply install this package on your phone and run "/usr/bin/myfirstapp".

Graphical User Interface

Once you have successfully completed the steps above, you may wish to know how to add a Graphical User Interface (GUI). The next steps will show how to adapt the Hello World program to use the Elementary widget set.