File Coverage

blib/lib/Alien/Autotools.pm
Criterion Covered Total %
statement 55 59 93.2
branch 6 12 50.0
condition n/a
subroutine 16 20 80.0
pod 6 10 60.0
total 83 101 82.1


line stmt bran cond sub pod time code
1             package Alien::Autotools;
2              
3 4     4   718858 use strict;
  4         20  
  4         112  
4 4     4   28 use warnings;
  4         7  
  4         132  
5 4     4   20 use base qw( Exporter );
  4         9  
  4         421  
6 4     4   429 use File::Which ();
  4         929  
  4         66  
7 4     4   705 use Path::Tiny ();
  4         10484  
  4         102  
8 4     4   1122 use Alien::autoconf 0.18;
  4         37626  
  4         32  
9 4     4   40748 use Alien::automake 0.18;
  4         977  
  4         27  
10 4     4   15523 use Alien::libtool 0.15;
  4         1046  
  4         52  
11 4     4   15291 use Alien::m4 0.18;
  4         816  
  4         35  
12              
13             our @EXPORT_OK = qw(autoconf_dir automake_dir libtool_dir);
14              
15             # ABSTRACT: Build and install the GNU build system.
16             our $VERSION = '1.07'; # VERSION
17              
18              
19             sub bin_dir
20             {
21 12         4641 my @dir = map { $_->bin_dir }
22 3     3 1 2109 map { "Alien::$_" }
  12         24  
23             qw( autoconf automake libtool m4 );
24 3         1405 @dir;
25             }
26              
27             sub _dir_from_exe
28             {
29 0     0   0 my($name) = @_;
30 0         0 my $path = File::Which::which($name);
31 0 0       0 die "unable to find $name in PATH" unless $path;
32 0         0 Path::Tiny->new($path)->parent->stringify;
33             }
34              
35             my %helper;
36              
37             sub alien_helper
38             {
39 2 50   2 0 15455 return \%helper if keys %helper;
40              
41 2         5 foreach my $alien ( map { "Alien::$_" } qw( autoconf automake libtool m4 ))
  8         29  
42             {
43 8         12 my %sub = %{ $alien->alien_helper };
  8         33  
44 8         89 %helper = (%helper, %sub);
45             }
46              
47 2         6 return \%helper;
48             }
49              
50              
51             sub aclocal_dir
52             {
53 2     2 1 1821 my @dir;
54 2         5 foreach my $alien (map { "Alien::$_" } qw( autoconf automake libtool m4 ))
  8         28  
55             {
56 8         130 my $dir = Path::Tiny->new($alien->dist_dir)->child(qw( share aclocal ));
57 8 100       3648 push @dir, $dir if -d $dir;
58             }
59 2         37 @dir;
60             }
61              
62              
63             sub versions
64             {
65 1     1 1 11 my %ver;
66 1         4 foreach my $alien (qw( autoconf automake libtool m4 ))
67             {
68 4         46 my $class = "Alien::$alien";
69 4         34 $ver{$alien} = $class->version;
70             }
71 1         21 %ver;
72             }
73              
74              
75             sub autoconf_dir ()
76             {
77 2     2 1 92 my($dir) = Alien::autoconf->bin_dir;
78 2 50       1092 $dir
79             ? $dir
80             : _dir_from_exe('autoconf');
81             }
82              
83              
84             sub automake_dir ()
85             {
86 2     2 1 12 my($dir) = Alien::automake->bin_dir;
87 2 50       1004 $dir
88             ? $dir
89             : _dir_from_exe('automake');
90             }
91              
92              
93             sub libtool_dir ()
94             {
95 2     2 1 23 my($dir) = Alien::libtool->bin_dir;
96 2 50       939 $dir
97             ? $dir
98             : _dir_from_exe('libtool');
99             }
100              
101       0 0   sub cflags {}
102       0 0   sub libs {}
103       0 0   sub dynamic_libs {}
104              
105             1;
106              
107             __END__