Alien-Build
view release on metacpan or search on metacpan
lib/alienfile.pm view on Meta::CPAN
=head1 SYNOPSIS
Do-it-yourself approach:
use alienfile;
probe [ 'pkg-config --exists libarchive' ];
share {
start_url 'http://libarchive.org/downloads/libarchive-3.2.2.tar.gz';
# the first one which succeeds will be used
download [ 'wget %{.meta.start_url}' ];
download [ 'curl -o %{.meta.start_url}' ];
extract [ 'tar xf %{.install.download}' ];
build [
# Note: will not work on Windows, better to use Build::Autoconf plugin
# if you need windows support
'./configure --prefix=%{.install.prefix} --disable-shared',
'%{make}',
'%{make} install',
];
}
gather [
[ 'pkg-config', '--modversion', 'libarchive', \'%{.runtime.version}' ],
[ 'pkg-config', '--cflags', 'libarchive', \'%{.runtime.cflags}' ],
[ 'pkg-config', '--libs', 'libarchive', \'%{.runtime.libs}' ],
];
With plugins (better):
use alienfile;
plugin 'PkgConfig' => 'libarchive';
share {
start_url 'http://libarchive.org/downloads/';
plugin Download => (
filter => qr/^libarchive-.*\.tar\.gz$/,
version => qr/([0-9\.]+)/,
);
plugin Extract => 'tar.gz';
plugin 'Build::Autoconf';
plugin 'Gather::IsolateDynamic';
build [
'%{configure}',
'%{make}',
'%{make} install',
];
};
=head1 DESCRIPTION
An alienfile is a recipe used by L<Alien::Build> to, probe for system libraries or download from the internet, and build source
for those libraries. This document acts as reference for the alienfile system, but if you are starting out writing your own Alien
you should read L<Alien::Build::Manual::AlienAuthor>, which will teach you how to write your own complete Alien using alienfile +
L<Alien::Build> + L<ExtUtils::MakeMaker>. Special attention should be taken to the section "a note about dynamic vs. static
libraries".
=head1 DIRECTIVES
=head2 requires
"any" requirement (either share or system):
requires $module;
requires $module => $version;
configure time requirement:
configure {
requires $module;
requires $module => $version;
};
system requirement:
sys {
requires $module;
requires $module => $version;
};
share requirement:
share {
requires $module;
requires $module => $version;
};
specifies a requirement. L<Alien::Build> takes advantage of dynamic requirements, so only
modules that are needed for the specific type of install need to be loaded. Here are the
different types of requirements:
=over
=item configure
Configure requirements should already be installed before the alienfile is loaded.
=item any
"Any" requirements are those that are needed either for the probe stage, or in either the
system or share installs.
=item share
Share requirements are those modules needed when downloading and building from source.
=item system
System requirements are those modules needed when the system provides the library or tool.
=back
=head2 plugin
plugin $name => (%args);
( run in 0.592 second using v1.01-cache-2.11-cpan-39bf76dae61 )