PyMaemo/How to build
To build PyMaemo packages from the source, you'll need:
- Maemo 5 SDK
- Rootstraps for X86 and ARMEL targets
- pymaemo-tools and its dependencies (listed on the README file)
The scripts from pymaemo-tools are used to download packages' sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained here, although pymaemo-tools uses a slightly modified of sbdmock - see pymaemo-tools README if you want to know which modifications were made.
The build scripts from pymaemo-tools can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.
 Overview of the build process
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:
- Download phase:
- If the package is originally from Debian or Ubuntu:
- The original source is taken from upstream;
- The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.
- If the package is Maemo-specific:
- The source package is taken from the respective repository in PyMaemo project
- If the package is originally from Debian or Ubuntu:
- Preparation phase:
- If the package is taken from upstream, assemble package
- Verify if dependencies are satisfied
- Build phase:
- Call sbdmock with proper parameters
The base directory for these instructions, refered as $BASE, is /scratchbox/users/<user>/home/<user>/pymaemo, where <user> is your username in Scratchbox. All operations are made outside Scratchbox.
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:
Clone the pymaemo-tools project inside $BASE:
$ git clone git://gitorious.org/pymaemo/pymaemo-tools.git
This will create the directory pymaemo-tools under $BASE.
fremantle-arm.cfg under $BASE/pymaemo-tools/sbdmock, putting the rootstrap path correspondent to each in the following key:
- i386: config_opts['rootstrap'] = "$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz"
- armel: config_opts['rootstrap'] = "$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz"
If you do not use the default
FREMANTLE_X86 target names, you also need to change that on the .cfg files, in the
You'll need the Nokia binaries repository for building some packages, just add the correspondent line to the config_opts['sources.list'] entry of the .cfg files:
deb http://repository.maemo.org/ fremantle/<token> nokia-binaries
As Maemo SDK needs some components from Nokia binaries repository, you probably already have a token in
/etc/apt/sources.list inside Scratchbox. If you don't have a token, though, go to http://tablets-dev.nokia.com/eula/index.php and get one.
For building all the packages for the X86 target, enter $BASE/pymaemo-tools and run:
$ ./build_packages.sh sbdmock:fremantle-i386 packages-fremantle.ini
The same can be done to ARMEL target, just replacing "i386" with "arm". The file
packages_fremantle.ini contains all data necessary for obtaining the sources.
You can build individual packages too, specifying them as parameters. If you want to build only, let's say, pyopenssl and pycurl for the ARMEL target, run:
$ ./build_packages.sh sbdmock:fremantle-arm packages-fremantle.ini pyopenssl,pycurl
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.
There are other options for the build; for more information, run build_packages.sh with no parameters or refer to the README file inside pymaemo-tools.
When the build finishes the resultant Debian packages will be placed at $BASE/pymaemo-tools/workdir/fremantle_<target>/repo, where <target> is i386 or armel,and the build logs placed in $BASE/pymaemo-tools/workdir/fremantle_<target>/logs. From that point on, they can be installed on the targets and the ARMEL ones can be copied to the device to be installed there.
 Directories created
- $BASE/pymaemo-tools/download_cache: all downloaded files are placed here, one directory by package, so you don't have to download everything again at every build. If the sources are updated, though, you will have to erase the corresponding entries on ./download_cache and ./workdir for allow them to be downloaded again and rebuilt.
- $BASE/pymaemo-tools/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.
 Adding your own packages to the build
If you want to add your own package to the build process, you just have to edit one file,
packages-fremantle.ini. Just add an entry at the end of the file depending on how your package is organized.
- If all the files of your package are contained in a single SVN or Git repository, you just have to point to this repository, as the example below for python-conic:
If you're using svn, just change "git_url" to "svn_url" and use the appropriate repository URL.
- If your package has Debian or Ubuntu as upstream and only the packaging is specific for Maemo, you'll have to specify the location of the original .dsc file from upstream. Below is an example for pyclutter:
[pyclutter] dsc_url=http://repository.maemo.org/extras-devel/pool/fremantle/free/source/p/pyclutter/pyclutter_0.8.0-1maemo3.dsc git_url=git://gitorious.org/pymaemo/pyclutter.git
In this example the .dsc file is used to get the .orig.gz and diff.gz from Debian, and the Maemo-specific packaging is taken from the PyMaemo repository. pymaemo-tools will assemble the package prior to build, as explained in the Overview section.
Also, if your package is native (does not have a .orig.gz file), you have to specify this below the repository address. See http://people.debian.org/~mpalmer/debian-mentors_FAQ.html for a discussion about native and non-native packages on Debian. Below is an example of a native package:
[python-support] dsc_url=http://repository.maemo.org/extras-devel/pool/fremantle/free/source/p/python-support/python-support_1.0.4maemo1.dsc git_url=git://gitorious.org/pymaemo/python-support.git native=yes
 Modifying PyMaemo packages
The PyMaemo packages are in Gitorious now, allowing the submission of modifications for any of them via merge requests. An overview of the entire process is listed below:
- Create a clone of the repository at Gitorious for the package you want to modify, and git-clone it;
- Modify the
packages-fremantle.inientry of the package to point to the full path of the repository directory;
- Modify the package and run
build_packages.shto build it;
- Don't forget to erase your package files from $BASE/download_cache, $BASE/workdir and $BASE/workdir/fremantle_<target>/repo before the build;
- Install on Scratchbox and on the device, if possible, and run all available unit tests for the package - needless to say, your modifications must not introduce regressions of any type;
- Add unit tests to assert the funcionality of the new features added, whenever possible;
- When you are satisfied with the results, push your local changes to your Gitorious clone and file a merge request.
If you want to modify a package that lives entirely on the Git repository, you can do anything you want, as all the files are under your control. However, if the package is taken from upstream, the only changes you can make will be located in the packaging - you'll have to use patches to actually modify any upstream file in build time.
 Create a Debian repository with one line
If you want to quickly make a Debian repository for easy installation, run the following command at $BASE/pymaemo-tools/workdir/fremantle_<target>/repo:
$ apt-ftparchive packages . | gzip -9c > Packages.gz
Now you have to expose the packages' path to the Web server and add the repository in the target machine accordingly.
 Tracking build in real time
If you want to accompany the build log of any package in real time, you can just use the tail command in the following log files:
- Prep and setup:
$ tail -F $BASE/workdir/fremantle_<target>/repo/root.log
$ tail -F $BASE/workdir/fremantle_<target>/repo/build.log
- This page was last modified on 23 June 2010, at 12:46.
- This page has been accessed 9,268 times.