Alien::Base::ModuleBuild::API - API Reference for Alien:: Authors
A list of extra properties and methods provided by Alien::Base::ModuleBuild beyond those contained in Module::Build::API. Note that all property and method names are prefixed with
alien_ to prevent future collisions Module::Build builtins.
Alien::Base::ModuleBuild adds several parameters to the new constructor in Module::Build. Unless otherwise specified all of the parameters listed in Module::Build::API are available and behave identically to the description contained therein.
The name of the primary library which will be provided. This should be in the form to be passed to
pkg-config. This name is available in the command interpolation as
The name of the temporary folder which will house the library when it is downloaded and built. This folder will always be removed by the
clean action. The default name is
The name of the folder which will both serve as the "install" directory (i.e. <--prefix>) for
make install as well as a share directory via Module::Build's
dist_dir parameter. This directory is added in a smart manner which attempts not to interfere with other author-defined
share_dirs. The default name is
[not yet implemented]
This is intended to choose the mechanism for selecting one file from many. The default name is
An arrayref of commands used to build the library and install it to the directory specified in
alien_share_dir. Each command is first passed through the command interpolation engine, so those variables may be used. The default is tailored to the Gnu toolchain, i.e. AutoConf and Make; it is
[ '%pconfigure --prefix=%s', 'make', 'make install' ].
A command to run to check the version of the library installed on the system. The default is
pkg-config --modversion %n.
These parameters, if specified, augment the information found by pkg-config. If no package config data is found, these are used to generate the necessary information. In that case, if these are not specified, they are attempted to be created from found shared-object files and header files. They both are empty by default.
A hashref or arrayref of hashrefs defining the repositories used to find and fetch library tarballs (or zipballs etc.). These attributes are used to create
Alien::Base::ModuleBuild::Repository objects (or more likely, subclasses thereof). Which class is created is governed by the
protocol attribute and the
alien_repository_class property below. Available attributes are:
local. The first two are obvious,
local allows packaging a tarball with the Alien:: module.
Defines the protocol handler class. Defaults to 'Net::FTP' or 'HTTP::Tiny' as appropriate.
This is either the root server address for the FTP and HTTP classes (i.e.
This key is protocol specific. For FTP this contains the name of the folder to search. For HTTP this is the page to be searched for links; this is specified as a path relative to the
host. For a local file, this specifies the folder containing the tarball relative to the
This is a
qr regex matching acceptable files found in the
location. If the pattern contains a capture group, the captured string is interpreted as the version number. N.B. if no versions are found, the files are sorted by filename using version semantics, this mechanism is not likely to be as accurate as specifying a capture group.
This attribute is a string telling the repository validator which platform the repository serves. This may be the string
src (the default) for platform-independent source files, or a string which matches the Module::Build method
os_type (e.g. "Windows", "Unix", "MacOS", "VMS").
This property is a shortcut for specifying multiple repositories with similar attributes. If a repository attribute is not defined in its
alien_repository hashref, but that attribute is defined here, then this value will be used. This hashref is empty by default.
As the repositories in
alien_repository are converted to objects, this hash controls the type of object that is created. The keys are the relevant protocol. This allows for easy subclassing any or all protocol classes. The defaults are as follows.
http => 'Alien::Base::ModuleBuild::Repository::HTTP', ftp => 'Alien::Base::ModuleBuild::Repository::FTP', local => 'Alien::Base::ModuleBuild::Repository::Local', default => 'Alien::Base::ModuleBuild::Repository',
Unlike most Module::Build parameters, authors may specify only those keys which are to be overridden. If any of the above keys are not specified, the above defaults will be used.
A few global variables are used to set gross behavior. For each pair of variables, if both are set, the environment variable takes precedence.
Setting the either to a true value will output a little more info from within the module itself, plus is will not suppress the messages from the library-build phase (i.e. make etc.).
Setting either to a true value will cause the builder to ignore a system-wide installation and build a local version of the library.
The Alien::Base system needs to store some data to be used in other phases of the build and eventual use. This is done via the mechanism provided by Module::Build::ConfigData. During the build-phase this information is mutable and is available through the
Module::Build::config_data method. As the build-phase ends the data is serialized and stored as
Alien::MyModule::ConfigData (assuming you are authoring
Alien::MyModule). Then during the use-phase, the
Alien::MyModule::ConfigData::config method (via the
Alien::MyModule::config wrapper) is used to query the information. This data is not strictly immutable, but it changing it involves file permissions and is best left alone.
Config keys of interest are:
Holder for the full path to the shared directory specified in
alien_share_dir builder object parameter. This is used to munge the pkg-config data later on.
A hashref of Alien::Base::PkgConfig objects created from .pc files found in
build_share_dir. One extra object (whose key is
_manual is created from the
Remembers if the library was found system-wide (value:
system) or was installed during build (value:
The version number installed or available.
alien_name as needed by pkg-config.
Joel Berger, <firstname.lastname@example.org>
Copyright (C) 2012 by Joel Berger
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.