version increase for final release, improved warning
[bioperl-network.git] / Makefile.PL
bloba12151478202d3f50075103822c2ec52c6565bfc
1 # --Makefile.PL for bioperl-network distribution-------
2 # ---------------------------------------------------------
3 # $Id$
4 # ---------------------------------------------------------
6 # This still works, but has been superceded by Build.PL
7 # Please use Build.PL in preference
9 warn <<'WARN';
10 !--
11   Bioperl is transitioning from Makefile.PL-based installations to Build.PL
13   This Makefile.PL should still work fine, but please try Build.PL instead,
14   especially if you run into any non-test-related problems:
16   perl Build.PL
17   ./Build test
18   ./Build install
19   
20   If you're seeing this message whilst installing with CPAN, consider
21   stopping this installation and changing your CPAN configuration before
22   trying to install again:
23   
24   cpan>install CPAN
25   cpan>reload CPAN
26   cpan>install Module::Build
27   cpan>o conf prefer_installer MB
28   cpan>o conf commit
29   cpan>q
30   
31   Otherwise, if you would like to install the optional dependencies,
32   install Bundle::BioPerl v2.1.8 or greater
34 --!
36 WARN
38 for (1..5) {
39   local $| = 1;
40   print ". ";
41   sleep(1);
43 print "\n";
46 # Start with object preamble and setup of variables that might need changing
47 # in the future
50 require 5.006_001;
51 use strict;
52 use warnings;
53 use File::Spec::Functions;
54 use ExtUtils::MakeMaker;
55 use Cwd;
57 my $VERSION = 1.005002_100;
58 $VERSION = eval $VERSION;
60 # All Bioperl dependencies on external modules are defined here
61 # (these are mostly considered optional)
62 my %packages = (
63  'Graph'                                                        => '0.80/Graph data structures and algorithms/graph construction and analysis/Bio::Network::ProteinNet',
64  'XML::Twig'                                    => '3.22/Read and write XML/parsing PSI XML/Bio::Graph::IO::psi',
65  'Bio::Root::Version'   => '1.005002/Bioperl/basic functionality/Everything',
68 # We don't want CPAN, Bundle::BioPerl et al. to know about these for various
69 # reasons (eg. because they would cause a circular dependency), so will exclude
70 # them from PREREQ_PM later on
71 my %exclude_from_prereqs = (
72   
75 # These are really required and deserve a clearer warning
76 my %required = (
77         'Bio::Root::Version' => 1
82 # Main code
85 # generate string for makefile that allows show_tests and make test_<testname>
86 # to work
87 opendir(DIR,"t") || die "No test directory. Cannot continue.";
88 my @files = readdir(DIR);
89 shift @files;
90 shift @files;
91 my ($tline, $tset);
92 foreach my $file (@files) {
93   $file =~ /(\w+)\.t/ || next;
94   $file = $1;
95   my $path = catfile('t', $file);
96   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";
97   $tline .= $line;
98   $tset  .= " $file \\\n";
100 $tline = "show_tests :\n\t\@echo \'type make test_<subtest> to run\'\n\t\@echo '$tset'\n$tline\n";
101 print STDERR "Generated sub tests. go make show_tests to see available subtests\n";
103 # we may end up creating extra files we would want to clean later; note them here
104 my @should_be_cleaned;
106 # ask questions about optional stuff to install/test
109 # notify about optional modules that haven't been installed, and generate hash
110 # for prereqs needed later in WriteMakefile
111 my %prereq;
112 my $error = 0;
113 print "\n*** Optional dependencies section ***\n";
114 while (my ($name, $value) = each %packages) {
115   my ($ver, $desc, $expl, $module) = split( /\// , $value);
116         no strict 'refs';
117   if (! eval "require $name;" || (${$name.'::VERSION'} || 0) < $ver) {
118     my @modules = split(',', $module);
119     my $modules = join("\n * ", @modules);
120     print "External Module '$name' >= $ver ($desc) is not installed on this computer.\n The following Bioperl-run modules need it for $expl:\n * $modules\n";
121     $error = 1;
122     
123     if (exists $exclude_from_prereqs{$name}) {
124       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";
125     }
126                 elsif (exists $required{$name}) {
127                         print "Additionally, it is absolutely required and therefore most if not all tests will fail!\n\n";
128                 }
129     else {
130       print "\n";
131     }
132   }
133         
134   unless (exists $exclude_from_prereqs{$name}) {
135     $prereq{$name} = $ver;
136   }
138 if ($error == 1) {
139   print <<QQ_ERROR_QQ;
140 Information:
142   Some perl modules are missing, listed above and below. The only
143   functionality that will be affected is described above;
144   the rest of bioperl will work fine without them.
146   The installation of these external packages is very simple. You
147   can read more about bioperl external dependencies in the INSTALL
148   file or at:
150   http://bioperl.org/wiki/Installing_BioPerl
152   Enjoy the rest of bioperl, which you can use after going 'make install'
154 QQ_ERROR_QQ
156 else {
157         print "All dependencies are installed\n\n";
160 # write the makefile
161 WriteMakefile(
162   NAME         => 'Bio',
163   DISTNAME     => 'bioperl-network',
164   VERSION      => $VERSION,
165   dist         => { COMPRESS     => 'gzip -9f',
166                     SUFFIX       => '.gz',
167                     DIST_DEFAULT => 'all tardist'
168                   },
169   'AUTHOR'     => 'Bioperl Team (bioperl-l@bioperl.org)',
170   'ABSTRACT'   => 'bioperl-network - package for biological networks',
171   # clean() is overridden and also gets rid of @should_be_cleaned
172   realclean    => { FILES => join(' ', @should_be_cleaned) },
173   PREREQ_PM    => \%prereq,
174   # Once 'nmake ppd' has been issued, the PPD needs to be modified for use with PPM4
175   # In addition, non-critical prereq's should be moved to a Bundle::BioPerl PPD
176   # A bit of a pain, but better to have all the prereq's in the same place initially
177   # TODO I'll (Nathan Haigh) added updated details to the wiki for doing this
180 exit;
184 # subroutines
189 # override MakeMaker methods
192 sub MY::postamble {
193   $tline;
196 package MY;
198 sub MY::clean {
199   return shift->SUPER::clean(@_) . <<END;
200 \t-rm -rf @should_be_cleaned