| 1 | package App::cpm::Builder::EUMM; | ||
| 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 'Makefile.PL'; | ||
| 10 | } | ||
| 11 | |||
| 12 | sub configure ($self, $ctx, $dependency_libs, $dependency_paths) { | ||
| 13 | if (!$ctx->{make}) { | ||
| 14 | $ctx->log("There is Makefile.PL, but you don't have 'make' command; you should install 'make' command first"); | ||
| 15 | return; | ||
| 16 | } | ||
| 17 | my @cmd = ($ctx->{perl}, 'Makefile.PL'); | ||
| 18 | push @cmd, "INSTALL_BASE=$self->{install_base}" if $self->{use_install_command} && $self->{install_base}; | ||
| 19 | push @cmd, qw(INSTALLMAN1DIR=none INSTALLMAN3DIR=none) if $self->{need_noman_argv}; | ||
| 20 | push @cmd, 'PUREPERL_ONLY=1' if $self->{pureperl_only}; | ||
| 21 | push @cmd, $self->{configure_args}->@* if $self->{configure_args}; | ||
| 22 | $self->run_configure($ctx, \@cmd, $dependency_libs, $dependency_paths) && -f 'Makefile'; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub build ($self, $ctx, $dependency_libs, $dependency_paths) { | ||
| 26 | my @cmd = ($ctx->{make}); | ||
| 27 | push @cmd, $self->{build_args}->@* if $self->{build_args}; | ||
| 28 | my $ok = $self->run_build($ctx, \@cmd, $dependency_libs, $dependency_paths); | ||
| 29 | return if !$ok; | ||
| 30 | $self->_prepare_paths_cache; | ||
| 31 | $self->_write_blib_meta($ctx); | ||
| 32 | return 1; | ||
| 33 | } | ||
| 34 | |||
| 35 | sub test ($self, $ctx, $dependency_libs, $dependency_paths) { | ||
| 36 | my @cmd = ($ctx->{make}, "test"); | ||
| 37 | push @cmd, $self->{test_args}->@* if $self->{test_args}; | ||
| 38 | $self->run_test($ctx, \@cmd, $dependency_libs, $dependency_paths); | ||
| 39 | } | ||
| 40 | |||
| 41 | sub install ($self, $ctx, $dependency_libs = [], $dependency_paths = []) { | ||
| 42 | return $self->SUPER::install($ctx, $dependency_libs, $dependency_paths) if !$self->{use_install_command}; | ||
| 43 | my @cmd = ($ctx->{make}, 'install'); | ||
| 44 | push @cmd, $self->{install_args}->@* if $self->{install_args}; | ||
| 45 | my $ok = $self->run_install($ctx, \@cmd, $dependency_libs, $dependency_paths); | ||
| 46 | return if !$ok; | ||
| 47 | $self->_install_blib_meta($ctx); | ||
| 48 | return 1; | ||
| 49 | } | ||
| 50 | |||
| 51 | sub needs_install_env ($self) { | ||
| 52 | return $self->{use_install_command} ? 1 : 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | 1; |