Alien-Build
view release on metacpan or search on metacpan
lib/Alien/Build/Plugin/PkgConfig/PP.pm view on Meta::CPAN
my $atleast_version = $self->atleast_version;
$atleast_version = $self->minimum_version unless defined $atleast_version;
if(defined $atleast_version)
{
my $need = PkgConfig::Version->new($atleast_version);
if($version < $need)
{
die "package @{[ $pkg_name ]} is @{[ $pkg->pkg_version ]}, but at least $atleast_version is required.";
}
}
if(defined $self->exact_version)
{
my $need = PkgConfig::Version->new($self->exact_version);
if($version != $need)
{
die "package @{[ $pkg_name ]} is @{[ $pkg->pkg_version ]}, but exactly @{[ $self->exact_version ]} is required.";
}
}
if(defined $self->max_version)
{
my $need = PkgConfig::Version->new($self->max_version);
if($version > $need)
{
die "package @{[ $pkg_name ]} is @{[ $pkg->pkg_version ]}, but max of @{[ $self->max_version ]} is required.";
}
}
foreach my $alt (@alt_names)
{
my $pkg = PkgConfig->find($alt);
die "package $alt not found" if $pkg->errmsg;
}
'system';
},
);
$meta->register_hook(
$_ => sub {
my($build) = @_;
return if $build->hook_prop->{name} eq 'gather_system'
&& ($build->install_prop->{system_probe_instance_id} || '') ne $self->instance_id;
require PkgConfig;
foreach my $name ($pkg_name, @alt_names)
{
require PkgConfig;
my $pkg = PkgConfig->find($name, search_path => [@PKG_CONFIG_PATH]);
if($pkg->errmsg)
{
$build->log("Trying to load the pkg-config information from the source code build");
$build->log("of your package failed");
$build->log("You are currently using the pure-perl implementation of pkg-config");
$build->log("(AB Plugin is named PkgConfig::PP, which uses PkgConfig.pm");
$build->log("It may work better with the real pkg-config.");
$build->log("Try installing your OS' version of pkg-config or unset ALIEN_BUILD_PKG_CONFIG");
die "second load of PkgConfig.pm @{[ $name ]} failed: @{[ $pkg->errmsg ]}"
}
my %prop;
$prop{cflags} = _cleanup scalar $pkg->get_cflags;
$prop{libs} = _cleanup scalar $pkg->get_ldflags;
$prop{version} = $pkg->pkg_version;
$pkg = PkgConfig->find($name, static => 1, search_path => [@PKG_CONFIG_PATH]);
$prop{cflags_static} = _cleanup scalar $pkg->get_cflags;
$prop{libs_static} = _cleanup scalar $pkg->get_ldflags;
$build->runtime_prop->{alt}->{$name} = \%prop;
}
foreach my $key (keys %{ $build->runtime_prop->{alt}->{$pkg_name} })
{
$build->runtime_prop->{$key} = $build->runtime_prop->{alt}->{$pkg_name}->{$key};
}
if(keys %{ $build->runtime_prop->{alt} } == 1)
{
delete $build->runtime_prop->{alt};
}
}
) for qw( gather_system gather_share );
$self;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Alien::Build::Plugin::PkgConfig::PP - Probe system and determine library or tool properties using PkgConfig.pm
=head1 VERSION
version 2.84
=head1 SYNOPSIS
use alienfile;
plugin 'PkgConfig::PP' => (
pkg_name => 'libfoo',
);
=head1 DESCRIPTION
Note: in most case you will want to use L<Alien::Build::Plugin::PkgConfig::Negotiate>
instead. It picks the appropriate fetch plugin based on your platform and environment.
In some cases you may need to use this plugin directly instead.
This plugin provides Probe and Gather steps for pkg-config based packages. It uses
L<PkgConfig> to accomplish this task.
=head1 PROPERTIES
=head2 pkg_name
( run in 0.612 second using v1.01-cache-2.11-cpan-39bf76dae61 )