diff --git a/lib/Alien/Base.pm b/lib/Alien/Base.pm index bda33429..0fa5c339 100644 --- a/lib/Alien/Base.pm +++ b/lib/Alien/Base.pm @@ -12,6 +12,7 @@ use Carp; use DynaLoader (); use File::ShareDir (); +use File::Spec; use Scalar::Util qw/blessed/; use Capture::Tiny 0.17 qw/capture_merged/; use Text::ParseWords qw/shellwords/; @@ -194,6 +195,16 @@ sub split_flags_windows { shellwords($line); } +sub dynamic_lib { + my ($class) = @_; + my $dir = File::Spec->catfile($class->dist_dir, 'dynamic'); + return unless -d $dir; + opendir(my $dh, $dir); + my @dlls = grep { /\.so/ || /\.(dylib|dll)$/ } grep !/^\./, readdir $dh; + closedir $dh; + grep { ! -l $_ } map { File::Spec->catfile($dir, $_) } @dlls; +} + 1; __END__ diff --git a/lib/Alien/Base/ModuleBuild/API.pod b/lib/Alien/Base/ModuleBuild/API.pod index dc37feb0..f04318e0 100644 --- a/lib/Alien/Base/ModuleBuild/API.pod +++ b/lib/Alien/Base/ModuleBuild/API.pod @@ -71,6 +71,12 @@ These parameters, if specified, augment the information found by F. A hashref or arrayref of hashrefs defining the repositories used to find and fetch library tarballs (or zipballs etc.). These attributes are used to create C objects (or more likely, subclasses thereof). Which class is created is governed by the C attribute and the C property below. Available attributes are: +=item alien_isolate_dynamic + +[version 0.005] + +If set to true, then dynamic libraries will be moved from the C directory to a separate C directory. This makes them available for FFI modules (see L), while preferring static libraries when creating XS extensions. + =over =item protocol