| 1 | package App::cpm::Builder::MB; | ||
| 2 | use v5.24; | ||
| 3 | use warnings; | ||
| 4 | use experimental qw(lexical_subs signatures); | ||
| 5 | |||
| 6 | use parent 'App::cpm::Builder::Base'; | ||
| 7 | |||
| 8 | sub supports ($class, @) { | ||
| 9 | -f 'Build.PL'; | ||
| 10 | } | ||
| 11 | |||
| 12 | sub configure ($self, $ctx, $dependency_libs, $dependency_paths) { | ||
| 13 | my @cmd = ($ctx->{perl}, 'Build.PL'); | ||
| 14 | push @cmd, "--install_base", $self->{install_base} if $self->{use_install_command} && $self->{install_base}; | ||
| 15 | push @cmd, qw(--config installman1dir= --config installsiteman1dir= --config installman3dir= --config installsiteman3dir=) if $self->{need_noman_argv}; | ||
| 16 | push @cmd, '--pureperl-only' if $self->{pureperl_only}; | ||
| 17 | push @cmd, $self->{configure_args}->@* if $self->{configure_args}; | ||
| 18 | $self->run_configure($ctx, \@cmd, $dependency_libs, $dependency_paths) && -f 'Build'; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub build ($self, $ctx, $dependency_libs, $dependency_paths) { | ||
| 22 | my @cmd = ($ctx->{perl}, "./Build"); | ||
| 23 | push @cmd, $self->{build_args}->@* if $self->{build_args}; | ||
| 24 | my $ok = $self->run_build($ctx, \@cmd, $dependency_libs, $dependency_paths); | ||
| 25 | return if !$ok; | ||
| 26 | $self->_prepare_paths_cache; | ||
| 27 | $self->_write_blib_meta($ctx); | ||
| 28 | return 1; | ||
| 29 | } | ||
| 30 | |||
| 31 | sub test ($self, $ctx, $dependency_libs, $dependency_paths) { | ||
| 32 | my @cmd = ($ctx->{perl}, "./Build", "test"); | ||
| 33 | push @cmd, $self->{test_args}->@* if $self->{test_args}; | ||
| 34 | $self->run_test($ctx, \@cmd, $dependency_libs, $dependency_paths); | ||
| 35 | } | ||
| 36 | |||
| 37 | sub install ($self, $ctx, $dependency_libs = [], $dependency_paths = []) { | ||
| 38 | return $self->SUPER::install($ctx, $dependency_libs, $dependency_paths) if !$self->{use_install_command}; | ||
| 39 | my @cmd = ($ctx->{perl}, "./Build", "install"); | ||
| 40 | push @cmd, $self->{install_args}->@* if $self->{install_args}; | ||
| 41 | my $ok = $self->run_install($ctx, \@cmd, $dependency_libs, $dependency_paths); | ||
| 42 | return if !$ok; | ||
| 43 | $self->_install_blib_meta($ctx); | ||
| 44 | return 1; | ||
| 45 | } | ||
| 46 | |||
| 47 | sub needs_install_env ($self) { | ||
| 48 | return $self->{use_install_command} ? 1 : 0; | ||
| 49 | } | ||
| 50 | |||
| 51 | 1; |