wiki:Developing your own applications

Version 44 (modified by Ben, 3 years ago) (diff)

--

Developing your own applications

disclaimer: this article is not ready yet

Here I will write how to begin developing your own applications for SHR, using the familiar Hello World program as an example. I will use Vala as the programming language which should be familiar and easy to understand for people with Java experience.

This guide assumes that the reader has already succussfully built SHR using the instructions at Building SHR.

1. Creating a source folder

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

2. Writing Hello World in Vala

Create and enter a sub folder for the source:

$ mkdir src
$ cd src

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

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

3. Set up autotools

Go back to the previous folder:

$ cd ..

Create a file called Makefile.am and insert the following text:

SUBDIRS = src

Now go to the source folder once again:

$ cd src

Create another file called Makefile.am and insert the following text:

bin_PROGRAMS = my_first_app

AM_CFLAGS = $(DEPS_CFLAGS)
AM_LIBS = $(DEPS_LIBS) $(DEPS_LIBS)

my_first_app_SOURCES = my_first_app.vala
my_first_app_LDADD = $(INTI_LIBS)

my_first_app_LDFLAGS = $(AM_LIBS)

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

4. Add a bitbake recipe

Create a file called my_first_app.bb and insert the following text:

DESCRIPTION = "A hello world program written in Vala"
SRCREV = "?"
PV = "0.1+svnr${SRCPV}"
PR = "r0"

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

inherit autotools vala

5. Build a package

todo