Mono

From OLPC
Revision as of 05:34, 28 December 2007 by Mk8 (talk | contribs)
Jump to: navigation, search
This article is a stub. You can help the OLPC project by expanding it.

Sugar activities are usually written in Python using the Python Activity API. This page documents how it is possible to use Mono to write a Sugar activity. With Mono, you can use any underlying language like C# or Boo.

Overview

XO Bundle and Mono Bundle

To write an OLPC Mono activity, you need to prepare a .xo Bundle including all required libraries. This is necessary because the Mono runtime is not officially supported by the OS images.

If you use mono, you know that the compiler not traslate the source code to the assembly language, but in IL (Intermediate Language) that need a runtime to be run. Since you don't have the runtime installed on the XO, you need to create a mono bundle so all the runtime is packed in one executable.

To do this you need to have the program already in binary format and use the mkbundle2 utility to create the stand-alone application.

mkbundle2 --config /etc/mono/config --deps --static -o MonkeysMemory.exe monkeysmemory.exe Sugar_0.0.1.dll NDesk.DBus.GLib.dll NDesk.DBus.dll

In this example "monkeysmemory.exe" is the original binary file that use the IL (Intermediate Language), while "MonkeysMemory.exe" is the binary file that can be run without runtime installed.

Normally the use of --static flag have some licence restriction, but here can be use without limitation.

In your bundle you need to put some glue shared library that are used by Mono runtime like this:

  • libgdksharpglue-2.so
  • libgladesharpglue-2.so
  • libglibsharpglue-2.so
  • libgtksharpglue-2.so
  • libMonoPosixHelper.so
  • libpangosharpglue-2.so
  • uiX11Util.so

All this files (except uiX11Util.so) are taken from mono environment. The latest (uiX11Util.so) is specific for OLPC and allow to setup some X11 parameter need to sugar interface. This files are placed in the bin directory of the activity.

How to run a Mono activity

You can find a sample activity written using Mono.

Interface with the native subsystem

Create new application

Sugarize existing application

More documentation will be released as soon as possible.