Documentation/BuildOwnPackage

Build Your Own Package

 hello package is an example of simple package and can be use as a template. debian/rules file in this package is heavily commented to ease learning basics of packaging.

Packaging

OpenInkpot is based on IPlinux, which is in turn based on Debian. This mean all the  Debian packaging rules apply, except the following.

Contents

  • Documentation (README, manpages, info pages, copyrights) is not to be packaged.
  • Packages are built to be small. If several variants of the same package are meaningful, they should be provided as flavours (see the busybox for example).

debian/control changes

  • Build-Dependencies for cross-compilation are placed in the new fields:
    • XCS-Cross-Host-Build-Depends: those are the dependencies for package building tools: autoconf, quilt, etc.
    • XCS-Cross-Build-Depends: those are the dependencies for libraries used by package: libz1-dev etc. The cross-package for apropriate architecture is installed for building.
  • Sections are changed. The following sections are to be used:
    • host/*: packages for build environment:
      • host/tools: various tools to facilitate OpenInkpot builds.
      • host/cross: autogenerated cross-packages for libraries (see the XCS-Cross-Build-Depends).
    • core: everything which is "core" in a sense. All the stuff which is not GUI and does not fall under another section.
    • libdevel: development libraries. Do not appear in "the wild", as such packages are converted to host/cross and original do not get published to the repository.
    • debug: debugging symbols. Also are not published in repository as is, similar to "libdevel".
    • gui: UI packages, including X.org and toolkits
    • media: packages for viewing, managing and creating various media (texts, images, video). Basic tools, such as libpng or awk, belong to core section instead.
  • XCS-Cross-Mode: both field will make buildsystem to build package twice, as host and target one.

debian/rules changes

  • Packages are cross-compiled (dpkg-buildpackage -a$arch).
  • The following DEB_BUILD_OPTIONS are to be recognized by packages, in addition to the ones from Debian policy:
    • target - build package as target one, not as host tool. This option makes it possible to distinguish between builds for host/tools and for target device. E.g. dpkg have to be built in different ways for i386 architecture for host/tools and base components.

Adaptation of existing package

If you adapt the Debian package to OpenInkpot, check the following things:

  • debian/control:
    • Maintainer of OpenInkpot package should be an OpenInkpot developer, not a developer of Debian package OpenInkpot package is based upon. Change the Maintainer field.
    • XCS-VCS-* need to be updated to OpenInkpot URLs or just removed.
    • Sections of packages frequently need to be updated
    • If package obsoletes/conflicts older version or another package which is not in OpenInkpot, such a instructions should be removed as useless.
  • debian/rules:
    • Check for using $(dpkg-buildpackage -qDEB_*) to facilitate cross-compilation. configure need to take --host=$DEB_HOST_GNU_ARCH and --build=$DEB_BUILD_GNU_ARCH arguments.
    • Disable generating and installation of documentation. In case package uses CDBS, add cdbs-embedded to cross-host-build-depends, it will adjust CDBS to not install any documentation.
    • Disable testsuite if it is not working in cross-compilation case.

Building

Use dpkg-buildpackage -a<arch> for building package for the specified target architecture, or plain dpkg-buildpackage for building host package.

Keeping source code in git

Source code for OpenInkpot packages is stored in git repositories.