Alien-Libarchive3
view release on metacpan or search on metacpan
int main(int argc, char *argv[])
{
int r;
archive_read a;
a = archive_read_new();
if(a == NULL)
return 2;
r = archive_read_free(a);
if(r != ARCHIVE_OK)
return 2;
printf("version = '%s'\n", ARCHIVE_VERSION_ONLY_STRING);
return 0;
}
},
);
meta->around_hook('probe' => sub {
my $orig = shift;
my $build = shift;
my $type = $orig->($build, @_);
return $type if $type eq 'share';
find_lib_or_die lib => 'archive', symbol => [
'archive_read_free',
'archive_write_free',
'archive_free',
], libpath => [@lib];
return $type;
});
share {
requires 'Env::ShellWords' => '0.01';
plugin Download => (
url => 'https://libarchive.org',
version => qr/^libarchive-([0-9\.]+)\.tar\.gz$/,
);
plugin Extract => 'tar.gz';
# TODO: lz4 https://github.com/lz4/lz4/releases
# TODO: http://zlib.net/
my @deps;
if(defined $ENV{ALIEN_LIBARCHIVE_DEPS})
{
@deps = split /,/, $ENV{ALIEN_LIBARCHIVE_DEPS};
}
else
{
@deps = qw( Alien::Nettle Alien::xz Alien::LZO Alien::Libbz2 Alien::Libxml2 );
}
plugin 'Build::SearchDep' => (
aliens => \@deps,
);
my $configure_flags = '--with-lzo2';
$configure_flags .= ' --without-iconv' if $^O eq 'darwin';
if($^O eq 'MSWin32')
{
plugin 'Build::Autoconf' => ( ffi => 1 );
build [
"%{configure} --disable-shared --enable-static $configure_flags",
'%{make}',
'%{make} install',
];
ffi {
build [
"%{configure} --enable-shared --disable-static --libdir=%{.install.autoconf_prefix}/dynamic $configure_flags",
'%{make}',
'%{make} install',
];
};
}
else
{
plugin 'Build::Autoconf' => ( ffi => 0 );
build [
"%{configure} --enable-shared --enable-static --enable-bsdtar=static --enable-bsdcpio=static --enable-bsdcat=static $configure_flags",
'%{make}',
'%{make} install',
];
plugin 'Gather::IsolateDynamic';
}
};
if($^O eq 'netbsd')
{
meta->after_hook(
gather_system => sub {
my($build) = @_;
foreach my $flag (qw( libs libs_static))
{
if(defined $build->runtime_prop->{$flag} && $build->runtime_prop->{$flag} =~ m{-L/usr/pkg/lib})
{
$build->runtime_prop->{$flag} = '-Wl,-rpath,/usr/pkg/lib ' . $build->runtime_prop->{$flag};
}
}
},
);
}
( run in 0.346 second using v1.01-cache-2.11-cpan-0068ddc7af1 )