Alien-LibANN
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
NAME => 'Alien-LibANN',
CONFIGURE_REQUIRES => {
'File::Spec' => 0,
'Archive::Tar' => 0,
'IO::Zlib' => 0,
},
VERSION => $VERSION,
);
print "Everything ready, now type 'make'\n";
sub extract {
my ( $archive, $destination ) = @_;
eval {
require Archive::Tar;
chdir File::Spec->catfile( $CWD, 'src' );
print "Unpacking $archive\n";
Archive::Tar->extract_archive( $archive, 1 );
};
chdir $CWD;
if ($@) {
print STDERR "Failed to extract file $archive\n";
exit 0;
}
}
sub run_configure {
my ( $name, $destination ) = @_;
my $prefix = prompt( "Where would you like to install ${name}?", "/usr/local" );
my $configure_args = '';
$configure_args .= "--prefix=$prefix " if $prefix;
$configure_args .= prompt("Are there any other arguments you would like to pass to configure?");
print "\n$name will be configured with the following arguments:\n", " $configure_args\n";
chdir $destination;
local $ENV{CFLAGS} = $CCFLAGS;
local $ENV{LDFLAGS} = $LDFLAGS;
my @cmd = ( File::Spec->catfile( $destination, "configure" ), split( /\s+/, $configure_args ) );
if ( system(@cmd) != 0 ) {
print <<EOF;
configure $configure_args failed: $!
Something went wrong with the $name configuration.
You should correct it and re-run Makefile.PL.
EOF
chdir $CWD;
exit 0;
}
chdir $CWD;
}
package MY;
sub top_targets {
my $inherited = shift->SUPER::top_targets(@_);
return $inherited unless $install_libann;
$inherited =~ s/^all :: /all :: libANN /;
return $inherited;
}
sub constants {
my $inherited = shift->SUPER::constants(@_);
return $inherited unless $install_libann;
$inherited .= "LIBANN_SRC=$SRC\n";
return $inherited;
}
sub postamble {
my $make_str = '';
return $make_str unless $install_libann;
$make_str = <<'MAKE_FRAG';
libANN:
cd $(LIBANN_SRC) && $(MAKE) all
install::
cd $(LIBANN_SRC) && $(MAKE) install
MAKE_FRAG
return $make_str;
}
( run in 0.481 second using v1.01-cache-2.11-cpan-f52f0507bed )