App-PP-Autolink
view release on metacpan or search on metacpan
We can revisit if earlier versions are shown to be needed.
2.07 20221115
- Add detected Aliens to the pp call if they inherit from Alien::Base.
Needed to ensure the share dirs are packed (see Module::ScanDeps#13).
2.06 20221115
- Macs: Handle @rpath and @loader_path entries in dependency paths. GH#17
2.05 20220919
- Unices: Pack system libs, except for libm, libc, libpthread and libdl
The previous approach overdid things.
Thanks @sciurius for the report.
2.04 20200622
- Properly exclude system libs in /lib/ when using ldd.
2.03 20200612
- Set minimum List::Util version to 1.45 for util sub.
2.02 20200611 18:00 AEST
lib/App/PP/Autolink.pm view on Meta::CPAN
}
elsif ($dylib =~ /\@loader_path/) {
my $orig_name = $dylib;
$dylib = _resolve_loader_path_mac($lib, $dylib);
}
next if $seen{$dylib};
next if $dylib =~ m{^/System}; # skip system libs
#next if $dylib =~ m{^/usr/lib/system};
next if $dylib =~ m{^/usr/lib/libSystem};
next if $dylib =~ m{^/usr/lib/};
next if $dylib =~ m{\Qdarwin-thread-multi-2level/auto/share/dist/Alien\E}; # another alien
say "adding $dylib for $lib";
push @libs_to_pack, $dylib;
$seen{$dylib}++;
# add this dylib to the search set
push @target_libs, $dylib;
}
}
@libs_to_pack = sort @libs_to_pack;
lib/App/PP/Autolink.pm view on Meta::CPAN
#say "Checking $name => $path";
if (not -r $path) {
warn qq[# ldd reported strange path: $path\n];
delete $dlls{$name};
}
elsif (
#$path =~ m{^(?:/usr)?/lib(?:32|64)?/} # system lib
$path =~ $RE_skip
or $path =~ m{\Qdarwin-thread-multi-2level/auto/share/dist/Alien\E} # alien in share
or $name =~ m{^lib(?:c|gcc_s|stdc\+\+)\.} # should already be packed?
) {
#say "skipping $name => $path";
#warn "re1" if $path =~ m{^(?:/usr)?/lib(?:32|64)/};
#warn "re2" if $path =~ m{\Qdarwin-thread-multi-2level/auto/share/dist/Alien\E};
#warn "re3" if $name =~ m{^lib(?:gcc_s|stdc\+\+)\.};
delete $dlls{$name};
}
}
push @target_libs, sort values %dlls;
push @libs_to_pack, sort values %dlls;
}
@libs_to_pack = sort @libs_to_pack;
lib/App/PP/Autolink.pm view on Meta::CPAN
my @files = File::Find::Rule->extras({ follow => 1, follow_skip=>2 })
->file()
->name( qr/\.so$/ )
->in( $target_dir );
return wantarray ? @files : \@files;
}
sub get_ldd_skipper_regexp {
my ($self) = @_;
my @skip = qw /libm libc libpthread libdl/;
my $sk = join '|', @skip;
my $qr_skip = qr {\b(?:$sk)\.$Config::Config{so}};
return $qr_skip;
}
sub get_dll_skipper_regexp {
my ($self) = @_;
# PAR packs these automatically these days.
my @skip = qw /
perl5\d\d
libstdc\+\+\-6
libgcc_s_seh\-1
libwinpthread\-1
libgcc_s_sjlj\-1
/;
my $sk = join '|', @skip;
my $qr_skip = qr /^(?:$sk)$RE_DLL_EXT$/;
return $qr_skip;
}
# find dependent dlls
# could also adapt some of Module::ScanDeps::_compile_or_execute
# as it handles more edge cases
lib/App/PP/Autolink.pm view on Meta::CPAN
All F<pp_autolink> does is recursively check all dynamic libs used by a perl script
and add them to the L<pp> call using C<--link> command line arguments.
Depending on your system it will use the I<ldd>, I<objdump> or I<otool>
utilities to find dependent libs.
It will also check dynamic libs used by Aliens if they are detected
and inherit from L<Alien::Base>.
Note that testing is currently very threadbare,
so please report issues. Pull requests are very welcome.
=head1 OPTIONS
As with L<pp>, options are available in a I<short> form and a I<long> form. For
example, these lines are equivalent:
% pp_autolink -l some.dll output.exe input.pl
% pp_autolink --link some.dll --output output.exe input.pl
( run in 1.208 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )