-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.PL
117 lines (97 loc) · 3.11 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Cwd;
use Carp;
use File::Find;
my $orig_location = getcwd;
# need to get included src compiled here:
# cd to src dir
my $easel_src = __FILE__;
warn $easel_src, "\n";
$easel_src =~ s/Makefile.PL/src\/easel/;
chdir $easel_src;
system("autoconf");
system("./configure --enable-pic");
system("make");
chdir $orig_location;
my $inlined = [];
sub WriteMultiInlineMakefile {
my %args = @_;
# Add Inline to the dependencies
$args{PREREQ_PM}{Inline} = '0.51' unless defined $args{PREREQ_PM}{Inline};
# call original WriteMakefile
WriteMakefile(%args);
# trawl through the lib directory and look for files that "use Inline"
find(\&wanted, './lib');
if (scalar @$inlined > 0) {
open my $MAKEFILE, '>>', 'Makefile'
or croak "can't append Inline compilation to Makefile:$!\n";
print $MAKEFILE qq(
# Well, not quite. Our custom MakeMaker is adding this:
# --- MakeMaker inline section:\n);
foreach my $entry (@$inlined) {
# append code to generate inlined modules foreach file in list of inlines
#Logo.inl : $(TO_INST_PM)
# $(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MBio::HMM::Logo -e1 0.02 $(INST_ARCHLIB)
my $name = $entry->[0];
my $version = $entry->[1];
my $object = (split(/::/, $name))[-1];
print $MAKEFILE qq(
$object.inl : \$(TO_INST_PM)
\t\$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$name -e1 $version \$(INST_ARCHLIB)
pure_all :: $object.inl
);
}
print $MAKEFILE qq(# The End is here.);
close $MAKEFILE;
}
}
sub wanted {
my $name = $File::Find::name;
if ($name =~ /\.pm$/) {
open my $file, '<', $_
or croak "can't open $name to determine Makefile addition:$!\n";
my $is_inline = undef;
my $package = undef;
while(my $line = <$file>) {
# get the package name
if ($line =~ /^\s*package\s*\S+;/) {
($package) = $line =~ /package\s*(\S+);/;
}
# search for "use Inline"
if ($line =~ /use Inline/) {
$is_inline = 1;
last;
}
}
# if "use Inline" found add it to the list
if ($is_inline) {
my $version = ExtUtils::MM_Unix->parse_version($_)
or croak "Can't determine version for $name\n";
push @$inlined, [$package, $version]
}
}
}
WriteMultiInlineMakefile(
NAME => 'Bio::Easel',
AUTHOR => q{Eric Nawrocki <nawrocke@ncbi.nlm.nih.gov>},
VERSION_FROM => 'lib/Bio/Easel.pm',
ABSTRACT_FROM => 'lib/Bio/Easel.pm',
LICENSE => 'GPL_3',
PL_FILES => {},
MIN_PERL_VERSION => 5.006,
EXE_FILES => ['scripts/esl-ssplit.pl','scripts/esl-alidepair.pl'],
CONFIGURE_REQUIRES => {
'Inline::MakeMaker' => 0.45,
'ExtUtils::MakeMaker' => 6.52,
},
BUILD_REQUIRES => {
'Test::More' => 0,
},
PREREQ_PM => {
'Inline' => 0.51,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Bio-Easel-* _Inline *.inl' },
);