Documentation/BuildOwnPackage

Build Your Own Package

 hello package is an example of simple package that can be used as a template. The debian/rules file in this package is heavily commented to ease learning the 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) must not be packaged.
  • Packages are built to be small. If several variants of the same package are meaningful, they should be provided as flavours (see busybox for example).

debian/control changes

  • Build-Dependencies for cross-compilation are placed in two new fields:
    • XCS-Cross-Host-Build-Depends: The list of native packages the build machine uses to build the target cross-package, for example, autoconf, quilt, etc.
    • XCS-Cross-Build-Depends: The list of cross-packages the build machine uses to link the target cross-package, for example, libz1-dev etc. The proper cross-package suffix will be added to packages in this list. For example, if you list libz1-dev in your package's XCS-Cross-Build dependencies, dpkg will look for the package libz1-dev-[your target arch]-cross when it builds your package.
  • 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.
    • Adjust build-depends by adding XCS-*-Build-Depends headers (see above)
  • 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.