1 ## --Makefile.PL for Bioperl core module distribution--##
2 ## ----------------------------------------------------##
4 ##----------------------------------------------------
7 # Start with object preamble and setup of variables that might need changing
16 use File::Spec::Functions;
17 use ExtUtils::MakeMaker;
18 use File::Path 'rmtree';
21 # All Bioperl dependencies on external modules are defined here
22 # (these are all considered optional)
24 'Ace' => '0.0/Aceperl/access of ACeDB database/Bio::DB::Ace,Bio::DB::GFF::Adaptor::ace',
25 'Bio::ASN1::EntrezGene' => '0.0/Entrez Gene Bioperl Parser/parsing entrezgene/Bio::SeqIO::entrezgene',
26 # we actually need 1.01 of Class::AutoClass, but unfortunately it is versioned as 1.0
27 'Class::AutoClass' => '1.0/Protocol for object creation/creating objects/Bio::Graph::SimpleGraph,Bio::Graph::SimpleGraph::Traversal,Bio::Graph::ProteinGraph',
28 'Clone' => '0.0/Recursively copy Perl datatypes/cloning objects/Bio::Graph::ProteinGraph,Bio::Tools::Primer3',
29 'Convert::Binary::C' => '0.0/Binary Data Conversion using C Types/strider functionality/Bio::SeqIO::strider',
30 'Data::Stag::XMLWriter' => '0.0/XML writer/writing choas xml files/Bio::SeqIO::chaosxml',
31 'DB_File' => '0.0/Persistent object storage and retrieval/persistent database storage/Bio::DB::GFF::Adaptor::berkeleydb,Bio::SeqFeature::Collection,Bio::DB::Taxonomy::flatfile,Bio::DB::FileCache,Bio::DB::Flat::BDB,Bio::Index::Abstract',
32 'GD' => '1.3/Graphical Drawing Toolkit/rendering Sequences and Features/Bio::Graphics::Glyph*',
33 'GD::SVG' => '0.0/Generate SVG output/creating SVG images/Bio::Graphics::Panel',
34 'Graph::Directed' => '0.0/Generic Graph data structure and algorithms/ontology engine implementation for the GO parser/Bio::Ontology::SimpleGOEngine::GraphAdaptor',
35 'HTML::Entities' => '0.0/Parse POST request URL forms/remote analysis POST submissions/Bio::SearchIO::blastxml',
36 'HTML::Parser' => '3.0/Parse HTML documents/screen scraping www.gdb.org/Bio::DB::GDB',
37 'HTTP::Request::Common' => '0.0/Part of the LWP package/GenBank+GenPept sequence retrieval, remote http Blast jobs/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::Analysis::Protein*,Bio::Tools::Analysis::DNA*',
38 'IO::String' => '0.0/IO handle to read or write to a string/a wide variety of functions/Bio::SeqIO::game::gameWriter,Bio::DB::*,Bio::Variation::IO::xml,Bio::Tools::*,Bio::Index::Blast,Bio::Index::Hmmer,Bio::TreeIO::cluster,Bio::TreeIO::nexus',
39 'LWP::UserAgent' => '0.0/Part of the LWP package/remote access/Bio::DB::*,Bio::Tools::Run::RemoteBlast,Bio::Tools::WebBlat,Bio::WebAgent,Bio::Graphics::Glyph::image',
40 'Set::Scalar' => '0.0/Basic set operations/proper operation/Bio::Tree::Compatible',
41 'SOAP::Lite' => '0.0/SOAP protocol/XEMBL Services and Bibliographic queries/Bio::DB::XEMBLService,Bio::DB::Biblio::soap',
42 'Spreadsheet::ParseExcel' => '0.0/Excel parser/parsing Excel files/Bio::SeqIO::excel',
43 'Storable' => '0.0/Persistent object storage and retrieval/storing sequence objects in local file cache/Bio::DB::FileCache,Bio::SeqFeature::Collection,Bio::PopGen::HtSNP,Bio::PopGen::TagHaplotype,Bio::DB::GFF::Adaptor::berkeleydb',
44 'SVG' => '2.26/SVG output/Bio::Graphics/Bio::Graphics::Pictogram',
45 'SVG::Graph' => '0.01/SVG output/creating SVG images/Bio::TreeIO::svggraph',
46 'Text::Shellwords' => '0.0/Execute shell commands/test scripts/Bio::Graphics',
47 'XML::DOM::XPath' => '0.0/XML parser/parsing interpro features/Bio::FeatureIO::interpro',
48 'XML::Parser' => '0.0/Parsing of XML documents/parsing xml/Bio::Biblio::IO::medlinexml',
49 'XML::Parser::PerlSAX' => '0.0/Parsing of XML documents/parsing xml/Bio::SeqIO::tinyseq,Bio::SeqIO::game::gameSubs,Bio::OntologyIO::InterProParser,Bio::ClusterIO::dbsnp',
50 'XML::SAX' => '0.0/New style SAX parser/parsing xml/Bio::SearchIO::blastxml,Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
51 'XML::SAX::Base' => '0.0/New style SAX parser/parsing xml/Bio::SeqIO::tigrxml,Bio::SeqIO::bsml_sax',
52 'XML::SAX::Writer' => '0.0/New style SAX parser/writing xml/Bio::SeqIO::tigrxml',
53 'XML::Simple' => '0.0/Simple XML parser/parsing xml/Bio::DB::EUtilities',
54 'XML::Twig' => '0.0/Parsing of XML documents/parsing xml/Bio::Variation::IO::xml,Bio::DB::Taxonomy::entrez,Bio::DB::Biblio::eutils,Bio::Graph::IO::psi_xml',
55 'XML::Writer' => '0.4/Parsing and writing of XML documents/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',
58 # We don't want CPAN, Bundle::BioPerl et al. to know about these for various
59 # reasons (eg. because they would cause a circular dependency), so will exclude
60 # them from PREREQ_PM later on
61 my %exclude_from_prereqs = (
62 'Bio::ASN1::EntrezGene' => 'it would cause a circular dependency'
70 # generate string for makefile that allows show_tests and make test_<testname>
72 opendir(DIR,"t") || die "No test directory. Cannot continue.";
73 my @files = readdir(DIR);
77 foreach my $file (@files) {
78 $file =~ /(\w+)\.t/ || next;
80 my $path = catfile('t', $file);
81 my $line = "test_$file :: pure_all\n\tPERL_DL_NONLAZY=1 \$(FULLPERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) -e \'use Test::Harness qw(&runtests \$\$verbose); \$\$verbose=\$(TEST_VERBOSE); runtests \@ARGV;\' $path.t\n";
83 $tset .= " $file \\\n";
85 $tline = "show_tests :\n\t\@echo \'type make test_<subtest> to run\'\n\t\@echo '$tset'\n$tline\n";
86 print STDERR "Generated sub tests. go make show_tests to see available subtests\n";
88 # we may end up creating extra files we would want to clean later; note them here
89 my @should_be_cleaned;
91 # ask questions about optional stuff to install/test
92 my @scripts_to_install = eval {get_scripts_to_install()};
93 prompt_for_biodbgff();
94 setup_bioseqfeaturestore();
96 # notify about optional modules that haven't been installed, and generate hash
97 # for prereqs needed later in WriteMakefile
100 print "\n*** Optional dependencies section ***\n";
101 while (my ($name, $value) = each %packages) {
102 my ($ver, $desc, $expl, $module) = split( /\// , $value);
103 if (! eval "require $name;") {
104 my @modules = split(',', $module);
105 my $modules = join("\n * ", @modules);
106 print "External Module '$name' ($desc) is not installed on this computer.\n The following Bioperl modules need it for $expl:\n * $modules\n";
109 if (exists $exclude_from_prereqs{$name}) {
110 print "Additionally, it will not be considered a pre-requisite\n(and therefore will not be automatically installed by CPAN) because:\n $exclude_from_prereqs{$name}.\n\n";
117 unless (exists $exclude_from_prereqs{$name}) {
118 $prereq{$name} = $ver;
125 Some perl modules are missing, listed above and below. The only
126 functionality that will be affected is described above;
127 the rest of bioperl will work fine without them.
129 The installation of these external packages is very simple. You
130 can read more about bioperl external dependencies in the INSTALL
133 http://bioperl.org/wiki/Installing_BioPerl
135 Enjoy the rest of bioperl, which you can use after going 'make install'
143 DISTNAME => 'bioperl',
144 VERSION_FROM => "Bio/Root/Version.pm",
145 dist => { COMPRESS => 'gzip -9f',
147 DIST_DEFAULT => 'all tardist'
149 'AUTHOR' => 'Bioperl Team (bioperl-l@bioperl.org)',
150 'ABSTRACT' => 'Bioinformatics Toolkit',
151 # clean() is overridden and also gets rid of @should_be_cleaned
152 realclean => { FILES => join(' ', @should_be_cleaned) },
153 EXE_FILES => \@scripts_to_install,
154 PL_FILES => {'maintenance/symlink_scripts.PLS' => 'maintenance/symlink_scripts.pl' },
155 PREREQ_PM => \%prereq,
156 # Once 'nmake ppd' has been issued, the PPD needs to be modified for use with PPM4
157 # In addition, non-critical prereq's should be moved to a Bundle::BioPerl PPD
158 # A bit of a pain, but better to have all the prereq's in the same place initially
159 # TODO I'll (Nathan Haigh) added updated details to the wiki for doing this
169 sub get_scripts_to_install {
170 print "\n*** Script Install Section ****\n";
171 print "\nBioperl comes with a number of useful scripts which you may wish to install.\n";
172 my $prompt_mode = prompt("Install [a]ll Bioperl scripts, [n]one, or choose groups [i]nteractively?",'a');
173 return if $prompt_mode =~ /^[nN]/;
175 my $script_dir = catfile('./', 'scripts');
176 my $dest_dir = catfile('./', 'scripts_temp');
177 rmtree($dest_dir) if -e $dest_dir;
178 mkdir($dest_dir) or die "Can't mkdir($dest_dir): $!";
179 opendir(F,$script_dir) or die "Can't opendir $script_dir: $!";
180 while (my $file_or_dir = readdir(F)) {
181 next if $file_or_dir =~ /^\./;
182 next if $file_or_dir eq 'CVS';
183 my $path = catfile($script_dir, $file_or_dir);
184 next unless -d $path;
185 next unless prompt_to_install($script_dir, $file_or_dir, $prompt_mode);
186 my @files = install_contents($path, $dest_dir);
187 push @scripts,@files;
193 sub prompt_to_install {
196 my $prompt_mode = shift;
197 print "\n* Script Directory $f *\n";
198 my $path = catfile($prefix, $f, 'TAG');
199 if (-e $path && (my $g = IO::File->new($path))) {
202 return 1 if $prompt_mode =~ /^[aA]/; # all
203 my $result = prompt("Install scripts in $f? [y]es [n]o [q]uit",'n');
204 die if $result =~ /^[qQ]/;
205 return $result =~ /^[yY]/;
208 sub install_contents {
211 my $bangline = $Config{startperl};
214 opendir (D,$dir) or die "Can't open $dir: $!\n";
215 while (my $script = readdir(D)) {
216 next unless $script =~ /\.PLS$/;
217 my $path = catfile($dir, $script);
218 my $in = IO::File->new($path) or die "Can't open $path: $!";
219 $script =~ s/\.PLS$/\.pl/; # change from .PLS to .pl
220 $script =~ s/^/bp_/ unless $script =~ /^bp/; # add the "bp" prefix
221 print "\tActivating $script....\n";
222 my $path2 = catfile($dest, $script);
223 unlink $path2 if -e $path2;
224 my $out = IO::File->new(">$path2") or die "Can't open $path2: $!";
228 if (s/^\#\!\S+/$bangline/) {
236 chmod 0555, $path2 or die "Can't change mode of $script to ",MODE(),": $!";
243 sub prompt_for_biodbgff {
244 if (eval { require DBI } && grep {/mysql/} DBI->available_drivers) {
245 print "\n*** Bio::DB::GFF Tests section *** \n";
246 my $proceed = prompt("Do you want to run the BioDBGFF tests (requires a mysql, postgres or oracle database) y/n",'n');
247 my $path = catfile('t', 'do_biodbgff.tests');
248 if ($proceed =~ /^[yY]/) {
249 my $cfg = {dbd_driver => 'mysql'};
250 GFFQueryDb($cfg,{'prompt'=>1,'verbose'=>1});
251 if (open T,">$path") {
252 while (my ($key, $value) = each %$cfg) {
253 print T $key, "\t", $value,"\n";
257 push(@should_be_cleaned, $path);
267 # creates $cfg->{$driver}->{test_(db|host|dsn|user|pass)}
270 my $options = shift || {};
271 my $db = $cfg->{'description'} || $cfg->{'dbd_driver'};
272 my $driver = $cfg->{'dbd_driver'};
274 my $prompt = $options->{'prompt'};
276 $driver = prompt("Which database driver should I use for testing BioDBGFF (mysql,Pg,Oracle)?",
280 $cfg->{'dbd_driver'} = $driver;
282 my $test_db = exists($options->{"$d-test-db"}) ?
283 $options->{"$d-test-db"} : ($cfg->{'test_db'} || 'test');
286 ("Which database should I use for testing the $driver driver?",
287 $test_db) if $prompt;
289 my $test_host = exists($options->{"$d-test-host"}) ?
290 $options->{"$d-test-host"} : ($cfg->{'test_host'} || 'localhost');
292 ("On which host is database $test_db running (hostname, ip address or host:port)", $test_host) if $prompt;
294 my($test_user, $test_pass);
296 $test_user = exists($options->{"$d-test-user"}) ?
297 $options->{"$d-test-user"} : ($cfg->{'test_user'} || "undef");
299 ("User name for connecting to database $test_db?", $test_user)
301 $test_user = undef if $test_user eq 'undef';
303 $test_pass = exists($options->{"$d-test-pass"}) ?
304 $options->{"$d-test-pass"} : ($cfg->{'test_pass'} || "undef");
306 ("Password for connecting to database $test_db?", $test_pass)
308 $test_pass = undef if $test_pass eq 'undef';
310 $cfg->{'test_db'} = $test_db;
311 $cfg->{'test_host'} = $test_host;
312 $cfg->{'test_user'} = $test_user;
313 $cfg->{'test_pass'} = $test_pass;
314 if ($test_host eq 'undef' || $test_host eq 'localhost') {
319 $test_dsn = "dbi:$driver:dbname=$test_db";
321 $test_dsn = "dbi:$driver:database=$test_db";
323 $cfg->{test_dsn} = $test_dsn;
325 $cfg->{'test_dsn'} .= ";host=$test_host";
328 if ($options->{'verbose'}) {
329 local $^W=0; # some uninitialized variable warning coming through
330 print("Driver $driver is using the following settings for tests:\n",
331 " Database $test_db\n",
332 " Host $test_host\n",
334 " User $test_user\n",
335 " Password $test_pass\n");
339 sub setup_bioseqfeaturestore {
340 print "\n*** Bio::DB::SeqFeature Tests section *** \n";
341 my $path0 = catfile('t', 'BioDBSeqFeature.t');
342 if (eval "require DB_File;") {
343 print "I see you have Berkeleydb installed. I will create the BDB tests for Bio::DB::SeqFeature::Store...\n";
344 my $path = catfile('t', 'BioDBSeqFeature_BDB.t');
347 system "perl $path0 -adaptor berkeleydb -create 1 -temp 1";
350 push(@should_be_cleaned, $path);
353 print "I saw that you didn't have Berkelydb installed, so I didn't create BDB tests\n";
356 if (eval { require DBI } && grep {/mysql/} DBI->available_drivers) {
357 if (DBI->connect('dbi:mysql:test',undef,undef,{RaiseError=>0,PrintError=>0})) {
358 warn "I see you have mysql running and have a connectable 'test' database. I will create the mysql tests for Bio::DB::SeqFeature::Store...\n";
359 my $path = catfile('t', 'BioDBSeqFeature_mysql.t');
362 system "perl $path0 -adaptor DBI::mysql -create 1 -temp 1 -dsn test";
365 push(@should_be_cleaned, $path);
368 print "I saw that you didn't have a connectatble 'test' database, so I didn't create corresponding tests\n";
372 print "I saw that you had no mysql DBI driver, so I didn't create corresponding tests\n";
378 # override MakeMaker methods
382 my $path = catfile('maintenance', 'symlink_scripts.pl');
384 . "link_install ::\n\t\$(PERL) '".cwd()."/".$path."' '\$(INSTALLSITEBIN)'\n\n";
390 return shift->SUPER::clean(@_) . <<END;
391 \t-rm -rf scripts_temp @should_be_cleaned
398 return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n"
401 return $self->SUPER::manifypods(@_);
406 my $inherited = shift->SUPER::install(@_);
407 $inherited =~ s/doc_install/doc_install link_install /;