Chapter 7. Appendix

Table of Contents

maemo-launcher

About maemo-launcher

maemo-launcher is a tool to decrease the start-up time of GTK+ and thus gtkmm and maemomm applications. It runs as a daemon and initializes as much as possible before your application begins to start. When a new application is started it is forked from the deamon process, so its starts faster because the initialization is already complete.

About boosters

maemo-launcher supports multiple booster modules which are responsible for the initialization of various libraries. By default maemo-launcher only supplies a GTK+ booster but a gtkmm and maemomm booster are available from the maemo extras repository (see the section called “Prebuilt Packages”):

  fakeroot apt-get install maemomm-booster

To use the boosters you must specify them when starting maemo-launcher via the command line like this:

maemo-launcher --send-app-died --daemon --booster gtk,gtkmm,maemomm
[Note] Note

Please arrange the list so that underlying libraries are positioned first and derived libraries afterwards. For instance, the normal order would be gtk, gtkmm, maemomm.

If you are using the maemo SDK you may change the option in /etc/init.d/maemo-launcher to look like:

DAEMON_BASE_OPTS="--daemon --send-app-died --booster gtk,gtkmm,maemomm"

so that extra boosters are started automatically when the Maemo desktop is started via:

af-sb-init start

Preparing an application to run with maemo-launcher

As maemo-launcher tries to load the application using dlopen it must be linked with the -shared and -rdynamic flags. If you are using automake then you can add the following to your Makefile.am (replacing program with the actual name):

program_CFLAGS = -shared
program_LDFLAGS = -shared -rdynamic
[Note] Note

However, when you build your application with these options you will no longer be able to run it standalone.

To run the maemo-launcher enabled application, use maemo-invoker, like this:

maemo-invoker full/path/to/your/application

Your debian package should install your application executable as progname.launch and install a shell script progname which calls maemo-invoker. This script could look like this:

#! /bin/sh
exec maemo-invoker /usr/bin/progname.launch "$@"

Build debian packages with launcher support

These three code snippets could be interesting if you want to build debian packages. Add them to the appropriate section in the debian/rules file. The first snippet belongs in the global section.:

ifeq "$(strip $(LAUNCHER))" "yes"
        LAUNCHER_DEPENDS = -Vlauncher:Depends="maemo-launcher"
        LAUNCHER_CFLAGS = -shared
        LAUNCHER_LDFLAGS = -pie -shared -export-dynamic
endif

build:

        (...)
        # commands to compile the package.
        $(MAKE) \
         MAEMO_LAUNCHER_CFLAGS="$(LAUNCHER_CFLAGS)" \
         MAEMO_LAUNCHER_LDFLAGS="$(LAUNCHER_LDFLAGS)"
        touch build-stamp

install:

        (...)
ifeq "$(strip $(LAUNCHER))" "yes"
        mv $(CURDIR)/debian/tmp/usr/bin/progname \
        $(CURDIR)/debian/progname/usr/bin/progname.launch
        ln -s /usr/bin/maemo-invoker \
        $(CURDIR)/debian/progname/usr/bin/progname
endif

To build with launcher support, supply LAUNCHER=yes to the dpkg-buildpackage command line.