FFI-CheckLib-0.18/0000755000175000017500000000000013174114423013054 5ustar ollisgollisgFFI-CheckLib-0.18/lib/0000755000175000017500000000000013174114423013622 5ustar ollisgollisgFFI-CheckLib-0.18/lib/FFI/0000755000175000017500000000000013174114423014226 5ustar ollisgollisgFFI-CheckLib-0.18/lib/FFI/CheckLib.pm0000644000175000017500000002667713174114423016252 0ustar ollisgollisgpackage FFI::CheckLib; use strict; use warnings; use File::Spec; use Carp qw( croak carp ); use base qw( Exporter ); our @EXPORT = qw( find_lib assert_lib check_lib check_lib_or_exit find_lib_or_exit find_lib_or_die ); our @EXPORT_OK = qw( which where has_symbols ); # ABSTRACT: Check that a library is available for FFI our $VERSION = '0.18'; # VERSION our $system_path = []; our $os ||= $^O; if($os eq 'MSWin32' || $os eq 'msys') { $system_path = eval { require Env; Env->import('@PATH'); \our @PATH; }; die $@ if $@; } else { $system_path = eval { require DynaLoader; \@DynaLoader::dl_library_path; }; die $@ if $@; } our $pattern = [ qr{^lib(.*?)\.so(?:\.([0-9]+(?:\.[0-9]+)*))?$} ]; if($os eq 'cygwin') { push @$pattern, qr{^cyg(.*?)(?:-([0-9])+)?\.dll$}; } elsif($os eq 'msys') { # doesn't seem as though msys uses psudo libfoo.so files # in the way that cygwin sometimes does. we can revisit # this if we find otherwise. $pattern = [ qr{^msys-(.*?)(?:-([0-9])+)?\.dll$} ]; } elsif($os eq 'MSWin32') { $pattern = [ qr{^(?:lib)?(.*?)(?:-([0-9])+)?\.dll$} ]; } elsif($os eq 'darwin') { push @$pattern, qr{^lib(.*?)(?:\.([0-9]+(?:\.[0-9]+)*))?\.(?:dylib|bundle)$}; } sub _matches { my($filename, $path) = @_; foreach my $regex (@$pattern) { return [ $1, # 0 capture group 1 library name File::Spec->catfile($path, $filename), # 1 full path to library defined $2 ? (split /\./, $2) : (), # 2... capture group 2 library version ] if $filename =~ $regex; } return (); } sub _cmp { my($A,$B) = @_; return $A->[0] cmp $B->[0] if $A->[0] ne $B->[0]; my $i=2; while(1) { return 0 if !defined($A->[$i]) && !defined($B->[$i]); return -1 if !defined $A->[$i]; return 1 if !defined $B->[$i]; return $B->[$i] <=> $A->[$i] if $A->[$i] != $B->[$i]; $i++; } } my $diagnostic; sub find_lib { my(%args) = @_; undef $diagnostic; croak "find_lib requires lib argument" unless defined $args{lib}; my $recursive = $args{_r} || $args{recursive} || 0; # make arguments be lists. foreach my $arg (qw( lib libpath symbol verify )) { next if ref $args{$arg} eq 'ARRAY'; if(defined $args{$arg}) { $args{$arg} = [ $args{$arg} ]; } else { $args{$arg} = []; } } if(defined $args{systempath} && !ref($args{systempath})) { $args{systempath} = [ $args{systempath} ]; } my @path = @{ $args{libpath} }; @path = map { _recurse($_) } @path if $recursive; push @path, grep { defined } defined $args{systempath} ? @{ $args{systempath} } : @$system_path; my $any = 1 if grep { $_ eq '*' } @{ $args{lib} }; my %missing = map { $_ => 1 } @{ $args{lib} }; my %symbols = map { $_ => 1 } @{ $args{symbol} }; my @found; delete $missing{'*'}; foreach my $path (@path) { next unless -d $path; my $dh; opendir $dh, $path; my @maybe = # make determinist based on names and versions sort { _cmp($a,$b) } # Filter out the items that do not match the name that we are looking for # Filter out any broken symbolic links grep { ($any || $missing{$_->[0]} ) && (-e $_->[1]) } # get [ name, full_path ] mapping, # each entry is a 2 element list ref map { _matches($_,$path) } # read all files from the directory readdir $dh; closedir $dh; midloop: foreach my $lib (@maybe) { next unless $any || $missing{$lib->[0]}; foreach my $verify (@{ $args{verify} }) { next midloop unless $verify->(@$lib); } delete $missing{$lib->[0]}; if(%symbols) { require DynaLoader; my $dll = DynaLoader::dl_load_file($lib->[1],0); foreach my $symbol (keys %symbols) { if(DynaLoader::dl_find_symbol($dll, $symbol) ? 1 : 0) { delete $symbols{$symbol} } } DynaLoader::dl_unload_file($dll); } my $found = $lib->[1]; unless($any) { while(-l $found) { require File::Basename; require File::Spec; my $dir = File::Basename::dirname($found); $found = File::Spec->rel2abs( readlink($found), $dir ); } } push @found, $found; } } if(%missing) { my @missing = sort keys %missing; if(@missing > 1) { $diagnostic = "libraries not found: @missing" } else { $diagnostic = "library not found: @missing" } } elsif(%symbols) { my @missing = sort keys %symbols; if(@missing > 1) { $diagnostic = "symbols not found: @missing" } else { $diagnostic = "symbol not found: @missing" } } return if %symbols; return $found[0] unless wantarray; return @found; } sub _recurse { my($dir) = @_; return unless -d $dir; my $dh; opendir $dh, $dir; my @list = grep { -d $_ } map { File::Spec->catdir($dir, $_) } grep !/^\.\.?$/, readdir $dh; closedir $dh; ($dir, map { _recurse($_) } @list); } sub assert_lib { croak $diagnostic || 'library not found' unless check_lib(@_); } sub check_lib_or_exit { unless(check_lib(@_)) { carp $diagnostic || 'library not found'; exit; } } sub find_lib_or_exit { my(@libs) = find_lib(@_); unless(@libs) { carp $diagnostic || 'library not found'; exit; } return unless @libs; wantarray ? @libs : $libs[0]; } sub find_lib_or_die { my(@libs) = find_lib(@_); unless(@libs) { croak $diagnostic || 'library not found'; } return unless @libs; wantarray ? @libs : $libs[0]; } sub check_lib { find_lib(@_) ? 1 : 0; } sub which { my($name) = @_; croak("cannot which *") if $name eq '*'; scalar find_lib( lib => $name ); } sub where { my($name) = @_; $name eq '*' ? find_lib(lib => '*') : find_lib(lib => '*', verify => sub { $_[0] eq $name }); } sub has_symbols { my($path, @symbols) = @_; require DynaLoader; my $dll = DynaLoader::dl_load_file($path, 0); my $ok = 1; foreach my $symbol (@symbols) { unless(DynaLoader::dl_find_symbol($dll, $symbol)) { $ok = 0; last; } } DynaLoader::dl_unload_file($dll); $ok; } 1; __END__ =pod =encoding UTF-8 =head1 NAME FFI::CheckLib - Check that a library is available for FFI =head1 VERSION version 0.18 =head1 SYNOPSIS use FFI::CheckLib; check_lib_or_exit( lib => 'jpeg', symbol => 'jinit_memory_mgr' ); check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] ); # or prompt for path to library and then: print "where to find jpeg library: "; my $path = ; check_lib_or_exit( lib => 'jpeg', libpath => $path ); =head1 DESCRIPTION This module checks whether a particular dynamic library is available for FFI to use. It is modeled heavily on L, but will find dynamic libraries even when development packages are not installed. It also provides a L function that will return the full path to the found dynamic library, which can be feed directly into L or L. Although intended mainly for FFI modules via L and similar, this module does not actually use any FFI to do its detection and probing. This module does not have any non-core runtime dependencies. The test suite does depend on L. =head1 FUNCTIONS All of these take the same named parameters and are exported by default. =head2 find_lib my(@libs) = find_lib(%args); This will return a list of dynamic libraries, or empty list if none were found. [version 0.05] If called in scalar context it will return the first library found. Arguments are key value pairs with these keys: =over 4 =item lib Must be either a string with the name of a single library or a reference to an array of strings of library names. Depending on your platform, C will prepend C or append C<.dll> or C<.so> when searching. [version 0.11] As a special case, if C<*> is specified then any libs found will match. =item libpath A string or array of additional paths to search for libraries. =item systempath [version 0.11] A string or array of system paths to search for instead of letting L determine the system path. You can set this to C<[]> in order to not search I system paths. =item symbol A string or a list of symbol names that must be found. =item verify A code reference used to verify a library really is the one that you want. It should take two arguments, which is the name of the library and the full path to the library pathname. It should return true if it is acceptable, and false otherwise. You can use this in conjunction with L to determine if it is going to meet your needs. Example: use FFI::CheckLib; use FFI::Platypus; my($lib) = find_lib( name => 'foo', verify => sub { my($name, $libpath) = @_; my $ffi = FFI::Platypus->new; $ffi->lib($libpath); my $f = $ffi->function('foo_version', [] => 'int'); return $f->call() >= 500; # we accept version 500 or better }, ); =item recursive [version 0.11] Recursively search for libraries in any non-system paths (those provided via C above). =back =head2 assert_lib assert_lib(%args); This behaves exactly the same as L, except that instead of returning empty list of failure it throws an exception. =head2 check_lib_or_exit check_lib_or_exit(%args); This behaves exactly the same as L, except that instead of dying, it warns (with exactly the same error message) and exists. This is intended for use in C or C =head2 find_lib_or_exit [version 0.05] my(@libs) = find_lib_or_exit(%args); This behaves exactly the same as L, except that if the library is not found, it will call exit with an appropriate diagnostic. =head2 find_lib_or_die [version 0.06] my(@libs) = find_lib_or_die(%args); This behaves exactly the same as L, except that if the library is not found, it will die with an appropriate diagnostic. =head2 check_lib my $bool = check_lib(%args); This behaves exactly the same as L, except that it returns true (1) on finding the appropriate libraries or false (0) otherwise. =head2 which [version 0.17] my $path = where($name); Return the path to the first library that matches the given name. Not exported by default. =head2 where [version 0.17] my @paths = where($name); Return the paths to all the libraries that match the given name. Not exported by default. =head2 has_symbols [version 0.17] my $bool = has_symbols($path, @symbol_names); Returns true if I of the symbols can be found in the dynamic library located at the given path. Can be useful in conjunction with C with C above. Not exported by default. =head1 SEE ALSO =over 4 =item L Call library functions dynamically without a compiler. =item L L plugin for this module. =back =head1 AUTHOR Author: Graham Ollis Eplicease@cpan.orgE Contributors: Bakkiaraj Murugesan (bakkiaraj) Dan Book (grinnz, DBOOK) =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Graham Ollis. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut FFI-CheckLib-0.18/author.yml0000644000175000017500000000067613174114423015112 0ustar ollisgollisg--- pod_spelling_system: skip: 0 # list of words that are spelled correctly # (regardless of what spell check thinks) stopwords: - libpath - Bakkiaraj - Murugesan - bakkiaraj - libs - systempath - grinnz - DBOOK pod_coverage: skip: 0 # format is "Class#method" or "Class", regex allowed # for either Class or method. private: [] unused_vars: skip: 0 global: ignore_vars: [] module: {} FFI-CheckLib-0.18/Makefile.PL0000644000175000017500000000264213174114423015032 0ustar ollisgollisguse strict; use warnings; BEGIN { unless(eval q{ use 5.006; 1}) { print "Perl 5.006 or better required\n"; exit; } } # This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.23. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Check that a library is available for FFI", "AUTHOR" => "Graham Ollis ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "FFI-CheckLib", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "FFI::CheckLib", "PM" => { "lib/FFI/CheckLib.pm" => "\$(INST_LIB)/FFI/CheckLib.pm" }, "PREREQ_PM" => {}, "TEST_REQUIRES" => { "Test2::API" => "1.302015", "Test2::Mock" => "0.000060", "Test2::Require::Module" => "0.000060", "Test2::V0" => "0.000060" }, "VERSION" => "0.18", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Test2::API" => "1.302015", "Test2::Mock" => "0.000060", "Test2::Require::Module" => "0.000060", "Test2::V0" => "0.000060" ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs);FFI-CheckLib-0.18/xt/0000755000175000017500000000000013174114423013507 5ustar ollisgollisgFFI-CheckLib-0.18/xt/release/0000755000175000017500000000000013174114423015127 5ustar ollisgollisgFFI-CheckLib-0.18/xt/release/fixme.t0000644000175000017500000000062013174114423016422 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Fixme' unless eval q{ use Test::Fixme 0.14; 1 }; }; use Test::Fixme 0.07; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); run_tests( match => qr/FIXME/, where => [ grep { -e $_ } qw( bin lib t Makefile.PL Build.PL )], warn => 1, ); FFI-CheckLib-0.18/xt/release/changes.t0000644000175000017500000000111513174114423016722 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::CPAN::Changes' unless eval q{ use Test::CPAN::Changes; 1 }; }; use Test::CPAN::Changes; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); do { my $old = \&Test::Builder::carp; my $new = sub { my($self, @messages) = @_; return if $messages[0] =~ /^Date ".*" is not in the recommend format/; $old->($self, @messages); }; no warnings 'redefine'; *Test::Builder::carp = $new; }; changes_file_ok; done_testing; FFI-CheckLib-0.18/xt/author/0000755000175000017500000000000013174114423015011 5ustar ollisgollisgFFI-CheckLib-0.18/xt/author/no_tabs.t0000644000175000017500000000052413174114423016624 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::NoTabs' unless eval q{ use Test::NoTabs; 1 }; }; use Test::NoTabs; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL )); FFI-CheckLib-0.18/xt/author/pod_spelling_common.t0000644000175000017500000000135213174114423021226 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Pod::Spelling::CommonMistakes' unless eval q{ use Test::Pod::Spelling::CommonMistakes; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML qw( LoadFile ); 1 }; }; use Test::Pod::Spelling::CommonMistakes; use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; plan skip_all => 'disabled' if $config->{pod_spelling_common}->{skip}; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); # TODO: test files in bin too. all_pod_files_ok; FFI-CheckLib-0.18/xt/author/pod_coverage.t0000644000175000017500000000363013174114423017635 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires 5.010 or better' unless $] >= 5.010; plan skip_all => 'test requires Test::Pod::Coverage' unless eval q{ use Test::Pod::Coverage; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1; }; }; use Test::Pod::Coverage; use YAML qw( LoadFile ); use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; plan skip_all => 'disabled' if $config->{pod_coverage}->{skip}; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); my @private_classes; my %private_methods; push @{ $config->{pod_coverage}->{private} }, 'Alien::.*::Install::Files#Inline'; foreach my $private (@{ $config->{pod_coverage}->{private} }) { my($class,$method) = split /#/, $private; if(defined $class && $class ne '') { my $regex = eval 'qr{^' . $class . '$}'; if(defined $method && $method ne '') { push @private_classes, { regex => $regex, method => $method }; } else { push @private_classes, { regex => $regex, all => 1 }; } } elsif(defined $method && $method ne '') { $private_methods{$_} = 1 for split /,/, $method; } } my @classes = all_modules; plan tests => scalar @classes; foreach my $class (@classes) { SKIP: { my($is_private_class) = map { 1 } grep { $class =~ $_->{regex} && $_->{all} } @private_classes; skip "private class: $class", 1 if $is_private_class; my %methods = map {; $_ => 1 } map { split /,/, $_->{method} } grep { $class =~ $_->{regex} } @private_classes; $methods{$_} = 1 for keys %private_methods; my $also_private = eval 'qr{^' . join('|', keys %methods ) . '$}'; pod_coverage_ok $class, { also_private => [$also_private] }; }; } FFI-CheckLib-0.18/xt/author/strict.t0000644000175000017500000000103313174114423016503 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Strict' unless eval q{ use Test::Strict; 1 }; }; use Test::Strict; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); unshift @Test::Strict::MODULES_ENABLING_STRICT, 'ozo', 'Test2::Bundle::SIPS', 'Test2::V0', 'Test2::Bundle::Extended'; note "enabling strict = $_" for @Test::Strict::MODULES_ENABLING_STRICT; all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL )); FFI-CheckLib-0.18/xt/author/eol.t0000644000175000017500000000051213174114423015753 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::EOL' unless eval q{ use Test::EOL; 1 }; }; use Test::EOL; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); all_perl_files_ok(grep { -e $_ } qw( bin lib t Makefile.PL )); FFI-CheckLib-0.18/xt/author/version.t0000644000175000017500000000214413174114423016664 0ustar ollisgollisguse strict; use warnings; use Test::More; use FindBin (); BEGIN { plan skip_all => "test requires Test::Version 2.00" unless eval q{ use Test::Version 2.00 qw( version_all_ok ), { has_version => 1, filename_match => sub { $_[0] !~ m{/(ConfigData|Install/Files)\.pm$} }, }; 1 }; plan skip_all => "test requires Path::Class" unless eval q{ use Path::Class qw( file dir ); 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1; }; } use YAML qw( LoadFile ); use FindBin; use File::Spec; plan skip_all => "test not built yet (run dzil test)" unless -e dir( $FindBin::Bin)->parent->parent->file('Makefile.PL') || -e dir( $FindBin::Bin)->parent->parent->file('Build.PL'); my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; if($config->{version}->{dir}) { note "using dir " . $config->{version}->{dir} } version_all_ok($config->{version}->{dir} ? ($config->{version}->{dir}) : ()); done_testing; FFI-CheckLib-0.18/xt/author/pod_spelling_system.t0000644000175000017500000000237213174114423021265 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Spelling' unless eval q{ use Test::Spelling; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1; }; }; use Test::Spelling; use YAML qw( LoadFile ); use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip}; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); add_stopwords(@{ $config->{pod_spelling_system}->{stopwords} }); add_stopwords(qw( Plicease stdout stderr stdin subref loopback username os Ollis Mojolicious plicease CPAN reinstall TODO filename filenames login callback callbacks standalone VMS hostname hostnames TCP UDP IP API MSWin32 OpenBSD FreeBSD NetBSD unencrypted WebSocket WebSockets timestamp timestamps poney BackPAN portably RedHat AIX BSD XS FFI perlish optimizations subdirectory RESTful SQLite JavaScript dir plugins munge jQuery namespace PDF PDFs usernames DBI pluggable APIs SSL JSON YAML uncommented Solaris OpenVMS URI URL CGI )); all_pod_files_spelling_ok; FFI-CheckLib-0.18/xt/author/pod.t0000644000175000017500000000047413174114423015765 0ustar ollisgollisguse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Pod' unless eval q{ use Test::Pod; 1 }; }; use Test::Pod; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); all_pod_files_ok( grep { -e $_ } qw( bin lib )); FFI-CheckLib-0.18/example/0000755000175000017500000000000013174114423014507 5ustar ollisgollisgFFI-CheckLib-0.18/example/whichdll.pl0000644000175000017500000000041213174114423016637 0ustar ollisgollisguse strict; use warnings; use FFI::CheckLib; my($name) = shift @ARGV; unless(defined $name) { print STDERR "usage: $0 name\n"; } my($path) = find_lib( lib => $name ); if($path) { print "$path\n"; exit 0; } else { print STDERR "not found.\n"; exit 2; } FFI-CheckLib-0.18/example/wheredll.pl0000644000175000017500000000046113174114423016653 0ustar ollisgollisguse strict; use warnings; use FFI::CheckLib; my($name) = shift @ARGV; unless(defined $name) { print STDERR "usage: $0 name\n"; } my(@path) = find_lib( lib => '*', verify => sub { $_[0] eq $name } ); if(@path) { print "$_\n" for @path; exit 0; } else { print STDERR "not found.\n"; exit 2; } FFI-CheckLib-0.18/corpus/0000755000175000017500000000000013174114423014367 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/cygwin/0000755000175000017500000000000013174114423015667 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/cygwin/bin/0000755000175000017500000000000013174114423016437 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/cygwin/bin/cygapatosaurus-0.dll0000644000175000017500000000010613174114423022340 0ustar ollisgollisgapatosaurus 1.2.3 apatosaurus_init apatosaurus_new apatosaurus_delete FFI-CheckLib-0.18/corpus/cygwin/bin/cygdinosaur.dll0000644000175000017500000000007213174114423021462 0ustar ollisgollisgdinosaur 1.2.3 dinosaur_init dinosaur_new dinosaur_delete FFI-CheckLib-0.18/corpus/generic.dll0000644000175000017500000000003213174114423016473 0ustar ollisgollisggeneric 1.2.3 foo bar baz FFI-CheckLib-0.18/corpus/unix/0000755000175000017500000000000013174114423015352 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/lib/0000755000175000017500000000000013174114423016120 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/lib/libfoo.so.20000644000175000017500000000001213174114423020066 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/unix/lib/libfoo.so.2.3.40000644000175000017500000000001213174114423020371 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/unix/lib/libfoo.so.2.30000644000175000017500000000001213174114423020227 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/unix/lib/libfoo.so0000644000175000017500000000001213174114423017726 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/unix/usr/0000755000175000017500000000000013174114423016163 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/usr/lib/0000755000175000017500000000000013174114423016731 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/usr/lib/libcrypto.so.0.9.80000644000175000017500000000003613174114423021755 0ustar ollisgollisgcrypto 0.9.8 _OpenSSL_VERSION FFI-CheckLib-0.18/corpus/unix/usr/lib/libfoo.so.10000644000175000017500000000004613174114423020705 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/unix/usr/lib/libfoo.so0000644000175000017500000000004613174114423020546 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/unix/usr/lib/libxor.so.10000644000175000017500000000001613174114423020727 0ustar ollisgollisgxor 1.2.3 ben FFI-CheckLib-0.18/corpus/unix/usr/lib/libxor.so0000644000175000017500000000001613174114423020570 0ustar ollisgollisgxor 1.2.3 ben FFI-CheckLib-0.18/corpus/unix/usr/lib/libxor.so.1.2.40000644000175000017500000000001613174114423021231 0ustar ollisgollisgxor 1.2.3 ben FFI-CheckLib-0.18/corpus/unix/usr/lib/libxor.so.1.20000644000175000017500000000001613174114423021067 0ustar ollisgollisgxor 1.2.3 ben FFI-CheckLib-0.18/corpus/unix/usr/lib/libfoo.so.1.2.30000644000175000017500000000004613174114423021206 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/unix/usr/lib/libbar.so.1.20000644000175000017500000000001213174114423021017 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/unix/usr/lib/libcrypto.so.1.0.00000644000175000017500000000003613174114423021735 0ustar ollisgollisgcrypto 1.0.0 PEM_read_bio_CMS FFI-CheckLib-0.18/corpus/unix/usr/lib/libfoo.a0000644000175000017500000000000413174114423020337 0ustar ollisgollisgbad FFI-CheckLib-0.18/corpus/unix/usr/lib/libbar.so.10000644000175000017500000000001213174114423020657 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/unix/usr/lib/libfoo.so.1.20000644000175000017500000000004613174114423021045 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/unix/usr/lib/libxor.so.1.2.30000644000175000017500000000002013174114423021223 0ustar ollisgollisgxor 1.2.3 roger FFI-CheckLib-0.18/corpus/unix/usr/lib/libbar.so0000644000175000017500000000001213174114423020520 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/unix/usr/lib/libbar.so.1.2.30000644000175000017500000000001213174114423021160 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/unix/foo-1.00/0000755000175000017500000000000013174114423016511 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/foo-1.00/src/0000755000175000017500000000000013174114423017300 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/foo-1.00/src/libs/0000755000175000017500000000000013174114423020231 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/foo-1.00/src/libs/libfoo.so0000644000175000017500000000000013174114423022034 0ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/foo-1.00/src/libs/libbaz.so0000644000175000017500000000000013174114423022025 0ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/foo-1.00/src/libs/libbar.so0000644000175000017500000000000013174114423022015 0ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/custom/0000755000175000017500000000000013174114423016664 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/unix/custom/libfoo.so0000644000175000017500000000001313174114423020473 0ustar ollisgollisgfoo 1.2.3a FFI-CheckLib-0.18/corpus/windows/0000755000175000017500000000000013174114423016061 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/windows/bin/0000755000175000017500000000000013174114423016631 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/windows/bin/dinosaur.dll0000644000175000017500000000007213174114423021151 0ustar ollisgollisgdinosaur 1.2.3 dinosaur_init dinosaur_new dinosaur_delete FFI-CheckLib-0.18/corpus/windows/bin/libapatosaurus-0.dll0000644000175000017500000000010613174114423022516 0ustar ollisgollisgapatosaurus 1.2.3 apatosaurus_init apatosaurus_new apatosaurus_delete FFI-CheckLib-0.18/corpus/darwin/0000755000175000017500000000000013174114423015653 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/lib/0000755000175000017500000000000013174114423016421 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/lib/libfoo.dylib.20000644000175000017500000000001213174114423021051 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/darwin/lib/libfoo.dylib.2.30000644000175000017500000000001213174114423021212 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/darwin/lib/libfoo.dylib.2.3.40000644000175000017500000000001213174114423021354 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/darwin/lib/libfoo.dylib0000644000175000017500000000001213174114423020711 0ustar ollisgollisgfoo 2.3.4 FFI-CheckLib-0.18/corpus/darwin/usr/0000755000175000017500000000000013174114423016464 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/usr/lib/0000755000175000017500000000000013174114423017232 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/usr/lib/libfoo.dylib.1.2.30000644000175000017500000000004613174114423022171 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/darwin/usr/lib/libfoo.dylib.1.20000644000175000017500000000004613174114423022030 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/darwin/usr/lib/libbar.dylib.10000644000175000017500000000001213174114423021642 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/darwin/usr/lib/libbar.dylib.1.20000644000175000017500000000001213174114423022002 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/darwin/usr/lib/libfoo.dylib.10000644000175000017500000000004613174114423021670 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/darwin/usr/lib/libbar.dylib.1.2.30000644000175000017500000000001213174114423022143 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/darwin/usr/lib/libbar.dylib0000644000175000017500000000001213174114423021503 0ustar ollisgollisgbar 1.2.3 FFI-CheckLib-0.18/corpus/darwin/usr/lib/libfoo.a0000644000175000017500000000000413174114423020640 0ustar ollisgollisgbad FFI-CheckLib-0.18/corpus/darwin/usr/lib/libfoo.dylib0000644000175000017500000000004613174114423021531 0ustar ollisgollisgfoo 1.2.3 foo_init foo_new foo_delete FFI-CheckLib-0.18/corpus/darwin/foo-1.00/0000755000175000017500000000000013174114423017012 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/foo-1.00/src/0000755000175000017500000000000013174114423017601 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/foo-1.00/src/libs/0000755000175000017500000000000013174114423020532 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/foo-1.00/src/libs/libbaz.dylib0000644000175000017500000000000013174114423023010 0ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/foo-1.00/src/libs/libbar.dylib0000644000175000017500000000000013174114423023000 0ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/foo-1.00/src/libs/libfoo.dylib0000644000175000017500000000000013174114423023017 0ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/custom/0000755000175000017500000000000013174114423017165 5ustar ollisgollisgFFI-CheckLib-0.18/corpus/darwin/custom/libfoo.dylib0000644000175000017500000000001313174114423021456 0ustar ollisgollisgfoo 1.2.3a FFI-CheckLib-0.18/META.yml0000644000175000017500000000171013174114423014324 0ustar ollisgollisg--- abstract: 'Check that a library is available for FFI' author: - 'Graham Ollis ' build_requires: Test2::API: '1.302015' Test2::Mock: '0.000060' Test2::Require::Module: '0.000060' Test2::V0: '0.000060' perl: '5.006' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.006' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: FFI-CheckLib requires: perl: '5.006' resources: IRC: irc://irc.perl.org/#native bugtracker: https://github.com/plicease/FFI-CheckLib/issues homepage: https://metacpan.org/pod/FFI::CheckLib repository: git://github.com/plicease/FFI-CheckLib.git version: '0.18' x_contributors: - 'Graham Ollis ' - 'Bakkiaraj Murugesan (bakkiaraj)' - 'Dan Book (grinnz, DBOOK)' x_serialization_backend: 'YAML::Tiny version 1.70' FFI-CheckLib-0.18/dist.ini0000644000175000017500000000144413174114423014523 0ustar ollisgollisgname = FFI-CheckLib author = Graham Ollis license = Perl_5 copyright_holder = Graham Ollis copyright_year = 2014 version = 0.18 [@Author::Plicease] :version = 2.23 travis_status = 1 release_tests = 1 irc = irc://irc.perl.org/#native test2_v0 = 1 diag = +Test::Exit diag = +DynaLoader [RemovePrereqs] remove = strict remove = warnings remove = constant remove = lib remove = base remove = Env remove = Carp remove = Exporter remove = File::Spec remove = File::Basename remove = DynaLoader remove = Test::Exit [Author::Plicease::Upload] cpan = 1 [Author::Plicease::Thanks] current = Graham Ollis contributor = Bakkiaraj Murugesan (bakkiaraj) contributor = Dan Book (grinnz, DBOOK) FFI-CheckLib-0.18/META.json0000644000175000017500000000406213174114423014477 0ustar ollisgollisg{ "abstract" : "Check that a library is available for FFI", "author" : [ "Graham Ollis " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "FFI-CheckLib", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "perl" : "5.006" } }, "develop" : { "requires" : { "FindBin" : "0", "Test::CPAN::Changes" : "0", "Test::EOL" : "0", "Test::Fixme" : "0.07", "Test::More" : "0.94", "Test::NoTabs" : "0", "Test::Pod" : "0", "Test::Pod::Coverage" : "0", "Test::Pod::Spelling::CommonMistakes" : "0", "Test::Spelling" : "0", "Test::Strict" : "0", "YAML" : "0" } }, "runtime" : { "requires" : { "perl" : "5.006" } }, "test" : { "requires" : { "Test2::API" : "1.302015", "Test2::Mock" : "0.000060", "Test2::Require::Module" : "0.000060", "Test2::V0" : "0.000060", "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/plicease/FFI-CheckLib/issues" }, "homepage" : "https://metacpan.org/pod/FFI::CheckLib", "repository" : { "type" : "git", "url" : "git://github.com/plicease/FFI-CheckLib.git", "web" : "https://github.com/plicease/FFI-CheckLib" }, "x_IRC" : "irc://irc.perl.org/#native" }, "version" : "0.18", "x_contributors" : [ "Graham Ollis ", "Bakkiaraj Murugesan (bakkiaraj)", "Dan Book (grinnz, DBOOK)" ], "x_serialization_backend" : "Cpanel::JSON::XS version 3.0239" } FFI-CheckLib-0.18/README0000644000175000017500000001244013174114423013735 0ustar ollisgollisgNAME FFI::CheckLib - Check that a library is available for FFI VERSION version 0.18 SYNOPSIS use FFI::CheckLib; check_lib_or_exit( lib => 'jpeg', symbol => 'jinit_memory_mgr' ); check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] ); # or prompt for path to library and then: print "where to find jpeg library: "; my $path = ; check_lib_or_exit( lib => 'jpeg', libpath => $path ); DESCRIPTION This module checks whether a particular dynamic library is available for FFI to use. It is modeled heavily on Devel::CheckLib, but will find dynamic libraries even when development packages are not installed. It also provides a find_lib function that will return the full path to the found dynamic library, which can be feed directly into FFI::Platypus or FFI::Raw. Although intended mainly for FFI modules via FFI::Platypus and similar, this module does not actually use any FFI to do its detection and probing. This module does not have any non-core runtime dependencies. The test suite does depend on Test2::Suite. FUNCTIONS All of these take the same named parameters and are exported by default. find_lib my(@libs) = find_lib(%args); This will return a list of dynamic libraries, or empty list if none were found. [version 0.05] If called in scalar context it will return the first library found. Arguments are key value pairs with these keys: lib Must be either a string with the name of a single library or a reference to an array of strings of library names. Depending on your platform, CheckLib will prepend lib or append .dll or .so when searching. [version 0.11] As a special case, if * is specified then any libs found will match. libpath A string or array of additional paths to search for libraries. systempath [version 0.11] A string or array of system paths to search for instead of letting FFI::CheckLib determine the system path. You can set this to [] in order to not search any system paths. symbol A string or a list of symbol names that must be found. verify A code reference used to verify a library really is the one that you want. It should take two arguments, which is the name of the library and the full path to the library pathname. It should return true if it is acceptable, and false otherwise. You can use this in conjunction with FFI::Platypus to determine if it is going to meet your needs. Example: use FFI::CheckLib; use FFI::Platypus; my($lib) = find_lib( name => 'foo', verify => sub { my($name, $libpath) = @_; my $ffi = FFI::Platypus->new; $ffi->lib($libpath); my $f = $ffi->function('foo_version', [] => 'int'); return $f->call() >= 500; # we accept version 500 or better }, ); recursive [version 0.11] Recursively search for libraries in any non-system paths (those provided via libpath above). assert_lib assert_lib(%args); This behaves exactly the same as find_lib, except that instead of returning empty list of failure it throws an exception. check_lib_or_exit check_lib_or_exit(%args); This behaves exactly the same as assert_lib, except that instead of dying, it warns (with exactly the same error message) and exists. This is intended for use in Makefile.PL or Build.PL find_lib_or_exit [version 0.05] my(@libs) = find_lib_or_exit(%args); This behaves exactly the same as find_lib, except that if the library is not found, it will call exit with an appropriate diagnostic. find_lib_or_die [version 0.06] my(@libs) = find_lib_or_die(%args); This behaves exactly the same as find_lib, except that if the library is not found, it will die with an appropriate diagnostic. check_lib my $bool = check_lib(%args); This behaves exactly the same as find_lib, except that it returns true (1) on finding the appropriate libraries or false (0) otherwise. which [version 0.17] my $path = where($name); Return the path to the first library that matches the given name. Not exported by default. where [version 0.17] my @paths = where($name); Return the paths to all the libraries that match the given name. Not exported by default. has_symbols [version 0.17] my $bool = has_symbols($path, @symbol_names); Returns true if all of the symbols can be found in the dynamic library located at the given path. Can be useful in conjunction with verify with find_lib above. Not exported by default. SEE ALSO FFI::Platypus Call library functions dynamically without a compiler. Dist::Zilla::Plugin::FFI::CheckLib Dist::Zilla plugin for this module. AUTHOR Author: Graham Ollis Contributors: Bakkiaraj Murugesan (bakkiaraj) Dan Book (grinnz, DBOOK) COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Graham Ollis. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. FFI-CheckLib-0.18/MANIFEST0000644000175000017500000000450313174114423014207 0ustar ollisgollisg# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.010. Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README author.yml corpus/cygwin/bin/cygapatosaurus-0.dll corpus/cygwin/bin/cygdinosaur.dll corpus/darwin/custom/libfoo.dylib corpus/darwin/foo-1.00/src/libs/libbar.dylib corpus/darwin/foo-1.00/src/libs/libbaz.dylib corpus/darwin/foo-1.00/src/libs/libfoo.dylib corpus/darwin/lib/libfoo.dylib corpus/darwin/lib/libfoo.dylib.2 corpus/darwin/lib/libfoo.dylib.2.3 corpus/darwin/lib/libfoo.dylib.2.3.4 corpus/darwin/usr/lib/libbar.dylib corpus/darwin/usr/lib/libbar.dylib.1 corpus/darwin/usr/lib/libbar.dylib.1.2 corpus/darwin/usr/lib/libbar.dylib.1.2.3 corpus/darwin/usr/lib/libfoo.a corpus/darwin/usr/lib/libfoo.dylib corpus/darwin/usr/lib/libfoo.dylib.1 corpus/darwin/usr/lib/libfoo.dylib.1.2 corpus/darwin/usr/lib/libfoo.dylib.1.2.3 corpus/generic.dll corpus/unix/custom/libfoo.so corpus/unix/foo-1.00/src/libs/libbar.so corpus/unix/foo-1.00/src/libs/libbaz.so corpus/unix/foo-1.00/src/libs/libfoo.so corpus/unix/lib/libfoo.so corpus/unix/lib/libfoo.so.2 corpus/unix/lib/libfoo.so.2.3 corpus/unix/lib/libfoo.so.2.3.4 corpus/unix/usr/lib/libbar.so corpus/unix/usr/lib/libbar.so.1 corpus/unix/usr/lib/libbar.so.1.2 corpus/unix/usr/lib/libbar.so.1.2.3 corpus/unix/usr/lib/libcrypto.so.0.9.8 corpus/unix/usr/lib/libcrypto.so.1.0.0 corpus/unix/usr/lib/libfoo.a corpus/unix/usr/lib/libfoo.so corpus/unix/usr/lib/libfoo.so.1 corpus/unix/usr/lib/libfoo.so.1.2 corpus/unix/usr/lib/libfoo.so.1.2.3 corpus/unix/usr/lib/libxor.so corpus/unix/usr/lib/libxor.so.1 corpus/unix/usr/lib/libxor.so.1.2 corpus/unix/usr/lib/libxor.so.1.2.3 corpus/unix/usr/lib/libxor.so.1.2.4 corpus/windows/bin/dinosaur.dll corpus/windows/bin/libapatosaurus-0.dll dist.ini example/wheredll.pl example/whichdll.pl lib/FFI/CheckLib.pm t/00_diag.t t/ffi_checklib.t t/ffi_checklib__exit.t t/ffi_checklib__os_cygwin.t t/ffi_checklib__os_darwin.t t/ffi_checklib__os_mswin32.t t/ffi_checklib__os_msys.t t/ffi_checklib__os_unix.t t/ffi_checklib__travis.t t/lib/Test2/Plugin/FauxOS.pm t/lib/Test2/Tools/FauxDynaLoader.pm t/lib/Test2/Tools/NoteStderr.pm xt/author/eol.t xt/author/no_tabs.t xt/author/pod.t xt/author/pod_coverage.t xt/author/pod_spelling_common.t xt/author/pod_spelling_system.t xt/author/strict.t xt/author/version.t xt/release/changes.t xt/release/fixme.t FFI-CheckLib-0.18/LICENSE0000644000175000017500000004365513174114423014076 0ustar ollisgollisgThis software is copyright (c) 2014 by Graham Ollis. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Graham Ollis. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Graham Ollis. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End FFI-CheckLib-0.18/t/0000755000175000017500000000000013174114423013317 5ustar ollisgollisgFFI-CheckLib-0.18/t/lib/0000755000175000017500000000000013174114423014065 5ustar ollisgollisgFFI-CheckLib-0.18/t/lib/Test2/0000755000175000017500000000000013174114423015066 5ustar ollisgollisgFFI-CheckLib-0.18/t/lib/Test2/Tools/0000755000175000017500000000000013174114423016166 5ustar ollisgollisgFFI-CheckLib-0.18/t/lib/Test2/Tools/NoteStderr.pm0000644000175000017500000000104413174114423020614 0ustar ollisgollisgpackage Test2::Tools::NoteStderr; use strict; use warnings; use Test2::API qw( context ); use base qw( Exporter ); our @EXPORT_OK = qw( note_stderr ); BEGIN { eval q{ use Capture::Tiny qw( capture_stderr ); }; if($@) { eval q{ sub capture_stderr (&) { $_[0]->() }; }; } } sub note_stderr (&) { my($code) = @_; my($stderr, $exception) = capture_stderr { eval { $code->(); }; $@; }; my $ctx = context(); $ctx->note($stderr); $ctx->release; die $exception if $exception; return; } 1; FFI-CheckLib-0.18/t/lib/Test2/Tools/FauxDynaLoader.pm0000644000175000017500000000243513174114423021376 0ustar ollisgollisgpackage Test2::Tools::FauxDynaLoader; use strict; use warnings; use Test2::Mock; use DynaLoader; use base qw( Exporter ); our @EXPORT = qw( mock_dynaloader ); sub mock_dynaloader { my @libref = ('null'); my $mock = Test2::Mock->new( class => 'DynaLoader', ); $mock->override(dl_load_file => sub { my($filename, $flags) = @_; return undef unless -e $filename; my $libref = scalar @libref; $libref[$libref] = TestDLL->new($filename); $libref; }); $mock->override(dl_unload_file => sub { my($libref) = @_; delete $libref[$libref]; }); $mock->override(dl_find_symbol => sub { my($libref, $symbol) = @_; my $lib = $libref[$libref]; $lib->has_symbol($symbol); }); $mock; } package TestDLL; sub new { my($class, $filename) = @_; my @list = do { my $fh; open $fh, '<', $filename; my @list = <$fh>; close $fh; @list; }; chomp @list; my $name = shift @list; my $version = shift @list; my %symbols = map { $_ => 1 } @list; bless { filename => $filename, name => $name, version => $version, symbols => \%symbols, }, $class; } sub filename { shift->{filename} } sub name { shift->{name} } sub version { shift->{version} } sub has_symbol { $_[0]->{symbols}->{$_[1]} } 1; FFI-CheckLib-0.18/t/lib/Test2/Plugin/0000755000175000017500000000000013174114423016324 5ustar ollisgollisgFFI-CheckLib-0.18/t/lib/Test2/Plugin/FauxOS.pm0000644000175000017500000000063213174114423020030 0ustar ollisgollisgpackage Test2::Plugin::FauxOS; use strict; use warnings; use Test2::API qw/test2_add_callback_exit/; sub import { my(undef, $os) = @_; die "you must use Test2::Plugin::FauxOS prior to FFI::CheckLib" if $INC{'FFI/CheckLib.pm'}; $FFI::CheckLib::os = $os; test2_add_callback_exit(sub { my ($ctx, $real, $new) = @_; $ctx->note("faux os: $os"); $ctx->note("real os: $^O"); }); } 1; FFI-CheckLib-0.18/t/ffi_checklib__travis.t0000644000175000017500000000136613174114423017631 0ustar ollisgollisguse Test2::V0 -no_srand => 1; use FFI::CheckLib qw( find_lib has_symbols ); skip_all 'only run under travis-ci' unless defined $ENV{TRAVIS} && $ENV{TRAVIS} eq 'true' && defined $ENV{TRAVIS_REPO_SLUG} && $ENV{TRAVIS_REPO_SLUG} =~ /\/FFI-CheckLib$/; diag ''; diag ''; diag ''; diag "$_ = $ENV{$_}" for sort grep /TRAVIS/, keys %ENV; diag ''; diag ''; diag "libssl=$_" for find_lib( lib => '*', verify => sub { $_[0] eq 'ssl' }); diag ''; diag ''; is( find_lib( lib => 'crypto', symbol => 'PEM_read_bio_CMS', ), T(), ); is( has_symbols('/lib/x86_64-linux-gnu/libssl.so.0.9.8', 'PEM_read_bio_CMS'), F(), ); is( has_symbols('/lib/x86_64-linux-gnu/libssl.so.1.0.0', 'PEM_read_bio_CMS'), T(), ); done_testing; FFI-CheckLib-0.18/t/ffi_checklib__os_darwin.t0000644000175000017500000001304613174114423020304 0ustar ollisgollisguse lib 't/lib'; use Test2::V0 -no_srand => 1; use Test2::Plugin::FauxOS 'darwin'; use Test2::Tools::FauxDynaLoader; use Test2::Tools::NoteStderr qw( note_stderr ); use FFI::CheckLib; @$FFI::CheckLib::system_path = ( 'corpus/darwin/usr/lib', 'corpus/darwin/lib', ); my $mock = mock_dynaloader; subtest 'find_lib (good)' => sub { my($path) = find_lib( lib => 'foo' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'foo' ); is $path, $path2, 'scalar context'; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib (fail)' => sub { my @path = find_lib( lib => 'foobar' ); ok @path == 0, 'libfoobar not found'; }; subtest 'find_lib list' => sub { my @path = find_lib( lib => [ 'foo', 'bar' ] ); ok -r $path[0], "path[0] = $path[0] is readable"; ok -r $path[1], "path[1] = $path[1] is readable"; subtest foo => sub { my($foo) = grep { $_->name eq 'foo' } map { TestDLL->new($_) } @path; is $foo->name, 'foo', 'dll.name = foo'; is $foo->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest bar => sub { my($bar) = grep { $_->name eq 'bar' } map { TestDLL->new($_) } @path; is $bar->name, 'bar', 'dll.name = bar'; is $bar->version, '1.2.3', 'dll.version = 1.2.3'; }; }; subtest 'find_lib libpath' => sub { my($path) = find_lib( lib => 'foo', libpath => 'corpus/darwin/custom' ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3a', 'dll.version = 1.2.3a'; }; subtest 'find_lib libpath (list)' => sub { my($path) = find_lib( lib => 'foo', libpath => ['corpus/darwin/custom']); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3a', 'dll.version = 1.2.3a'; }; subtest 'find_lib symbol' => sub { my($path) = find_lib( lib => 'foo', symbol => 'foo_init' ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib symbol (bad)' => sub { my @path = find_lib( lib => 'foo', symbol => 'foo_initx' ); ok @path == 0, 'no path found'; }; subtest 'find_lib symbol (list)' => sub { my($path) = find_lib( lib => 'foo', symbol => ['foo_init', 'foo_new', 'foo_delete'] ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib symbol (list) (bad)' => sub { my @path = find_lib( lib => 'foo', symbol => ['foo_init', 'foo_new', 'foo_delete', 'bogus'] ); ok @path == 0, 'no path found'; }; subtest 'assert_lib' => sub { subtest 'found' => sub { eval { assert_lib( lib => 'foo' ) }; is $@, '', 'no exception'; }; subtest 'not found' => sub { eval { assert_lib( lib => 'foobar') }; isnt $@, '', 'exception'; }; }; subtest 'check_lib' => sub { is check_lib( lib => 'foo' ), 1, 'found'; is check_lib( lib => 'foobar'), 0, 'not found'; }; subtest 'verify bad' => sub { my @lib = find_lib( lib => 'foo', verify => sub { 0 }, ); ok @lib == 0, 'returned empty list'; @lib = find_lib( lib => 'foo', verify => [ sub { 0 } ], ); ok @lib == 0, 'returned empty list'; }; subtest 'verify' => sub { my($lib) = find_lib( lib => 'foo', verify => sub { my($name, $path) = @_; my $lib = TestDLL->new($path); $lib->version ne '1.2.3' }, ); ok -r $lib, "path = $lib is readable"; my $dll = TestDLL->new($lib); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '2.3.4', 'dll.version = 2.3.4'; }; sub p ($) { my($path) = @_; $path =~ s{/}{\\}g if $^O eq 'MSWin32'; $path; } subtest '_cmp' => sub { my $process = sub { [ sort { FFI::CheckLib::_cmp($a,$b) } map { FFI::CheckLib::_matches($_, '/lib') } @_ ]; }; is( $process->(qw( libfoo.1.2.3.dylib libbar.3.4.5.dylib libbaz.0.0.0.dylib )), [ [ 'bar', p '/lib/libbar.3.4.5.dylib', 3,4,5 ], [ 'baz', p '/lib/libbaz.0.0.0.dylib', 0,0,0 ], [ 'foo', p '/lib/libfoo.1.2.3.dylib', 1,2,3 ], ], 'name first 1', ); is( $process->(qw( libbaz.0.0.0.dylib libfoo.1.2.3.dylib libbar.3.4.5.dylib )), [ [ 'bar', p '/lib/libbar.3.4.5.dylib', 3,4,5 ], [ 'baz', p '/lib/libbaz.0.0.0.dylib', 0,0,0 ], [ 'foo', p '/lib/libfoo.1.2.3.dylib', 1,2,3 ], ], 'name first 2', ); is( $process->(qw( libbar.3.4.5.dylib libbaz.0.0.0.dylib libfoo.1.2.3.dylib )), [ [ 'bar', p '/lib/libbar.3.4.5.dylib', 3,4,5 ], [ 'baz', p '/lib/libbaz.0.0.0.dylib', 0,0,0 ], [ 'foo', p '/lib/libfoo.1.2.3.dylib', 1,2,3 ], ], 'name first 3', ); is( $process->(qw( libfoo.1.2.3.dylib libfoo.dylib libfoo.1.2.dylib libfoo.1.dylib )), [ [ 'foo', p '/lib/libfoo.dylib', ], [ 'foo', p '/lib/libfoo.1.dylib', 1 ], [ 'foo', p '/lib/libfoo.1.2.dylib', 1,2 ], [ 'foo', p '/lib/libfoo.1.2.3.dylib', 1,2,3 ], ], 'no version before version', ); is( $process->(qw( libfoo.2.3.4.dylib libfoo.1.2.3.dylib libfoo.3.4.5.dylib )), [ [ 'foo', p '/lib/libfoo.3.4.5.dylib', 3,4,5 ], [ 'foo', p '/lib/libfoo.2.3.4.dylib', 2,3,4 ], [ 'foo', p '/lib/libfoo.1.2.3.dylib', 1,2,3 ], ], 'newer version first', ); }; done_testing; FFI-CheckLib-0.18/t/ffi_checklib.t0000644000175000017500000000513213174114423016075 0ustar ollisgollisguse lib 't/lib'; use Test2::V0 -no_srand => 1; use Test2::Mock; use Test2::Plugin::FauxOS 'linux'; use Test2::Tools::FauxDynaLoader; use FFI::CheckLib qw( find_lib which where has_symbols ); subtest 'recursive' => sub { $FFI::CheckLib::system_path = []; my @libs = find_lib( libpath => File::Spec->catdir( 'corpus', 'unix', 'foo-1.00' ), lib => 'foo', recursive => 1, ); is scalar(@libs), 1, "libs = @libs"; like $libs[0], qr{libfoo.so}, "libs[0] = $libs[0]"; }; subtest 'star' => sub { $FFI::CheckLib::system_path = []; my @libs = find_lib( libpath => File::Spec->catdir( 'corpus', 'unix', 'foo-1.00' ), lib => '*', recursive => 1, ); is scalar(@libs), 3, "libs = @libs"; my @fn = sort map { (File::Spec->splitpath($_))[2] } @libs; is \@fn, [qw( libbar.so libbaz.so libfoo.so )], "fn = @fn"; }; subtest 'which' => sub { my %find_lib_args; my $mock = Test2::Mock->new( class => 'FFI::CheckLib', override => [ find_lib => sub { %find_lib_args = @_; my @ret = qw( /usr/lib/libfoo.so.1.2.3 /usr/lib/libbar.so.1.2.3 ); wantarray ? @ret : $ret[0]; }, ], ); is( which('foo'), '/usr/lib/libfoo.so.1.2.3' ); is( \%find_lib_args, hash { field 'lib' => 'foo'; end; } ); }; subtest 'which' => sub { my %find_lib_args; my $mock = Test2::Mock->new( class => 'FFI::CheckLib', override => [ find_lib => sub { %find_lib_args = @_; my @ret = qw( /usr/lib/libfoo.so.1.2.3 /usr/lib/libbar.so.1.2.3 ); wantarray ? @ret : $ret[0]; }, ], ); subtest 'with name' => sub { is( [where('foo')], ['/usr/lib/libfoo.so.1.2.3','/usr/lib/libbar.so.1.2.3'] ); is( \%find_lib_args, hash { field 'lib' => '*'; field 'verify' => T(); end; } ); }; subtest 'with wildcard' => sub { is( [where('*')], ['/usr/lib/libfoo.so.1.2.3','/usr/lib/libbar.so.1.2.3'] ); is( \%find_lib_args, hash { field 'lib' => '*'; end; } ); }; }; subtest 'has_symbols' => sub { my $mock = mock_dynaloader; is( has_symbols('corpus/generic.dll'), T(), ); is( has_symbols('corpus/generic.dll', qw( foo bar baz)), T(), ); is( has_symbols('corpus/generic.dll', qw( foo bar )), T(), ); is( has_symbols('corpus/generic.dll', qw( foo )), T(), ); is( has_symbols('corpus/generic.dll', qw( foo bar baz bogus )), F(), ); is( has_symbols('corpus/generic.dll', qw( bogus )), F(), ); }; done_testing; FFI-CheckLib-0.18/t/ffi_checklib__exit.t0000644000175000017500000000171213174114423017265 0ustar ollisgollisguse lib 't/lib'; use Test2::Require::Module 'Test::Exit'; use Test2::V0 -no_srand => 1; use Test2::Plugin::FauxOS 'linux'; use Test2::Tools::NoteStderr qw( note_stderr ); use Test::Exit; use FFI::CheckLib; @$FFI::CheckLib::system_path = ( 'corpus/unix/usr/lib', 'corpus/unix/lib', ); subtest 'check_lib_or_exit' => sub { subtest 'found' => sub { never_exits_ok { check_lib_or_exit( lib => 'foo' ) }; }; subtest 'not found' => sub { exits_zero { note_stderr { check_lib_or_exit( lib => 'foobar') } }; }; }; subtest 'find_lib_or_exit' => sub { subtest 'found' => sub { my $path; never_exits_ok { $path = find_lib_or_exit( lib => 'foo' ) }; is $@, '', 'no exit'; ok $path, "path = $path"; my $path2 = eval { find_lib_or_exit( lib => 'foo' ) }; is $path, $path2, 'scalar context'; }; subtest 'not found' => sub { exits_zero { note_stderr { find_lib_or_exit( lib => 'foobar') } }; }; }; done_testing; FFI-CheckLib-0.18/t/ffi_checklib__os_unix.t0000644000175000017500000001455013174114423020004 0ustar ollisgollisguse lib 't/lib'; use Test2::V0 -no_srand => 1; use Test2::Plugin::FauxOS 'linux'; use Test2::Tools::FauxDynaLoader; use Test2::Tools::NoteStderr qw( note_stderr ); use FFI::CheckLib; use File::Basename qw( basename ); @$FFI::CheckLib::system_path = ( 'corpus/unix/usr/lib', 'corpus/unix/lib', ); my $mock = mock_dynaloader; subtest 'find_lib (good)' => sub { my($path) = find_lib( lib => 'foo' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'foo' ); is $path, $path2, 'scalar context'; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib (fail)' => sub { my @path = find_lib( lib => 'foobar' ); ok @path == 0, 'libfoobar not found'; }; subtest 'find_lib list' => sub { my @path = find_lib( lib => [ 'foo', 'bar' ] ); ok -r $path[0], "path[0] = $path[0] is readable"; ok -r $path[1], "path[1] = $path[1] is readable"; subtest foo => sub { my($foo) = grep { $_->name eq 'foo' } map { TestDLL->new($_) } @path; is $foo->name, 'foo', 'dll.name = foo'; is $foo->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest bar => sub { my($bar) = grep { $_->name eq 'bar' } map { TestDLL->new($_) } @path; is $bar->name, 'bar', 'dll.name = bar'; is $bar->version, '1.2.3', 'dll.version = 1.2.3'; }; }; subtest 'find_lib libpath' => sub { my($path) = find_lib( lib => 'foo', libpath => 'corpus/unix/custom' ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3a', 'dll.version = 1.2.3a'; }; subtest 'find_lib libpath (list)' => sub { my($path) = find_lib( lib => 'foo', libpath => ['corpus/unix/custom']); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3a', 'dll.version = 1.2.3a'; }; subtest 'find_lib symbol' => sub { my($path) = find_lib( lib => 'foo', symbol => 'foo_init' ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib symbol (bad)' => sub { my @path = find_lib( lib => 'foo', symbol => 'foo_initx' ); ok @path == 0, 'no path found'; }; subtest 'find_lib symbol (list)' => sub { my($path) = find_lib( lib => 'foo', symbol => ['foo_init', 'foo_new', 'foo_delete'] ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib symbol (list) (bad)' => sub { my @path = find_lib( lib => 'foo', symbol => ['foo_init', 'foo_new', 'foo_delete', 'bogus'] ); ok @path == 0, 'no path found'; }; subtest 'assert_lib' => sub { subtest 'found' => sub { eval { assert_lib( lib => 'foo' ) }; is $@, '', 'no exception'; }; subtest 'not found' => sub { eval { assert_lib( lib => 'foobar') }; isnt $@, '', 'exception'; }; }; subtest 'check_lib' => sub { is check_lib( lib => 'foo' ), 1, 'found'; is check_lib( lib => 'foobar'), 0, 'not found'; }; subtest 'verify bad' => sub { my @lib = find_lib( lib => 'foo', verify => sub { 0 }, ); ok @lib == 0, 'returned empty list'; @lib = find_lib( lib => 'foo', verify => [ sub { 0 } ], ); ok @lib == 0, 'returned empty list'; }; subtest 'verify' => sub { my($lib) = find_lib( lib => 'foo', verify => sub { my($name, $path) = @_; my $lib = TestDLL->new($path); $lib->version ne '1.2.3' }, ); ok -r $lib, "path = $lib is readable"; my $dll = TestDLL->new($lib); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '2.3.4', 'dll.version = 2.3.4'; }; subtest 'symlink' => sub { # TODO: this test only gets run out of git, since Dist::Zilla # converts the symlinks into real files :/ skip_all 'Test requires a system with proper symlinks' unless -l 'corpus/unix/usr/lib/libxor.so' && readlink('corpus/unix/usr/lib/libxor.so'); subtest 'multiple versions of the same lib' => sub { my($lib) = find_lib( lib => 'xor', ); is(basename($lib), 'libxor.so.1.2.4'); }; subtest 'broken symlink' => sub { my($lib) = find_lib( lib => 'ganon', ); is($lib, undef); }; subtest 'infinite recurse symlink' => sub { my($lib) = find_lib( lib => 'link', ); is($lib, undef); }; }; subtest 'prefer newer' => sub { my($lib) = find_lib( lib => 'crypto', ); is($lib, T()); is(basename($lib), 'libcrypto.so.1.0.0'); note "lib = $lib"; }; sub p ($) { my($path) = @_; $path =~ s{/}{\\}g if $^O eq 'MSWin32'; $path; } subtest '_cmp' => sub { my $process = sub { [ sort { FFI::CheckLib::_cmp($a,$b) } map { FFI::CheckLib::_matches($_, '/lib') } @_ ]; }; is( $process->(qw( libfoo.so.1.2.3 libbar.so.3.4.5 libbaz.so.0.0.0 )), [ [ 'bar', p '/lib/libbar.so.3.4.5', 3,4,5 ], [ 'baz', p '/lib/libbaz.so.0.0.0', 0,0,0 ], [ 'foo', p '/lib/libfoo.so.1.2.3', 1,2,3 ], ], 'name first 1', ); is( $process->(qw( libbaz.so.0.0.0 libfoo.so.1.2.3 libbar.so.3.4.5 )), [ [ 'bar', p '/lib/libbar.so.3.4.5', 3,4,5 ], [ 'baz', p '/lib/libbaz.so.0.0.0', 0,0,0 ], [ 'foo', p '/lib/libfoo.so.1.2.3', 1,2,3 ], ], 'name first 2', ); is( $process->(qw( libbar.so.3.4.5 libbaz.so.0.0.0 libfoo.so.1.2.3 )), [ [ 'bar', p '/lib/libbar.so.3.4.5', 3,4,5 ], [ 'baz', p '/lib/libbaz.so.0.0.0', 0,0,0 ], [ 'foo', p '/lib/libfoo.so.1.2.3', 1,2,3 ], ], 'name first 3', ); is( $process->(qw( libfoo.so.1.2.3 libfoo.so libfoo.so.1.2 libfoo.so.1 )), [ [ 'foo', p '/lib/libfoo.so', ], [ 'foo', p '/lib/libfoo.so.1', 1 ], [ 'foo', p '/lib/libfoo.so.1.2', 1,2 ], [ 'foo', p '/lib/libfoo.so.1.2.3', 1,2,3 ], ], 'no version before version', ); is( $process->(qw( libfoo.so.2.3.4 libfoo.so.1.2.3 libfoo.so.3.4.5 )), [ [ 'foo', p '/lib/libfoo.so.3.4.5', 3,4,5 ], [ 'foo', p '/lib/libfoo.so.2.3.4', 2,3,4 ], [ 'foo', p '/lib/libfoo.so.1.2.3', 1,2,3 ], ], 'newer version first', ); }; done_testing; FFI-CheckLib-0.18/t/ffi_checklib__os_mswin32.t0000644000175000017500000000411613174114423020320 0ustar ollisgollisguse lib 't/lib'; use Test2::V0 -no_srand => 1; use Test2::Plugin::FauxOS 'MSWin32'; use FFI::CheckLib; use Env qw( @PATH ); @$FFI::CheckLib::system_path = ( 'corpus/windows/bin', ); subtest 'find_lib (good)' => sub { my($path) = find_lib( lib => 'dinosaur' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'dinosaur' ); is $path, $path2, 'scalar context'; }; subtest 'find_lib (fail)' => sub { my @path = find_lib( lib => 'foobar' ); ok @path == 0, 'libfoobar not found'; }; subtest 'find_lib (good) with lib and version' => sub { my($path) = find_lib( lib => 'apatosaurus' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'apatosaurus' ); is $path, $path2, 'scalar context'; }; subtest 'in sync with $ENV{PATH}' => sub { local $ENV{PATH} = $ENV{PATH}; @PATH = qw( foo bar baz ); is( $FFI::CheckLib::system_path, [qw( foo bar baz )], ); }; sub p ($) { my($path) = @_; $path =~ s{/}{\\}g if $^O eq 'MSWin32'; $path; } subtest '_cmp' => sub { my $process = sub { [ sort { FFI::CheckLib::_cmp($a,$b) } map { FFI::CheckLib::_matches($_, 'C:/bin') } @_ ]; }; is( $process->(qw( foo-1.dll bar-2.dll baz-0.dll )), [ [ 'bar', p 'C:/bin/bar-2.dll', 2 ], [ 'baz', p 'C:/bin/baz-0.dll', 0 ], [ 'foo', p 'C:/bin/foo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( baz-0.dll foo-1.dll bar-2.dll )), [ [ 'bar', p 'C:/bin/bar-2.dll', 2 ], [ 'baz', p 'C:/bin/baz-0.dll', 0 ], [ 'foo', p 'C:/bin/foo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( bar-2.dll foo-1.dll baz-0.dll )), [ [ 'bar', p 'C:/bin/bar-2.dll', 2 ], [ 'baz', p 'C:/bin/baz-0.dll', 0 ], [ 'foo', p 'C:/bin/foo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( foo-2.dll foo-0.dll foo-1.dll )), [ [ 'foo', p 'C:/bin/foo-2.dll', 2, ], [ 'foo', p 'C:/bin/foo-1.dll', 1, ], [ 'foo', p 'C:/bin/foo-0.dll', 0, ], ], 'newer version first', ); }; done_testing; FFI-CheckLib-0.18/t/ffi_checklib__os_cygwin.t0000644000175000017500000001272613174114423020324 0ustar ollisgollisguse lib 't/lib'; use Test2::V0 -no_srand => 1; use Test2::Plugin::FauxOS 'cygwin'; use Test2::Tools::FauxDynaLoader; use Test2::Tools::NoteStderr qw( note_stderr ); use FFI::CheckLib; @$FFI::CheckLib::system_path = ( 'corpus/cygwin/bin', 'corpus/unix/usr/lib', 'corpus/unix/lib', ); my $mock = mock_dynaloader; subtest 'find_lib (good)' => sub { my($path) = find_lib( lib => 'dinosaur' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'dinosaur' ); is $path, $path2, 'scalar context'; }; subtest 'find_lib (good) with lib and version' => sub { my($path) = find_lib( lib => 'apatosaurus' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'apatosaurus' ); is $path, $path2, 'scalar context'; }; subtest 'find_lib (good)' => sub { my($path) = find_lib( lib => 'foo' ); ok -r $path, "path = $path is readable"; my $path2 = find_lib( lib => 'foo' ); is $path, $path2, 'scalar context'; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib (fail)' => sub { my @path = find_lib( lib => 'foobar' ); ok @path == 0, 'libfoobar not found'; }; subtest 'find_lib list' => sub { my @path = find_lib( lib => [ 'foo', 'bar' ] ); ok -r $path[0], "path[0] = $path[0] is readable"; ok -r $path[1], "path[1] = $path[1] is readable"; subtest foo => sub { my($foo) = grep { $_->name eq 'foo' } map { TestDLL->new($_) } @path; is $foo->name, 'foo', 'dll.name = foo'; is $foo->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest bar => sub { my($bar) = grep { $_->name eq 'bar' } map { TestDLL->new($_) } @path; is $bar->name, 'bar', 'dll.name = bar'; is $bar->version, '1.2.3', 'dll.version = 1.2.3'; }; }; subtest 'find_lib libpath' => sub { my($path) = find_lib( lib => 'foo', libpath => 'corpus/unix/custom' ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3a', 'dll.version = 1.2.3a'; }; subtest 'find_lib libpath (list)' => sub { my($path) = find_lib( lib => 'foo', libpath => ['corpus/unix/custom']); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3a', 'dll.version = 1.2.3a'; }; subtest 'find_lib symbol' => sub { my($path) = find_lib( lib => 'foo', symbol => 'foo_init' ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib symbol (bad)' => sub { my @path = find_lib( lib => 'foo', symbol => 'foo_initx' ); ok @path == 0, 'no path found'; }; subtest 'find_lib symbol (list)' => sub { my($path) = find_lib( lib => 'foo', symbol => ['foo_init', 'foo_new', 'foo_delete'] ); ok -r $path, "path = $path is readable"; my $dll = TestDLL->new($path); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '1.2.3', 'dll.version = 1.2.3'; }; subtest 'find_lib symbol (list) (bad)' => sub { my @path = find_lib( lib => 'foo', symbol => ['foo_init', 'foo_new', 'foo_delete', 'bogus'] ); ok @path == 0, 'no path found'; }; subtest 'assert_lib' => sub { subtest 'found' => sub { eval { assert_lib( lib => 'foo' ) }; is $@, '', 'no exception'; }; subtest 'not found' => sub { eval { assert_lib( lib => 'foobar') }; isnt $@, '', 'exception'; }; }; subtest 'check_lib' => sub { is check_lib( lib => 'foo' ), 1, 'found'; is check_lib( lib => 'foobar'), 0, 'not found'; }; subtest 'verify bad' => sub { my @lib = find_lib( lib => 'foo', verify => sub { 0 }, ); ok @lib == 0, 'returned empty list'; @lib = find_lib( lib => 'foo', verify => [ sub { 0 } ], ); ok @lib == 0, 'returned empty list'; }; subtest 'verify' => sub { my($lib) = find_lib( lib => 'foo', verify => sub { my($name, $path) = @_; my $lib = TestDLL->new($path); $lib->version ne '1.2.3' }, ); ok -r $lib, "path = $lib is readable"; my $dll = TestDLL->new($lib); is $dll->name, 'foo', 'dll.name = foo'; is $dll->version, '2.3.4', 'dll.version = 2.3.4'; }; sub p ($) { my($path) = @_; $path =~ s{/}{\\}g if $^O eq 'MSWin32'; $path; } subtest '_cmp' => sub { my $process = sub { [ sort { FFI::CheckLib::_cmp($a,$b) } map { FFI::CheckLib::_matches($_, '/bin') } @_ ]; }; is( $process->(qw( cygfoo-1.dll cygbar-2.dll cygbaz-0.dll )), [ [ 'bar', p '/bin/cygbar-2.dll', 2 ], [ 'baz', p '/bin/cygbaz-0.dll', 0 ], [ 'foo', p '/bin/cygfoo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( cygbaz-0.dll cygfoo-1.dll cygbar-2.dll )), [ [ 'bar', p '/bin/cygbar-2.dll', 2 ], [ 'baz', p '/bin/cygbaz-0.dll', 0 ], [ 'foo', p '/bin/cygfoo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( cygbar-2.dll cygfoo-1.dll cygbaz-0.dll )), [ [ 'bar', p '/bin/cygbar-2.dll', 2 ], [ 'baz', p '/bin/cygbaz-0.dll', 0 ], [ 'foo', p '/bin/cygfoo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( cygfoo-2.dll cygfoo-0.dll cygfoo-1.dll )), [ [ 'foo', p '/bin/cygfoo-2.dll', 2, ], [ 'foo', p '/bin/cygfoo-1.dll', 1, ], [ 'foo', p '/bin/cygfoo-0.dll', 0, ], ], 'newer version first', ); }; done_testing; FFI-CheckLib-0.18/t/ffi_checklib__os_msys.t0000644000175000017500000000253713174114423020016 0ustar ollisgollisguse lib 't/lib'; use Test2::V0 -no_srand => 1; use Test2::Plugin::FauxOS 'msys'; use FFI::CheckLib; sub p ($) { my($path) = @_; $path =~ s{/}{\\}g if $^O eq 'MSWin32'; $path; } subtest '_cmp' => sub { my $process = sub { [ sort { FFI::CheckLib::_cmp($a,$b) } map { FFI::CheckLib::_matches($_, '/bin') } @_ ]; }; is( $process->(qw( msys-foo-1.dll msys-bar-2.dll msys-baz-0.dll )), [ [ 'bar', p '/bin/msys-bar-2.dll', 2 ], [ 'baz', p '/bin/msys-baz-0.dll', 0 ], [ 'foo', p '/bin/msys-foo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( msys-baz-0.dll msys-foo-1.dll msys-bar-2.dll )), [ [ 'bar', p '/bin/msys-bar-2.dll', 2 ], [ 'baz', p '/bin/msys-baz-0.dll', 0 ], [ 'foo', p '/bin/msys-foo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( msys-bar-2.dll msys-foo-1.dll msys-baz-0.dll )), [ [ 'bar', p '/bin/msys-bar-2.dll', 2 ], [ 'baz', p '/bin/msys-baz-0.dll', 0 ], [ 'foo', p '/bin/msys-foo-1.dll', 1 ], ], 'name first 1', ); is( $process->(qw( msys-foo-2.dll msys-foo-0.dll msys-foo-1.dll )), [ [ 'foo', p '/bin/msys-foo-2.dll', 2, ], [ 'foo', p '/bin/msys-foo-1.dll', 1, ], [ 'foo', p '/bin/msys-foo-0.dll', 0, ], ], 'newer version first', ); }; done_testing; FFI-CheckLib-0.18/t/00_diag.t0000644000175000017500000000242713174114423014714 0ustar ollisgollisguse Test2::V0 -no_srand => 1; use Config; eval q{ require Test::More }; # This .t file is generated. # make changes instead to dist.ini my %modules; my $post_diag; $modules{$_} = $_ for qw( DynaLoader ExtUtils::MakeMaker Test2::API Test2::Mock Test2::Require::Module Test2::V0 Test::Exit ); my @modules = sort keys %modules; sub spacer () { diag ''; diag ''; diag ''; } pass 'okay'; my $max = 1; $max = $_ > $max ? $_ : $max for map { length $_ } @modules; our $format = "%-${max}s %s"; spacer; my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV; if(@keys > 0) { diag "$_=$ENV{$_}" for @keys; if($ENV{PERL5LIB}) { spacer; diag "PERL5LIB path"; diag $_ for split $Config{path_sep}, $ENV{PERL5LIB}; } elsif($ENV{PERLLIB}) { spacer; diag "PERLLIB path"; diag $_ for split $Config{path_sep}, $ENV{PERLLIB}; } spacer; } diag sprintf $format, 'perl ', $]; foreach my $module (sort @modules) { if(eval qq{ require $module; 1 }) { my $ver = eval qq{ \$$module\::VERSION }; $ver = 'undef' unless defined $ver; diag sprintf $format, $module, $ver; } else { diag sprintf $format, $module, '-'; } } if($post_diag) { spacer; $post_diag->(); } spacer; done_testing; FFI-CheckLib-0.18/Changes0000644000175000017500000000602413174114423014351 0ustar ollisgollisgRevision history for FFI-CheckLib 0.18 2017-10-25 10:00:47 -0400 - Production version identical to 0.17_02 0.17_02 2017-10-14 01:03:04 -0400 - Fix Windows testing regression introduced in 0.17_01 0.17_01 2017-10-13 15:58:30 -0400 - Filter out broken and recursive symlinks - Better handle symlinked .so files on platforms that support that. Previously, we preferred the longer .so names (ie, libfoo.so.1.2.3) over the shorter .so names (libfoo.so) since the latter is usually a symlink, and the former may have useful "version" information in the filename. That is a problem when a system is using symlinks to indicate a preference, (for example, if there are both libfoo.so.1.2.3, libfoo.so.1.2.4 and libfoo.so is a symlink to one of those). Now we still endevour to return the long .so name, but use the short name to see which one is preferred by the operating system, or user. In the absense of any symlinks to disambiguate two libraries with the same name, we prefer the one with a newer version number. That is libfoo.so.2.3.4 would be preferred over libfoo.so.1.2.3 - Slightly more consistent diagnostic messages. - Added functions: which, where, has_symbols None are exported by default, but may be requested. 0.16 2017-08-08 10:24:49 -0400 - Tentative support for msys 0.15 2016-05-05 19:53:32 -0400 - Add MSYS2 support 0.14 2015-09-09 08:25:15 -0400 - Version identical to 0.12 (0.12 was accidentally removed from CPAN) 0.12 2015-08-06 16:09:32 -0400 - Switch to MakeMaker since we are not using any features that require Module::Build 0.11 2015-02-13 08:45:23 -0500 - New recursive option - The experimental _r option will be keept beiefly then removed - The lib option allows '*' to match any library - New systempath option 0.10 2015-02-12 18:52:54 -0500 - Add experimental and undocumented _r option intended for use with Alien::Base only. 0.09 2015-01-28 17:10:53 -0500 - Skip undef found in system library path. (thanks bakkiaraj gh#3) On Windows this was causing a undef'd variable warning if %PATH% has a trailing ; 0.08 2015-01-25 04:54:37 -0500 - Prefer FFI::Platypus in documentation over FFI::Raw 0.07 2015-01-16 10:22:22 -0500 - bugfix: forgot to export find_lib_or_die 0.06 2015-01-13 12:07:19 -0500 - add function find_lib_or_die 0.05 2015-01-10 17:31:34 -0500 - add function find_lib_or_exit (GH#2) - [API CHANGE] find_lib returns first library found if called in scalar context, instead of the number of libraries found. - better diagnostics for failure (GH#1) 0.04 2015-01-02 11:21:59 -0500 - works with .bundle files on OS X (previously only with .dylib files) 0.03 2014-10-26 16:35:22 -0400 - use DynaLoader for symbol resolution instead of FFI::Raw thus remove dep on FFI::Raw - add verify option 0.02 2014-10-26 13:18:14 -0400 - first release to CPAN 0.01 2014-10-26 11:34:58 -0400 - initial version FFI-CheckLib-0.18/INSTALL0000644000175000017500000000220013174114423014077 0ustar ollisgollisgThis is the Perl distribution FFI-CheckLib. Installing FFI-CheckLib is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm FFI::CheckLib If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan FFI::CheckLib ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, then build it: % perl Makefile.PL % make && make test Then install it: % make install If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib ## Documentation FFI-CheckLib documentation is available as POD. You can run perldoc from a shell to read the documentation: % perldoc FFI::CheckLib