« blib/lib/Alien/Build/Plugin/Core/Gather.pm
↑ Summary
blib/lib/Alien/Build/Plugin/PkgConfig/Negotiate.pm »
| 1 | package Alien::Build::Plugin::Build::MSYS; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use 5.008004; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | ▶ | use Alien::Build::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 4 | ▶ | use File::Which (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 4 | ▶ | use Env qw( @PATH ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # ABSTRACT: MSYS plugin for Alien::Build | ||||||||||
| 11 | 4 | our $VERSION = '2.88'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 4 | has msys_version => '0.07'; | |||||||||
| 15 | |||||||||||
| 16 | sub init | ||||||||||
| 17 | 9 | ▶ | { | ||||||||
|
Subroutine
init: called CC=5 SCAR=23.9
Pod
documented
| |||||||||||
| 18 | 9 | my($self, $meta) = @_; | |||||||||
| 19 | |||||||||||
| 20 | 9 | ▶ | if($self->msys_version ne '0.07') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | { | ||||||||||
| 22 | 0 | $meta->add_requires('configure' => 'Alien::Build::Plugin::Build::MSYS' => '0.84'); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 9 | ▶ | if(_win_and_needs_msys($meta)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | { | ||||||||||
| 27 | 0 | $meta->add_requires('share' => 'Alien::MSYS' => $self->msys_version); | |||||||||
| 28 | |||||||||||
| 29 | $meta->around_hook( | ||||||||||
| 30 | 0 | ▶ | $_ => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 31 | 0 | my $orig = shift; | |||||||||
| 32 | 0 | my $build = shift; | |||||||||
| 33 | |||||||||||
| 34 | 0 | local $ENV{PATH} = $ENV{PATH}; | |||||||||
| 35 | 0 | unshift @PATH, Alien::MSYS::msys_path(); | |||||||||
| 36 | |||||||||||
| 37 | 0 | $orig->($build, @_); | |||||||||
| 38 | }, | ||||||||||
| 39 | 0 | ) for qw( build build_ffi test_share test_ffi ); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 9 | ▶ | if($^O eq 'MSWin32') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | { | ||||||||||
| 45 | # Most likely if we are trying to build something unix-y and | ||||||||||
| 46 | # we are using MSYS, then we want to use the make that comes | ||||||||||
| 47 | # with MSYS. | ||||||||||
| 48 | $meta->interpolator->replace_helper( | ||||||||||
| 49 | 0 | ▶ | make => sub { 'make' }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 50 | 0 | ); | |||||||||
| 51 | |||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 9 | $self; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | sub _win_and_needs_msys | ||||||||||
| 58 | 9 | ▶ | { | ||||||||
|
Subroutine
_win_and_needs_msys: called CC=3 SCAR=16.5
| |||||||||||
| 59 | 9 | my($meta) = @_; | |||||||||
| 60 | # check to see if we are running on windows. | ||||||||||
| 61 | # if we are running on windows, check to see if | ||||||||||
| 62 | # it is MSYS2, then we can just use that. Otherwise | ||||||||||
| 63 | # we are probably on Strawberry, or (less likely) | ||||||||||
| 64 | # VC Perl, in which case we will still need Alien::MSYS | ||||||||||
| 65 | 9 | ▶ | return 0 unless $^O eq 'MSWin32'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | ▶ | return 0 if $meta->prop->{platform}->{system_type} eq 'windows-mingw'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | 0 | return 1; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 4 | 1; | |||||||||
| 71 | |||||||||||
| 72 | __END__ | ||||||||||