| 1 | package Module::Build::Tiny; | ||||||||||||||||||||||||||||||||
| 2 | 4 | $Module::Build::Tiny::VERSION = '0.053'; | |||||||||||||||||||||||||||||||
| 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 Exporter 5.57 'import'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 4 | our @EXPORT = qw/Build Build_PL/; | |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use CPAN::Meta; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use ExtUtils::Config 0.003; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use ExtUtils::Helpers 0.020 qw/make_executable split_like_shell man1_pagename man3_pagename detildefy/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use ExtUtils::Install qw/pm_to_blib install/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use ExtUtils::InstallPaths 0.002; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use File::Basename qw/basename dirname/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | use File::Find (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use File::Path qw/mkpath rmtree/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | use File::Spec::Functions qw/catfile catdir rel2abs abs2rel splitdir curdir/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | 4 | ▶ | use Getopt::Long 2.36 qw/GetOptionsFromArray/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | use JSON::PP 2 qw/encode_json decode_json/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | sub write_file { | ||||||||||||||||||||||||||||||
|
Subroutine
write_file: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 21 | 2 | my ($filename, $content) = @_; | |||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | open my $fh, '>', $filename or die "Could not open $filename: $!\n"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 23 | 2 | print $fh $content; | |||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | sub read_file { | ||||||||||||||||||||||||||||||
|
Subroutine
read_file: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 26 | 3 | my ($filename) = @_; | |||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | open my $fh, '<', $filename or die "Could not open $filename: $!\n"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 28 | 3 | return do { local $/; <$fh> }; | |||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | sub get_meta { | ||||||||||||||||||||||||||||||
|
Subroutine
get_meta: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | my ($metafile) = grep { -e $_ } qw/META.json META.yml/ or die "No META information provided\n"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 33 | 5 | return CPAN::Meta->load_file($metafile); | |||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub manify { | ||||||||||||||||||||||||||||||
|
Subroutine
manify: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 37 | 0 | my ($input_file, $output_file, $section, $opts) = @_; | |||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | return if -e $output_file && -M $input_file <= -M $output_file; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $output_file and -M $input_file <= -M $output_file
MC/DC0%0/2
-e $output_file and -M $input_file <= -M $output_file
-e $output_file
-M $input_file <= -M $output_file
Truth table0%0/3
A and B
A= -e $output_fileB= -M $input_file <= -M $output_file
| |||||||||||||||||||||||||||||||||
| 39 | 0 | my $dirname = dirname($output_file); | |||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | mkpath($dirname, $opts->{verbose}) if not -d $dirname; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 41 | 0 | require Pod::Man; | |||||||||||||||||||||||||||||||
| 42 | 0 | Pod::Man->new(section => $section)->parse_from_file($input_file, $output_file); | |||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | print "Manifying $output_file\n" if $opts->{verbose} && $opts->{verbose} > 0; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts->{"verbose"} and $opts->{"verbose"} > 0
MC/DC0%0/2
$opts->{"verbose"} and $opts->{"verbose"} > 0
$opts->{"verbose"}
$opts->{"verbose"} > 0
Truth table0%0/3
A and B
A= $opts->{"verbose"}B= $opts->{"verbose"} > 0
| |||||||||||||||||||||||||||||||||
| 44 | 0 | return; | |||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 1 | ▶ | sub process_xs { | ||||||||||||||||||||||||||||||
|
Subroutine
process_xs: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 48 | 1 | my ($source, $options, $c_files) = @_; | |||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 1 | ▶ | die "Can't build xs files under --pureperl-only\n" if $options->{'pureperl-only'}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 51 | 1 | my (undef, @parts) = splitdir(dirname($source)); | |||||||||||||||||||||||||||||||
| 52 | 1 | push @parts, my $file_base = basename($source, '.xs'); | |||||||||||||||||||||||||||||||
| 53 | 1 | my $archdir = catdir(qw/blib arch auto/, @parts); | |||||||||||||||||||||||||||||||
| 54 | 1 | my $tempdir = 'temp'; | |||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 1 | my $c_file = catfile($tempdir, "$file_base.c"); | |||||||||||||||||||||||||||||||
| 57 | 1 | require ExtUtils::ParseXS; | |||||||||||||||||||||||||||||||
| 58 | 1 | mkpath($tempdir, $options->{verbose}, oct '755'); | |||||||||||||||||||||||||||||||
| 59 | 1 | ExtUtils::ParseXS::process_file(filename => $source, prototypes => 0, output => $c_file); | |||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | 1 | my $version = $options->{meta}->version; | |||||||||||||||||||||||||||||||
| 62 | 1 | require ExtUtils::CBuilder; | |||||||||||||||||||||||||||||||
| 63 | 1 | my $builder = ExtUtils::CBuilder->new(config => $options->{config}->values_set); | |||||||||||||||||||||||||||||||
| 64 | 1 | my @objects = $builder->compile(source => $c_file, defines => { VERSION => qq/"$version"/, XS_VERSION => qq/"$version"/ }, include_dirs => [ curdir, 'include', 'src', dirname($source) ], extra_compiler_flags => $options->{extra_compiler_flags}); | |||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 1 | my $o = $options->{config}->get('_o'); | |||||||||||||||||||||||||||||||
| 67 | 1 | for my $c_source (@{ $c_files }) { | |||||||||||||||||||||||||||||||
| 68 | 1 | my $o_file = catfile($tempdir, basename($c_source, '.c') . $o); | |||||||||||||||||||||||||||||||
| 69 | 1 | push @objects, $builder->compile(source => $c_source, include_dirs => [ curdir, 'include', 'src', dirname($c_source) ], extra_compiler_flags => $options->{extra_compiler_flags}); | |||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 1 | require DynaLoader; | |||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | my $mod2fname = defined &DynaLoader::mod2fname ? \&DynaLoader::mod2fname : sub { return $_[0][-1] }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | 1 | ▶ | mkpath($archdir, $options->{verbose}, oct '755') unless -d $archdir; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 76 | 1 | my $lib_file = catfile($archdir, $mod2fname->(\@parts) . '.' . $options->{config}->get('dlext')); | |||||||||||||||||||||||||||||||
| 77 | 1 | return $builder->link(objects => \@objects, lib_file => $lib_file, extra_linker_flags => $options->{extra_linker_flags}, module_name => join '::', @parts); | |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | 9 | ▶ | sub find { | ||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 81 | 9 | my ($pattern, $dir) = @_; | |||||||||||||||||||||||||||||||
| 82 | 9 | my @ret; | |||||||||||||||||||||||||||||||
| 83 | 9 | ▶ | File::Find::find(sub { push @ret, $File::Find::name if /$pattern/ && -f }, $dir) if -d $dir; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 2 branches
Condition100%3/3
/$pattern/ and -f $_
MC/DC100%2/2
/$pattern/ and -f $_
/$pattern/
-f $_
Truth table100%3/3
A and B
A= /$pattern/B= -f $_
| |||||||||||||||||||||||||||||||||
| 84 | 9 | return @ret; | |||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub contains_pod { | ||||||||||||||||||||||||||||||
|
Subroutine
contains_pod: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 88 | 0 | my ($file) = @_; | |||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | return unless -T $file; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 90 | 0 | return read_file($file) =~ /^\=(?:head|pod|item)/m; | |||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||
| 93 | my %actions = ( | ||||||||||||||||||||||||||||||||
| 94 | 1 | ▶ | build => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=14 SCAR=36.2
| |||||||||||||||||||||||||||||||||
| 95 | 1 | my %opt = @_; | |||||||||||||||||||||||||||||||
| 96 | 1 | for my $pl_file (find(qr/\.PL$/, 'lib')) { | |||||||||||||||||||||||||||||||
| 97 | 0 | (my $pm = $pl_file) =~ s/\.PL$//; | |||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | system $^X, $pl_file, $pm and die "$pl_file returned $?\n"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||
| 100 | 1 | my %modules = map { $_ => catfile('blib', $_) } find(qr/\.pm$/, 'lib'); | |||||||||||||||||||||||||||||||
| 101 | 0 | my %docs = map { $_ => catfile('blib', $_) } find(qr/\.pod$/, 'lib'); | |||||||||||||||||||||||||||||||
| 102 | 1 | my %scripts = map { $_ => catfile('blib', $_) } find(qr/(?:)/, 'script'); | |||||||||||||||||||||||||||||||
| 103 | 0 | my %sdocs = map { $_ => delete $scripts{$_} } grep { /.pod$/ } keys %scripts; | |||||||||||||||||||||||||||||||
| 104 | 1 | my %dist_shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(qr/(?:)/, 'share'); | |||||||||||||||||||||||||||||||
| 105 | 1 | my %module_shared = map { $_ => catfile(qw/blib lib auto share module/, abs2rel($_, 'module-share')) } find(qr/(?:)/, 'module-share'); | |||||||||||||||||||||||||||||||
| 106 | 1 | pm_to_blib({ %modules, %docs, %scripts, %dist_shared, %module_shared }, catdir(qw/blib lib auto/)); | |||||||||||||||||||||||||||||||
| 107 | 1 | make_executable($_) for values %scripts; | |||||||||||||||||||||||||||||||
| 108 | 1 | mkpath(catdir(qw/blib arch/), $opt{verbose}); | |||||||||||||||||||||||||||||||
| 109 | 1 | my $main_xs = join('/', 'lib', split /-/, $opt{meta}->name) . '.xs'; | |||||||||||||||||||||||||||||||
| 110 | 1 | for my $xs (find(qr/.xs$/, 'lib')) { | |||||||||||||||||||||||||||||||
| 111 | 1 | ▶ | my @c_files = $xs eq $main_xs ? find(qr/\.c$/, 'src') : (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 112 | 1 | process_xs($xs, \%opt, \@c_files); | |||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | if ($opt{install_paths}->install_destination('bindoc') && $opt{install_paths}->is_default_installable('bindoc')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opt{"install_paths"}->install_destination("bindoc") and $opt{"install_paths"}->is_default_installable("bindoc")
MC/DC0%0/2
$opt{"install_paths"}->install_destination("bindoc") and $opt{"install_paths"}->is_default_installable("bindoc")
$opt{"install_paths"}->install_destination("bindoc")
$opt{"install_paths"}->is_default_installable("bindoc")
Truth table33%1/3
A and B
A= $opt{"install_paths"}->install_destination("bindoc")B= $opt{"install_paths"}->is_default_installable("bindoc")
| |||||||||||||||||||||||||||||||||
| 116 | 0 | my $section = $opt{config}->get('man1ext'); | |||||||||||||||||||||||||||||||
| 117 | 0 | for my $input (keys %scripts, keys %sdocs) { | |||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | next unless contains_pod($input); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 119 | 0 | my $output = catfile('blib', 'bindoc', man1_pagename($input)); | |||||||||||||||||||||||||||||||
| 120 | 0 | manify($input, $output, $section, \%opt); | |||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||
| 123 | 1 | ▶ | if ($opt{install_paths}->install_destination('libdoc') && $opt{install_paths}->is_default_installable('libdoc')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opt{"install_paths"}->install_destination("libdoc") and $opt{"install_paths"}->is_default_installable("libdoc")
MC/DC0%0/2
$opt{"install_paths"}->install_destination("libdoc") and $opt{"install_paths"}->is_default_installable("libdoc")
$opt{"install_paths"}->install_destination("libdoc")
$opt{"install_paths"}->is_default_installable("libdoc")
Truth table33%1/3
A and B
A= $opt{"install_paths"}->install_destination("libdoc")B= $opt{"install_paths"}->is_default_installable("libdoc")
| |||||||||||||||||||||||||||||||||
| 124 | 0 | my $section = $opt{config}->get('man3ext'); | |||||||||||||||||||||||||||||||
| 125 | 0 | for my $input (keys %modules, keys %docs) { | |||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | next unless contains_pod($input); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 127 | 0 | my $output = catfile('blib', 'libdoc', man3_pagename($input)); | |||||||||||||||||||||||||||||||
| 128 | 0 | manify($input, $output, $section, \%opt); | |||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||
| 131 | 1 | return 0; | |||||||||||||||||||||||||||||||
| 132 | }, | ||||||||||||||||||||||||||||||||
| 133 | 1 | ▶ | test => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 134 | 1 | my %opt = @_; | |||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | die "Must run `./Build build` first\n" if not -d 'blib'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 136 | 1 | require TAP::Harness::Env; | |||||||||||||||||||||||||||||||
| 137 | my %test_args = ( | ||||||||||||||||||||||||||||||||
| 138 | (verbosity => $opt{verbose}) x!! exists $opt{verbose}, | ||||||||||||||||||||||||||||||||
| 139 | (jobs => $opt{jobs}) x!! exists $opt{jobs}, | ||||||||||||||||||||||||||||||||
| 140 | (color => 1) x !!-t STDOUT, | ||||||||||||||||||||||||||||||||
| 141 | 1 | lib => [ map { rel2abs(catdir(qw/blib/, $_)) } qw/arch lib/ ], | |||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||
| 143 | 1 | my $tester = TAP::Harness::Env->create(\%test_args); | |||||||||||||||||||||||||||||||
| 144 | 1 | local $ENV{PERL_DL_NONLAZY} = 1; | |||||||||||||||||||||||||||||||
| 145 | 1 | return $tester->runtests(sort +find(qr/\.t$/, 't'))->has_errors; | |||||||||||||||||||||||||||||||
| 146 | }, | ||||||||||||||||||||||||||||||||
| 147 | 1 | ▶ | install => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 148 | 1 | my %opt = @_; | |||||||||||||||||||||||||||||||
| 149 | 1 | ▶ | die "Must run `./Build build` first\n" if not -d 'blib'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 150 | 1 | install($opt{install_paths}->install_map, @opt{qw/verbose dry_run uninst/}); | |||||||||||||||||||||||||||||||
| 151 | 1 | return 0; | |||||||||||||||||||||||||||||||
| 152 | }, | ||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | clean => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 154 | 0 | my %opt = @_; | |||||||||||||||||||||||||||||||
| 155 | 0 | rmtree($_, $opt{verbose}) for qw/blib temp/; | |||||||||||||||||||||||||||||||
| 156 | 0 | return 0; | |||||||||||||||||||||||||||||||
| 157 | }, | ||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | realclean => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 159 | 0 | my %opt = @_; | |||||||||||||||||||||||||||||||
| 160 | 0 | rmtree($_, $opt{verbose}) for qw/blib temp Build _build_params MYMETA.yml MYMETA.json/; | |||||||||||||||||||||||||||||||
| 161 | 0 | return 0; | |||||||||||||||||||||||||||||||
| 162 | }, | ||||||||||||||||||||||||||||||||
| 163 | 4 | ); | |||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||
| 165 | 4 | my @options = qw/install_base=s install_path=s% installdirs=s destdir=s prefix=s config=s% uninst:1 verbose:1 dry_run:1 pureperl-only:1 create_packlist=i jobs=i extra_compiler_flags=s extra_linker_flags=s/; | |||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||
| 167 | 4 | ▶ | sub get_arguments { | ||||||||||||||||||||||||||||||
|
Subroutine
get_arguments: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 168 | 4 | my @sources = @_; | |||||||||||||||||||||||||||||||
| 169 | 4 | my %opt; | |||||||||||||||||||||||||||||||
| 170 | 4 | GetOptionsFromArray($_, \%opt, @options) for @sources; | |||||||||||||||||||||||||||||||
| 171 | 4 | $_ = detildefy($_) for grep { defined } @opt{qw/install_base destdir prefix/}, values %{ $opt{install_path} }; | |||||||||||||||||||||||||||||||
| 172 | 4 | $_ = [ split_like_shell($_) ] for grep { defined } @opt{qw/extra_compiler_flags extra_linker_flags/}; | |||||||||||||||||||||||||||||||
| 173 | 4 | $opt{config} = ExtUtils::Config->new($opt{config}); | |||||||||||||||||||||||||||||||
| 174 | 4 | $opt{meta} = get_meta(); | |||||||||||||||||||||||||||||||
| 175 | 4 | $opt{install_paths} = ExtUtils::InstallPaths->new(%opt, dist_name => $opt{meta}->name); | |||||||||||||||||||||||||||||||
| 176 | 4 | return %opt; | |||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||
| 179 | 3 | ▶ | sub Build { | ||||||||||||||||||||||||||||||
|
Subroutine
Build: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 180 | 3 | ▶ | my $action = @ARGV && $ARGV[0] =~ /\A\w+\z/ ? shift @ARGV : 'build'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@ARGV and $ARGV[0] =~ /\A\w+\z/
MC/DC50%1/2
@ARGV and $ARGV[0] =~ /\A\w+\z/
@ARGV
$ARGV[0] =~ /\A\w+\z/
Truth table66%2/3
A and B
A= @ARGVB= $ARGV[0] =~ /\A\w+\z/
| |||||||||||||||||||||||||||||||||
| 181 | 3 | ▶ | die "No such action '$action'\n" if not $actions{$action}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 182 | 3 | my($env, $bargv) = @{ decode_json(read_file('_build_params')) }; | |||||||||||||||||||||||||||||||
| 183 | 3 | my %opt = get_arguments($env, $bargv, \@ARGV); | |||||||||||||||||||||||||||||||
| 184 | 3 | exit $actions{$action}->(%opt); | |||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | sub Build_PL { | ||||||||||||||||||||||||||||||
|
Subroutine
Build_PL: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 188 | 1 | my $meta = get_meta(); | |||||||||||||||||||||||||||||||
| 189 | 1 | printf "Creating new 'Build' script for '%s' version '%s'\n", $meta->name, $meta->version; | |||||||||||||||||||||||||||||||
| 190 | 1 | ▶ | my $dir = $meta->name eq 'Module-Build-Tiny' ? "use lib 'lib';" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 191 | 1 | write_file('Build', "#!perl\n$dir\nuse Module::Build::Tiny;\nBuild();\n"); | |||||||||||||||||||||||||||||||
| 192 | 1 | make_executable('Build'); | |||||||||||||||||||||||||||||||
| 193 | 1 | ▶ | my @env = defined $ENV{PERL_MB_OPT} ? split_like_shell($ENV{PERL_MB_OPT}) : (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 194 | 1 | write_file('_build_params', encode_json([ \@env, \@ARGV ])); | |||||||||||||||||||||||||||||||
| 195 | 1 | my %mymeta = %{ $meta->as_struct }; | |||||||||||||||||||||||||||||||
| 196 | 1 | ▶ | if (my $dynamic = $meta->custom('x_dynamic_prereqs')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 197 | 1 | my %opt = get_arguments(\@env, \@ARGV); | |||||||||||||||||||||||||||||||
| 198 | 1 | require CPAN::Requirements::Dynamic; | |||||||||||||||||||||||||||||||
| 199 | 1 | my $dynamic_parser = CPAN::Requirements::Dynamic->new(%opt); | |||||||||||||||||||||||||||||||
| 200 | 1 | my $prereq = $dynamic_parser->evaluate($dynamic); | |||||||||||||||||||||||||||||||
| 201 | 1 | $mymeta{prereqs} = $meta->effective_prereqs->with_merged_prereqs($prereq)->as_string_hash; | |||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||
| 203 | 1 | $mymeta{dynamic_config} = 0; | |||||||||||||||||||||||||||||||
| 204 | 1 | my $mymeta = CPAN::Meta->new(\%mymeta); | |||||||||||||||||||||||||||||||
| 205 | 1 | $mymeta->save(@$_) for ['MYMETA.json'], [ 'MYMETA.yml' => { version => 1.4 } ]; | |||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||
| 208 | 4 | 1; | |||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||
| 210 | #ABSTRACT: A tiny replacement for Module::Build | ||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | # vi:noet:sts=4:sw=4:ts=4 | ||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | __END__ | ||||||||||||||||||||||||||||||||