App-Build
view release on metacpan or search on metacpan
lib/App/Build.pm view on Meta::CPAN
"./Build install" is invoked.
=cut
sub ACTION_install {
my ($self) = @_;
require ExtUtils::Install;
$self->depends_on('build');
my $map = $self->install_map;
ExtUtils::Install::install($map, 1, 0, $self->{args}{uninst}||0);
$self->perllocal_install();
$self->configure();
}
=head2 perllocal_install()
This method should be modelled after ExtUtils::Command::MM::perllocal_install
so that it writes the same information at MakeMaker does.
It currently is a stub, waiting to be implemented
=cut
sub perllocal_install {
my ($self) = @_;
# Not yet implemented.
}
=head2 configure()
Do nothing. This method is a hook that can be overridden by a
subclass of App::Build.
The idea is that after installing files, you might need to run additional
code to configure the application.
=cut
sub configure {
my ($self) = @_;
# Do nothing. This is a hook for overriding in a subclass.
}
=head2 mirror()
* Signature: $build->mirror($url, $file);
* Param: $url string
* Param: $file string
TODO: Should be rewritten to use cross-platform, pure-perl.
=cut
sub mirror {
my ($self, $url, $file) = @_;
if (! -f $file) {
$self->log_info("Mirroring $url to $file\n");
require File::Fetch;
my $ff = File::Fetch->new(uri => $url);
my $where = $ff->fetch(to => File::Basename::dirname($file));
if($where) {
rename($where, $file);
}
}
else {
$self->log_info("Mirrored file $file up to date\n");
}
}
=head2 unpack()
* Signature: $build->unpack($archive_file, $directory, $subdir);
* Param: $archive_file string
* Param: $directory string
* Param: $subdir string
TODO: Should be rewritten to use cross-platform, pure-perl.
=cut
sub unpack {
my ($self, $archive_file, $directory, $subdir) = @_;
require Archive::Extract;
$directory ||= "$App::options{install_prefix}/src";
mkdir($directory) if (! -d $directory);
die "Directory $directory does not exist and can't be created" if (! -d $directory);
if (! File::Spec->file_name_is_absolute($archive_file)) {
$archive_file = File::Spec->catfile(Cwd::getcwd(), $archive_file);
}
$subdir = File::Spec->catdir($directory, $subdir);
if ($subdir && -d $subdir) {
$self->log_info("Removing preexisting directory $subdir ...\n");
File::Path::rmtree($subdir);
}
$self->log_info("Unpacking $archive_file ...\n");
my $ae = Archive::Extract->new(archive => $archive_file);
my $ok = $ae->extract(to => $directory) or die $ae->error;
die "Subdirectory $subdir not created" if (! -d $subdir);
}
=head1 ACKNOWLEDGEMENTS
* Author: Stephen Adkins <stephen.adkins@officevision.com>
* Maintainer: Mattia Barbon <mbarbon@cpan.org>
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 SOURCES
The latest sources can be found on GitHub at
L<http://github.com/mbarbon/app-build/tree>
=head1 SEE ALSO
=cut
( run in 0.739 second using v1.01-cache-2.11-cpan-39bf76dae61 )