lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/Tiny.pm in javonet-ruby-sdk-2.1.1 vs lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/Tiny.pm in javonet-ruby-sdk-2.1.2

- old
+ new

@@ -1,7 +1,7 @@ package Module::Build::Tiny; -$Module::Build::Tiny::VERSION = '0.041'; +$Module::Build::Tiny::VERSION = '0.045'; use strict; use warnings; use Exporter 5.57 'import'; our @EXPORT = qw/Build Build_PL/; @@ -43,11 +43,11 @@ print "Manifying $output_file\n" if $opts->{verbose} && $opts->{verbose} > 0; return; } sub process_xs { - my ($source, $options) = @_; + my ($source, $options, $c_files) = @_; die "Can't build xs files under --pureperl-only\n" if $options->{'pureperl-only'}; my (undef, @parts) = splitdir(dirname($source)); push @parts, my $file_base = basename($source, '.xs'); my $archdir = catdir(qw/blib arch auto/, @parts); @@ -59,18 +59,24 @@ ExtUtils::ParseXS::process_file(filename => $source, prototypes => 0, output => $c_file); my $version = $options->{meta}->version; require ExtUtils::CBuilder; my $builder = ExtUtils::CBuilder->new(config => $options->{config}->values_set); - my $ob_file = $builder->compile(source => $c_file, defines => { VERSION => qq/"$version"/, XS_VERSION => qq/"$version"/ }, include_dirs => [ curdir, dirname($source) ]); + my @objects = $builder->compile(source => $c_file, defines => { VERSION => qq/"$version"/, XS_VERSION => qq/"$version"/ }, include_dirs => [ curdir, 'include', dirname($source) ]); + my $o = $options->{config}->get('_o'); + for my $c_source (@{ $c_files }) { + my $o_file = catfile($tempdir, basename($c_source, '.c') . $o); + push @objects, $builder->compile(source => $c_source, include_dirs => [ curdir, 'include', dirname($source) ]) + } + require DynaLoader; my $mod2fname = defined &DynaLoader::mod2fname ? \&DynaLoader::mod2fname : sub { return $_[0][-1] }; mkpath($archdir, $options->{verbose}, oct '755') unless -d $archdir; my $lib_file = catfile($archdir, $mod2fname->(\@parts) . '.' . $options->{config}->get('dlext')); - return $builder->link(objects => $ob_file, lib_file => $lib_file, module_name => join '::', @parts); + return $builder->link(objects => \@objects, lib_file => $lib_file, module_name => join '::', @parts); } sub find { my ($pattern, $dir) = @_; my @ret; @@ -79,11 +85,11 @@ } sub contains_pod { my ($file) = @_; return unless -T $file; - return read_file($file) =~ /^\=(?:head|pod|item)/; + return read_file($file) =~ /^\=(?:head|pod|item)/m; } my %actions = ( build => sub { my %opt = @_; @@ -93,15 +99,20 @@ } my %modules = map { $_ => catfile('blib', $_) } find(qr/\.pm$/, 'lib'); my %docs = map { $_ => catfile('blib', $_) } find(qr/\.pod$/, 'lib'); my %scripts = map { $_ => catfile('blib', $_) } find(qr//, 'script'); my %sdocs = map { $_ => delete $scripts{$_} } grep { /.pod$/ } keys %scripts; - my %shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(qr//, 'share'); - pm_to_blib({ %modules, %docs, %scripts, %shared }, catdir(qw/blib lib auto/)); + my %dist_shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(qr//, 'share'); + my %module_shared = map { $_ => catfile(qw/blib lib auto share module/, abs2rel($_, 'module-share')) } find(qr//, 'module-share'); + pm_to_blib({ %modules, %docs, %scripts, %dist_shared, %module_shared }, catdir(qw/blib lib auto/)); make_executable($_) for values %scripts; mkpath(catdir(qw/blib arch/), $opt{verbose}); - process_xs($_, \%opt) for find(qr/.xs$/, 'lib'); + my $main_xs = join('/', 'lib', split /-/, $opt{meta}->name) . '.xs'; + for my $xs (find(qr/.xs$/, 'lib')) { + my @c_files = $xs eq $main_xs ? find(qr/\.c$/, 'src') : (); + process_xs($xs, \%opt, \@c_files); + } if ($opt{install_paths}->install_destination('bindoc') && $opt{install_paths}->is_default_installable('bindoc')) { my $section = $opt{config}->get('man1ext'); for my $input (keys %scripts, keys %sdocs) { next unless contains_pod($input); @@ -189,11 +200,11 @@ Module::Build::Tiny - A tiny replacement for Module::Build =head1 VERSION -version 0.041 +version 0.045 =head1 SYNOPSIS use Module::Build::Tiny; Build_PL(); @@ -222,10 +233,12 @@ =item * Man page generation =item * Generated code from PL files +=item * Module sharedirs + =back =head2 Not Supported =over 4 @@ -234,17 +247,20 @@ =item * HTML documentation generation =item * Extending Module::Build::Tiny -=item * Module sharedirs - =back =head2 Directory structure Your .pm, .xs and .pod files must be in F<lib/>. Any executables must be in -F<script/>. Test files must be in F<t/>. Dist sharedirs must be in F<share/>. +F<script/>. Test files must be in F<t/>. Dist sharedirs must be in F<share/>, +module sharedirs are under F<module-share> (e.g. F<module-share/Foo-Bar> for +module C<Foo::Bar>). + +C<.c> files in the F<src/> are compiled together with the .xs file matching the +distribution name. =head1 USAGE These all work pretty much like their Module::Build equivalents.