Alien-Build
view release on metacpan or search on metacpan
example/bzip2.alienfile view on Meta::CPAN
use alienfile;
use Path::Tiny qw( path );
# Because bzip2 does not come with a pkg-config compatible .pc file
# we use the CBuilder plugin to guess the appropriate flags
# (usually just libs=-lbz2):
plugin 'Probe::CBuilder' => (
libs => '-lbz2',
# The version regex here will attempt to parse out the
# bzip2 version number from the output of the test program below.
version => qr/version = '(.*?)[,']/,
# Both the test program and the version regex are optional, but
# if you do not provide them, then you should provide a
# sys { gather } declaration for how to obtain the version number.
# assuming the version number matters.
program => q{
#include <stdio.h>
#include <bzlib.h>
int main(int argc, char *argv[])
{
printf("version = '%s'\n", BZ2_bzlibVersion());
return 0;
}
},
);
# in addition to the library, we require that the bzip2 command
# is also available.
plugin 'Probe::CommandLine' => (
command => 'bzip2',
secondary => 1,
);
share {
# items in the share block relate to building the package
# from source. It is called share because it will be
# installed into a dist level share directory in your
# perl lib.
# The Build::MSYS plugin just makes sure that Alien::MSYS
# is used to provide the necessary tools on Windows. It
# doesn't do anything on other platforms.
plugin 'Build::MSYS';
# The Download negotiator picks the best method for
# downloading the package.
plugin 'Download' => (
url => 'https://sourceforge.net/projects/bzip2/files/latest/download',
);
# The Extract negotiator picks the best method for
# extracting from the tarball. We give it a hint
# here that we expect the tarball to be .gz compressed
# in case it needs to load extra modules to
# decompress.
plugin Extract => 'tar.gz';
# The build stage here is specified as a series of commands.
# bzip2 uses make to build and install. It is vital that we
# include cccdlflags in the compiler flags, because this will
# include any flags necessary for making the library relocatable
( run in 0.366 second using v1.01-cache-2.11-cpan-fa01517f264 )