File Coverage

buildext/Alien/DBD/SQLite/BundledExtensions.pm
Criterion Covered Total %
statement 6 17 35.2
branch 0 4 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 27 29.6


line stmt bran cond sub pod time code
1             package Alien::DBD::SQLite::BundledExtensions;
2              
3 1     1   537 use Config;
  1         2  
  1         50  
4 1     1   539 use File::ShareDir 'dist_dir';
  1         27410  
  1         343  
5              
6             our $VERSION=0.002;
7             our @extensions = qw/spellfix csv ieee754 nextchar percentile series totype wholenumber eval/;
8              
9             my $dbd_dist = dist_dir('DBD-SQLite');
10             my $cc = $Config{cc};
11              
12             # TODO this probably doesn't work on windows anyway. Need to look into how to make that work correctly anyway.
13             my $lib_ext = $^O =~ /mswin/i ? 'dll' :
14             $^O =~ /darwin/i ? 'dylib' : 'so';
15              
16             # TODO this needs to support mswin32
17              
18              
19              
20             sub get_build_commands {
21 0 0   0 0   my $shared = $^O =~ /darwin/i ? '-dynamiclib' : '-shared';
22 0           my @build_commands = map {"$cc $shared -I$dbd_dist -O2 -fPIC -o $_.$lib_ext ext/misc/$_.c"} @extensions;
  0            
23              
24 0           return \@build_commands;
25             }
26              
27             sub get_install_commands {
28 0 0   0 0   if ($^O =~ /mswin/i) {
29 0           my @install_commands = map {"copy $_.$lib_ext %DESTDIR%"} @extensions;
  0            
30              
31 0           return \@install_commands;
32             } else {
33 0           my @install_commands = map {"cp $_.$lib_ext %s"} @extensions;
  0            
34              
35 0           return \@install_commands;
36             }
37             }
38              
39             1;
40             __END__