Sugar on Gentoo Linux

From OLPC
Revision as of 11:47, 13 January 2009 by Sascha silbe (talk | contribs) (Sugar-jhbuild: remove outdated instructions, only refer to generic page)
Jump to: navigation, search
Developer's Setup
 Fedora
 Ubuntu
 Debian
 Gentoo
 Slackware
Wiki Category
modify 

Introduction

Sugar builds relatively reliably as of 2007-12-13 on Gentoo amd64 boxes using sugar-jhbuild, it is extremely likely that it would build on an x86 box as well. Contact User:Mcfletch if you encounter problems.

Prerequisites

You will need to emerge quite a few pieces of software, with some of the packages being ~x86/~amd64 masked or potentially hard-masked (none are as of 2007-12-13 for AMD64). For packages which are ~x86/~amd64 masked you will need to add them to your /etc/portage/packages.keywords file.

To unmask a hard-masked package, add a line such as the following to your /etc/portage/package.unmask file (note, the following are for example only, they are not needed as of 2007-12-13):

 =dev-libs/libnl-1.0_pre6
 =net-misc/dhcdbd-1.14-r1

To unmask a keyword-masked package, add a line with the full name of the package to your /etc/portage/package.keywords file, which by default adds the appropriate keyword for your architecture (~x86, ~amd64, etc):

 dev-lang/python ~amd64
 dev-python/setuptools ~amd64
 net-misc/networkmanager ~amd64
 dev-libs/libnl ~amd64
 net-misc/dhcdbd ~amd64
 dev-python/dbus-python ~amd64

Note that you can also use the full format (including comparison operator and version) as specified in the package.unmask file above if you want to prevent frequent updating of packages.

You will also likely need to specify USE flags for a number of packages. These are added to the /etc/portage/package.use file in a format like so:

 dev-util/subversion -apache2
 net-dns/avahi dbus python gtk
 x11-base/xorg-server kdrive
 net-wireless/wpa_supplicant -qt4

Python 2.5 is Required

You will need to upgrade your Gentoo installation to Python 2.5, most Gentoo systems as of 2007-12-13 will already be running Python 2.5, but just in case you aren't yet, upgrade and remember to run python-updater!

Emerge the prerequisites

Sugar requires a large number of standard Gentoo packages, you will need to emerge all of them in order to build the package:

 emerge -avDt \
   dev-util/git\
   cvs subversion\
   gtk-doc\
   pygtksourceview\
   avahi\
   expat\
   gstreamer\
   xulrunner\
   pycurl\
   networkmanager\
   gnome-python-desktop\
   dev-python/dbus-python\
   boost\
   darcs\
   fribidi \
   sqlite \
   numpy \
   gst-python \
   gst-plugins-theora \
   vte \
   abiword \
   dev-python/simplejson \
   x11-apps/xcursorgen \
   media-gfx/icon-slicer

You will also likely need to rebuild the x11-base/xorg-server package to build the "nested X servers" module, (particularly the "Xephyr" server which Sugar uses) this is done by specifying "kdrive" USE flag then rebuilding the server:

 emerge -avDt --newuse xorg-server

Lastly, you will need to have the json-py module installed. There is an ebuild available which you can use to produce a proper Gentoo package in an overlay locally. Or you can use layman:

 emerge -avDt layman
 layman -f
 layman -a liquidx
 emerge -avDt json-py

Or you can just unpack the source package manually and copy the json.py file to your PYTHONPATH.

Setup System Services

You will want to ensure that the required services are started at boot time as well. If you want to run sugar without rebooting you will want to start the services using their /etc/init.d/ scripts as well:

 rc-update add avahi-daemon default
 rc-update add NetworkManager default
 rc-update add dbus default
 rc-update add hald default

If you do not have these services running when you attempt to start Sugar you will get access exceptions from dbus as your regular user is not allowed to create these system-wide services.

You will also need to alter you /etc/conf.d/net configuration to specify the use of the NetworkManager compatible dhclient module. This should be the first line in the file:

 modules=("dhclient" "wpa_supplicant")

If you use the default "dhcpcd" module instead your network will connect, then immediately drop off when NetworkManager takes control of it.

NOTE changing your network configuration can easily be messed up, you're a Gentoo user, we're assuming you know how to fix your machine while offline if the network configuration doesn't work! Particularly if you're on a laptop, wpa_supplicant can be a serious pain to configure.

Sugar-jhbuild

Use of Sugar-jhbuild is detailed on building Sugar from sources.

Note that you may need/want to disable building Python in order to prevent conflicts between the jhbuild-based and platform Python. To do this, create/edit the file ~/.olpc.jhbuildrc to add the line:

 skip = ['python']

If you encounter an error during the installation of python-dbus regarding the types module not being importable, it is safe to ignore the error and continue to done. The installation script is trying to compile Python modules, which is not necessary under sugar-jhbuild. See Ticket #5591 for details.

Similarly, if you encounter an error during installation of telepathy-gabble's man-pages due to a permissions error, you can safely "ignore and continue to done", as the man pages are not critical to usage. See Ticket #5592 for details.

Testing Sugar

When using sugar-jhbuild, you can use:

./sugar-jhbuild run

If you want to run Sugar code from the shell/terminal/console:

./sugar-jhbuild shell 

You can start the sugar shell from this environment with:

sugar-emulator