add Codeml pairwise result for PAML4
[bioperl-live.git] / Build.PL
blob65821c7f2625438541109fd791783b94e4fad217
1 #!/usr/bin/perl -w
3 # This is a Module::Build script for Bioperl installation.
4 # See http://search.cpan.org/~kwilliams/Module-Build/lib/Module/Build.pm
6 # Uses a custom subclass of Module::Build called ModuleBuildBioperl that
7 # doesn't get installed
9 # In the future developers may need to alter the requires and recommends and
10 # possibly Network sections of ModuleBuildBioperl->new() below, but otherwise
11 # nothing else here is likely to need changing.
13 use strict;
14 use ModuleBuildBioperl;
16 our @drivers;
18 # Set up the ModuleBuildBioperl object
19 my $build = ModuleBuildBioperl->new(
20 module_name => 'Bio',
21 dist_name => 'bioperl',
22 dist_version_from => 'Bio/Root/Version.pm',
23 dist_author => 'Bioperl Team <bioperl-l@bioperl.org>',
24 dist_abstract => 'Bioinformatics Toolkit',
25 license => 'perl',
26 requires => {
27 'perl' => '5.6.1',
28 'IO::String' => 0,
29 'DB_File' => 0,
30 'Scalar::Util' => 0 # not in Perl 5.6.1, arrived in core in 5.7.3
32 build_requires => {
33 'Test::More' => 0,
34 'Module::Build' => 0.2805,
35 'Test::Harness' => 2.62,
36 'CPAN' => 1.81
38 recommends => { # does what you would expect of recommends, except more informative output and generates optional_features in META.yml
39 'Ace' => '0/access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace',
40 # this won't actually install due to circular dep, but we have no way of doing a post-install
41 'Bio::ASN1::EntrezGene' => '0/parsing entrezgene/Bio::SeqIO::entrezgene',
42 # we actually need 1.01 of Class::AutoClass, but unfortunately it is versioned as 1.0
43 'Class::AutoClass' => '1/creating objects/Bio::Graph::SimpleGraph,Bio::Graph::SimpleGraph::Traversal,Bio::Graph::ProteinGraph',
44 'Clone' => '0/cloning objects/Bio::Graph::ProteinGraph,Bio::Tools::Primer3',
45 'Convert::Binary::C' => '0/strider functionality/Bio::SeqIO::strider',
46 'Data::Stag::XMLWriter' => '0/writing choas xml files/Bio::SeqIO::chaosxml',
47 'GD' => '1.3/rendering Sequences and Features/Bio::Graphics::Glyph*',
48 'GD::SVG' => '0/creating SVG images/Bio::Graphics::Panel',
49 # we specifically want Graph::Directed, but that has no VERSION
50 'Graph' => '0/ontology engine implementation for the GO parser/Bio::Ontology::SimpleGOEngine::GraphAdaptor',
51 'HTML::Entities' => '0/remote analysis POST submissions/Bio::SearchIO::blastxml',
52 'HTML::Parser' => '3/screen scraping www.gdb.org/Bio::DB::GDB',
53 'HTTP::Request::Common' => '0/GenBank+GenPept sequence retrieval, remote http Blast jobs/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*',
54 'LWP::UserAgent' => '0/remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::WebBlat,Bio::WebAgent,Bio::Graphics::Glyph::image',
55 'PostScript::TextBlock' => '0/EPS output/Bio::Tree::Draw::Cladogram',
56 'Set::Scalar' => '0/proper operation/Bio::Tree::Compatible',
57 'SOAP::Lite' => '0/XEMBL Services and Bibliographic queries/Bio::DB::XEMBLService,Bio::DB::Biblio::soap',
58 'Spreadsheet::ParseExcel' => '0/parsing Excel files/Bio::SeqIO::excel',
59 'Storable' => '2.05/storing sequence objects in local file cache/Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb',
60 'SVG' => '2.26/SVG output/Bio::Graphics::Pictogram',
61 'SVG::Graph' => '0.01/creating SVG images/Bio::TreeIO::svggraph',
62 'Text::Shellwords' => '0/test scripts/Bio::Graphics',
63 'URI::Escape' => '0/dealing with web resources/Bio::Tools::WebBlat,Bio::FeatureIO::gff,Bio::FeatureIO::interpro,Bio::DB::Biblio::eutils,Bio::DB::EUtilities::Cookie,Bio::DB::Query::GenBank,Bio::DB::NCBIHelper,Bio::SeqFeature::Annotated',
64 'XML::DOM::XPath' => '0.13/parsing interpro features/Bio::FeatureIO::interpro',
65 'XML::Parser' => '0/parsing xml/Bio::Biblio::IO::medlinexml',
66 'XML::Parser::PerlSAX' => '0/parsing xml/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp',
67 'XML::SAX' => '0.15/parsing xml/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
68 'XML::SAX::Writer' => '0/writing xml/Bio::SeqIO::tigrxml',
69 'XML::Twig' => '0/parsing xml/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,Bio::DB::Biblio::eutils,Bio::Graph::IO::psi_xml',
70 'XML::Writer' => '0.4/parsing and writing xml/Bio::SeqIO::agave,Bio::SeqIO::game::gameWriter,Bio::SeqIO::chadoxml,Bio::SeqIO::tinyseq,Bio::Variation::IO::xml,Bio::SearchIO::Writer::BSMLResultWriter'
72 get_options => {
73 network => { } # say 'perl Build.PL --network' to manually request network tests
75 auto_features => {
76 BioDBSeqFeature_BDB => {
77 description => "BDB tests for Bio::DB::SeqFeature::Store",
78 feature_requires => { 'DB_File' => 0 } # feature_requires is like requires, execpt that it doesn't trigger installation
80 BioDBGFF => {
81 description => "BioDBGFF database tests (will need to answer questions before really enabling)",
82 feature_requires => { 'DBI' => 0 },
83 excludes_os => ['mswin'],
84 test => \&test_biodbgff # ModuleBuildBioperl unique requirement that after everything else succeeds, supplied code ref must also return undef
86 BioDBSeqFeature_mysql => {
87 description => "MySQL tests for Bio::DB::SeqFeature::Store",
88 feature_requires => { 'DBI' => 0, 'DBD::mysql' => 0 },
89 test => \&test_db
91 Network => {
92 description => "Enable tests that need an internet connection",
93 requires => { 'LWP::UserAgent' => 0 },
94 test => \&ModuleBuildBioperl::test_internet
97 dynamic_config => 1,
98 create_makefile_pl => 'passthrough'
100 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
101 #script_files => [] # scripts in scripts directory are installed on-demand
104 # Handle auto features
105 if ($build->feature('BioDBSeqFeature_BDB')) {
106 make_bdb_test();
108 if ($build->feature('BioDBSeqFeature_mysql')) {
109 make_dbi_test();
112 # Ask questions
113 $build->choose_scripts;
114 prompt_for_biodbgff() if $build->feature('BioDBGFF');
116 if ($build->args('network')) {
117 if ($build->feature('Network')) {
118 $build->notes(network => 1);
119 $build->log_info(" - will run internet-requiring tests\n");
121 else {
122 $build->notes(network => 0);
123 $build->log_info(" - will not run network tests since I seem to be missing essential network functionality\n");
126 else {
127 prompt_for_network() if $build->feature('Network');
129 # then in test script:
130 # use Module::Build;
131 # my $build = Module::Build->current;
132 # my $do_network_tests = $build->notes('network');
135 # Request that some scripts run post-installation
136 $build->add_post_install_script('maintenance/symlink_script.pl'); # takes a unix file path regardless of local OS
138 # Add extra things to MANIFEST.SKIP
139 $build->add_to_manifest_skip('bioperl.lisp', 'Bio/Tools/WebBlat.pm');
141 # Create the build script and exit
142 $build->create_build_script;
144 exit;
147 sub make_bdb_test {
148 my $path0 = File::Spec->catfile('t', 'BioDBSeqFeature.t');
149 my $path = File::Spec->catfile('t', 'BioDBSeqFeature_BDB.t');
150 open my $F, ">$path";
151 print $F <<END;
152 system 'perl $path0 -adaptor berkeleydb -create 1 -temp 1';
154 close $F;
155 $build->add_to_cleanup($path);
156 $build->add_to_manifest_skip($path);
159 sub test_db {
160 eval {require DBI;}; # if not installed, this sub won't actually be called
161 unless (eval {DBI->connect('dbi:mysql:test',undef,undef,{RaiseError=>0,PrintError=>0})}) {
162 return "Could not connect to test database";
164 return;
167 sub make_dbi_test {
168 my $path0 = File::Spec->catfile('t', 'BioDBSeqFeature.t');
169 my $path = File::Spec->catfile('t', 'BioDBSeqFeature_mysql.t');
170 open my $F,">$path";
171 print $F <<END;
172 system 'perl $path0 -adaptor DBI::mysql -create 1 -temp 1 -dsn test';
174 close $F;
175 $build->add_to_cleanup($path);
176 $build->add_to_manifest_skip($path);
179 sub test_biodbgff {
180 eval {require DBI;}; # if not installed, this sub won't actually be called
181 @drivers = DBI->available_drivers;
182 unless (grep {/mysql|Pg|Oracle/i} @drivers) {
183 return "MySQL, Pg nor Oracle DBI drivers are installed";
185 return;
188 sub prompt_for_biodbgff {
189 my $proceed = $build->y_n("Do you want to run the BioDBGFF live database tests? y/n", 'n');
191 if ($proceed) {
192 my @driver_choices;
193 foreach my $poss ('mysql', 'Pg', 'Oracle') {
194 if (grep {/$poss/i} @drivers) {
195 my $choice = $poss;
196 $choice =~ s/^(.)/[$1]/;
197 push(@driver_choices, $choice);
201 my $driver;
202 if (@driver_choices > 1) {
203 my ($default) = $driver_choices[0] =~ /\[(.)/;
204 $driver = $build->prompt("Which database driver should be used? ".join(" ", @driver_choices), $default);
206 else {
207 ($driver) = $driver_choices[0] =~ /\[(.)/;
209 if ($driver =~ /^[mM]/) {
210 $driver = 'mysql';
212 elsif ($driver =~ /^[pP]/) {
213 $driver = 'Pg';
215 elsif ($driver =~ /^[oO]/) {
216 $driver = 'Oracle';
219 my $test_db = $build->prompt("Which database should I use for testing the $driver driver?", 'test');
220 my $test_host = $build->prompt("On which host is database '$test_db' running (hostname, ip address or host:port)", 'localhost');
221 my $test_user = $build->prompt("User name for connecting to database '$test_db'?", 'undef');
222 my $test_pass = $build->prompt("Password for connecting to database '$test_db'?", 'undef');
224 my $use_host = 1;
225 if ($test_host eq 'undef' || $test_host eq 'localhost') {
226 $use_host = 0;
229 my $test_dsn;
230 if ($driver eq 'Pg') {
231 $test_dsn = "dbi:$driver:dbname=$test_db";
233 else {
234 $test_dsn = "dbi:$driver:database=$test_db";
236 if ($use_host) {
237 $test_dsn .= ";host=$test_host";
240 $build->notes(dbd_driver => $driver);
241 $build->notes(test_db => $test_db);
242 $build->notes(test_host => $test_host);
243 $build->notes(test_user => $test_user eq 'undef' ? undef : $test_user);
244 $build->notes(test_pass => $test_pass eq 'undef' ? undef : $test_pass);
245 $build->notes(test_dsn => $test_dsn);
247 $build->log_info(" - will run the BioDBGFF tests with database driver '$driver' and these settings:\n",
248 " Database $test_db\n",
249 " Host $test_host\n",
250 " DSN $test_dsn\n",
251 " User $test_user\n",
252 " Password $test_pass\n");
254 else {
255 $build->log_info(" - will not run the BioDBGFF live database tests\n");
258 $build->log_info("\n");
261 sub prompt_for_network {
262 my $proceed = $build->y_n("Do you want to run tests that require connection to servers across the internet\n(likely to cause some failures)? y/n", 'n');
264 if ($proceed) {
265 $build->notes(network => 1);
266 $build->log_info(" - will run internet-requiring tests\n");
268 else {
269 $build->notes(network => 0);
270 $build->log_info(" - will not run internet-requiring tests\n");