Krang Build System Design

The Krang build system is responsible for compiling Krang from source into a form suitable for distribution and installation. This document describes the design of the build system.

Background

Krang's first releases included binaries built for Redhat 7.3 on the i686 platform. Binaries for all CPAN XS modules as well as Apache/mod_perl are included in the distribution tar-ball. The installation system (krang_install) simply copies these binaries into place, sets up the database and configures Krang using information provided by the user. This system works very well, provided you're running Redhat 7.3 or a compatible system.

The goal of the build system is to produce pre-compiled packages for a variety of platforms which will be installable via krang_install the same way the original Redhat 7.3 package works. After this work is complete future development may produce native packages (RPM, DEB, etc.) as an alternative to krang_install.

Krang currently includes facilities for installing Perl and MySQL which will not be provided by the build system envisioned here. This system will expect the target environment to include suitable versions of Perl and MySQL prior to installation.

Design Considerations

The following factors are important to the success of the build system.

Architecture

Naming Conventions

Krang distributions are created to work on a specific platform with a specific version of Perl. For example, typical distribution filenames might be:

  krang-1.101-Redhat7.3-perl5.6.1-i686-linux.tar.gz
  krang-1.101-Redhat9-perl5.8.2-i686-linux.tar.gz

The build system will supply the distribution name (Redhat9, Redhat7.3, etc) and Perl will provide the Perl version and architecture using:

  perl -MConfig -e 'printf "perl%d.%d.%d-%s",
                    (map { ord($_) } split("", $^V, 3)), $Config{archname}'

End-users must choose the distribution that matches their platform, although krang_install will check to make sure they made the right reasonable choice.

A special source distribution is made without building platform binaries. Users of this distribution will need to use the Krang build system to produce a distribution they can install. The source distribution will be named:

  krang-1.101-src.tar.gz

Platform Files

Each supported platform must have a directory in the platforms/ directory inside Krang. This directory will contain at least one module, Platform.pm, which is a sub-classes of Krang::Platform. This module may actually be a sub-class of another platform's module: ex. the platform module for Redhat9 could be based on the module for Redhat7.3.

A README file may also be present which will be copied as ``README.$Platform'' into compiled distributions.

Implementation

krang_build

To generate a build for a platform, the krang_build script will be run with a single argument:

  krang_build Redhat7.3

This will cause the build system to use the Platform.pm module in platform/Redhat7.3. If all goes well the final line of output should be something like:

   Build finished, created krang-1.101-Redhat7.3-perl5.6.1-i686-linux.tar.gz

The build a distribution using a different version Perl, just run krang_build using the desired perl:

   perl5.8.3 krang_build Redhat7.3

In general, building a distribution for a platform will only work on the platform itself. Automation using VMWare and Tinderbox may reduce the work associated with building and testing on each platform.

Krang::Platform

The Krang::Platform module will serve as a base-class for all platform modules. The following methods will be available for overriding in sub-classes. See the module documentation in Krang::Platform for authoritative details.

Questions