« blib/lib/Alien/Build/Plugin/Gather/IsolateDynamic.pm
↑ Summary
blib/lib/Alien/Build/Plugin/Build/MSYS.pm »
| 1 | package Alien::Build::Plugin::Core::Gather; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 57 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 57 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 57 | ▶ | use 5.008004; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 57 | ▶ | use Alien::Build::Plugin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 57 | ▶ | use Env qw( @PATH @PKG_CONFIG_PATH ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 57 | ▶ | use Path::Tiny (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 57 | ▶ | use File::chdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 57 | ▶ | use Alien::Build::Util qw( _mirror _destdir_prefix ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 57 | ▶ | use JSON::PP (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # ABSTRACT: Core gather plugin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 57 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | sub init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 382 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 382 | my($self, $meta) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | $meta->default_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 23 | ▶ | $_ => sub {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 382 | ) for qw( gather_system gather_share ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | $meta->around_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 32 | ▶ | gather_share => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 32 | my($orig, $build) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 32 | local $ENV{PATH} = $ENV{PATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 32 | local $ENV{PKG_CONFIG_PATH} = $ENV{PKG_CONFIG_PATH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 32 | ▶ | unshift @PATH, Path::Tiny->new('bin')->absolute->stringify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | if -d 'bin'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 32 | for my $dir (qw(share lib)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 64 | ▶ | unshift @PKG_CONFIG_PATH, Path::Tiny->new("$dir/pkgconfig")->absolute->stringify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | if -d "$dir/pkgconfig"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 32 | $orig->($build) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 382 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 382 | foreach my $type (qw( share ffi )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | $meta->around_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 64 | ▶ | "gather_$type" => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 64 | my($orig, $build) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 64 | ▶ | if($build->meta_prop->{destdir}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 16 | my $destdir = $ENV{DESTDIR}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 16 | ▶ | if(-d $destdir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 10 | my $src = Path::Tiny->new(_destdir_prefix($ENV{DESTDIR}, $build->install_prop->{prefix})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 10 | my $dst = Path::Tiny->new($build->install_prop->{stage}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 10 | my $res = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 10 | local $CWD = "$src"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 10 | $orig->($build); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 10 | $build->log("mirror $src => $dst"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 10 | $dst->mkpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Please note: _mirror and Alien::Build::Util are ONLY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # allowed to be used by core plugins. If you are writing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # a non-core plugin it may be removed. That is why it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # is private. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | _mirror("$src", "$dst", { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | verbose => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 10 | ▶ | filter => $build->meta_prop->{$type eq 'share' ? 'destdir_filter' : 'destdir_ffi_filter'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 10 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | ▶ | die "nothing was installed into destdir" if $type eq 'share'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 48 | local $CWD = $build->install_prop->{stage}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 48 | my $ret = $orig->($build); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # if we are not doing a double staged install we want to substitute the install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # prefix with the runtime prefix. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 48 | my $old = $build->install_prop->{prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 48 | my $new = $build->runtime_prop->{prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 48 | foreach my $flag (qw( cflags cflags_static libs libs_static )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 192 | ▶ | next unless defined $build->runtime_prop->{$flag}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $build->runtime_prop->{$flag} =~ s{(-I|-L|-LIBPATH:)\Q$old\E}{$1 . $new}eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 48 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 764 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | $meta->after_hook( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 44 | ▶ | $_ => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 44 | my($build) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | die "stage is not defined. be sure to call set_stage on your Alien::Build instance" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 44 | ▶ | unless $build->install_prop->{stage}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 44 | my $stage = Path::Tiny->new($build->install_prop->{stage}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 44 | $build->log("mkdir -p $stage/_alien"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 44 | $stage->child('_alien')->mkpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # drop a alien.json file for the runtime properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 44 | $stage->child('_alien/alien.json')->spew( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | JSON::PP->new->pretty->canonical(1)->ascii->encode($build->runtime_prop) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # copy the alienfile, if we managed to keep it around. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 44 | ▶ | if($build->meta->filename && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$build->meta->filename and -r $build->meta->filename and not $build->meta->filename =~ /\.(pm|pl)$/ and not -d $build->meta->filename
$build->meta->filename and -r $build->meta->filename and not $build->meta->filename =~ /\.(pm|pl)$/
$build->meta->filename and -r $build->meta->filename
MC/DC0%0/4
$build->meta->filename and -r $build->meta->filename and not $build->meta->filename =~ /\.(pm|pl)$/ and not -d $build->meta->filename
$build->meta->filename
-r $build->meta->filename
not $build->meta->filename =~ /\.(pm|pl)$/
not -d $build->meta->filename
Truth table20%1/5
A and B and not(C) and not(D)
A= $build->meta->filenameB= -r $build->meta->filenameC= not $build->meta->filename =~ /\.(pm|pl)$/D= not -d $build->meta->filename
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | -r $build->meta->filename && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | $build->meta->filename !~ /\.(pm|pl)$/ && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ! -d $build->meta->filename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 44 | Path::Tiny->new($build->meta->filename) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ->copy($stage->child('_alien/alienfile')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 44 | ▶ | if($build->install_prop->{patch} && -d $build->install_prop->{patch}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$build->install_prop->{"patch"} and -d $build->install_prop->{"patch"}
MC/DC50%1/2
$build->install_prop->{"patch"} and -d $build->install_prop->{"patch"}
$build->install_prop->{"patch"}
-d $build->install_prop->{"patch"}
Truth table66%2/3
A and B
A= $build->install_prop->{"patch"}B= -d $build->install_prop->{"patch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # Please note: _mirror and Alien::Build::Util are ONLY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # allowed to be used by core plugins. If you are writing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # a non-core plugin it may be removed. That is why it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # is private. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | _mirror($build->install_prop->{patch}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | $stage->child('_alien/patch')->stringify); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 382 | ) for qw( gather_share gather_system ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 57 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||