Krang::Platform - base class for platform build modules
package Redhat9::Platform; use base 'Krang::Platform';
This module serves as a base class for the platform build modules which build help Krang binary distributions. See docs/build_tech_spec.pod for details about how the build system works.
This module is meant to be used as a base class, so the interface consists of methods which may be overridden. All these methods have a reasonable default behavior.
All methods are called as class methods. Platform modules are free to use package variables to hold information between calls.
verify_dependencies(mode = $mode)>
Makes sure all required dependencies are in place before starting the
build, and before beginning installation. The mode parameter will
be either ``build'' or ``install'' depending on when the method is called.
This method should either succeed or die() with a message for the
user.
By default, shared object (.so) files are searched for in $Config{libpth}. header files (.h) are search for in $Config{usrinc}, /include and /usr/local/include
The default implementation runs the following default checks (which are all overrideable):
check_perl()
Starting with V3, Krang can be used completely with UTF-8 so we need to make sure that the Perl we are using has PerlIO enabled.
We also verify that Perl is the right version and compiled for the right architecture (skipped in build mode).
check_mysql()
The mysql shell is available and MySQL is v4.0.13 or higher.
check_libperl(lib_files => \@libs, includes => \@incs, mode => $mode)
Checks to see that the Perl libraries are installed. The default implementation looks in the standard locations plus $Config{archlib} for libperl.so or libperl.a
check_libmysqlclient(lib_files => \@libs, includes => \@incs, mode => $mode)
Checks to see that the Perl libraries are installed. The default implementation looks in $Config{libpath} for libmysqlclient.so or libmysqlclient.a
check_expat(lib_files => \@libs, includes => \@incs, mode => $mode)
Checks to see that the Expat library is installed.
check_libjpeg(lib_files => \@libs, includes => \@incs, mode => $mode)
Checks for the existance of the libjpeg shared object and header files. Header files are not needed for install.
check_libgif(lib_files => \@libs, includes => \@incs, mode => $mode)
Checks for the existance of the libgif or libungif shared object and header files. Header files are not needed for install.
check_libpng(lib_files => \@libs, includes => \@incs, mode => $mode)
Checks for the existance of the libpng shared object and header files. Header files are not needed for install.
$bin = find_bin(bin => $bin_name)
If $ENV{PATH} exists, searches $ENV{PATH} for $bin_name, returning the full path to the desired executable.
If $ENV{PATH} does not contain /sbin or /usr/sbin, it will search those as well.
will die() with error if it cannot find the desired executable.
check_ip(ip => $ip)
Called by the installation system to check whether an IP address is correct for the machine. The default implementation runs /sbin/ifconfig and tries to parse the resulting text for IP addresses. Should return 1 if the IP address is ok, 0 otherwise.
$gid = create_krang_group(options => \%options)
Called to create a Krang Group, as specified by the command-line argument to bin/krang_install (--KrangGroup). Takes the %options hash built by krang_install as the one argument.
The default version of this sub works for GNU/Linux. Other platforms (e.g. BSD-like) will need to override this method to work with their platforms' requirements for user creation.
The sub will check to see if --KrangGroup exists, and create it if it does not. It will return the group ID (gid) in either case.
This sub will die with an error if it cannot create --KrangGroup.
$uid = create_krang_user(group_id => $gid, options => \%options)
Called to create a Krang User, as specified by the command-line argument to bin/krang_install (--KrangUser). Takes the %options hash built by krang_install as the one argument.
The default version of this sub works for GNU/Linux. Other platforms (e.g. BSD-like) will need to override this method to work with their platforms' requirements for user creation.
The sub will check to see if --KrangUser exists, and create it if it does not. If the user is created, the default group will be --KrangGroup. If the user already exists, it will be made a member of the --KrangGroup group.
The sub will return the user ID (uid) if successful.
This sub will die with an error if it cannot create --KrangUser.
krang_usermod(options => \%options)
Called when --KrangUser is not a member of --KrangGroup. This sub adds --KrangUser to --KrangGroup.
The default version of this sub works for GNU/Linux. Other platforms (e.g. BSD-like) will need to override this method to work with their platforms' requirements for user creation.
This sub will die with an error if it cannot make --KrangUser a member of --KrangGroup.
build_perl_module(name => $name)
Called to build a specific Perl module distribution called $name in
the current directory. The result of calling this method should be
one or more compiled Perl modules in Krang's lib/ directory.
The default implementation includes code to answer questions asked by some of the modules (using Expect) and special build procedures for others.
The optional 'dest_dir' parameter specifies the location to put the results of the build. The default is KRANG_ROOT/lib.
build_mm(mm_dir => $mm_dir, mm_bin => $mm_bin)
Called to build OSSP mm for shared memory allocation in Apache.
build_mm(build_dir => $dir, mod_ssl_dir => $dir, apache_dir => $dir)
Called to build mod_ssl to patch Apache.
build_apache_modperl(apache_dir => $dir, modperl_dir => $dir)
Called to build Apache and mod_perl in their respective locations.
Uses apache_build_parameters() and modperl_build_parameters()
which may be easier to override. The result should be a working
Apache installation in apache/.
apache_build_parameters(apache_dir => $dir, modperl_dir => $dir)
Returns a string containing the parameters passed to Apache's
configure script by build_apache_modperl().
mod_perl_build_parameters(apache_dir = $dir, modperl_dir => $dir)>
Returns a string containing the parameters passed to mod_perl's
Makefile.PL script by build_apache_modperl().
finish_installation(options = \%options)>
Anything that needs to be done at the end of installation can be done
here. The default implementation does nothing. The options hash
contains all the options passed to krang_install (ex: InstallPath).
finish_upgrade()
Anything that needs to be done at the end of an upgrade can be done here. The default implementation does nothing.
post_install_message(options => \%options)
Called by bin/krang_install, returns install information once everything is complete.
post_upgrade_message(options = \%options)>
Called by bin/krang_upgrade, returns upgrade information once everything is complete.
guess_platform()
Called to guess whether this module should handle building on this
platform. This is used by krang_build when the user doesn't
specify a platform. This method should return true if the module
wants to handle the platform.
The default implementation returns false all the time. When implementing this module, err on the side of caution since the user can always specify their platform explicitely.
build_params()
Reads the data/build.db file produced by krang_build and returns
a hash of the values available (Platform, Perl, Arch, SSL).