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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
require 5.006_001;
use IO::Handle;
# Usually, Scalar::Util is installed (in core since perl 5.8.0)
# However, sometimes it is (incorrectly) installed without XS, but as
# plain module. In that case, Scalar::Util must be reinstalled.
eval { require Scalar::Util };
unless($@)
{ eval "Scalar::Util->import('dualvar')";
if($@ =~ m/only.*XS/)
{ warn <<'WARN';
!!!! WARNING !!!! On your system, the module Scalar::Util is installed
!!!! WARNING !!!! without use of XS. This means that critical functionality
!!!! WARNING !!!! is missing. Reinstall the module and be sure to get the
!!!! WARNING !!!! correct installation.
!!!! WARNING !!!! perl -MCPAN -e 'shell'
!!!! WARNING !!!! > force install Scalar::Util
WARN
}
}
my @optional =
(
[ Mail::Box::Parser::C => '3.006'
, reason => <<'REASON', warning => <<'WARN' ]
Speeds-up reading mail folders, though most time is consumed by
Perl's administration of the processed data.
REASON
This module contains XS code, so you need a C compiler.
WARN
, [ Encode => '1.86', requires => sub { $] >= 5.007_003 }
, reason => <<'REASON', warning => <<'WARN' ]
Conversions between character sets are done by Encode. Many
other Perl modules use Encode too.
REASON
Encode is a huge package, but not complicated to install.
WARN
, [ Mail::Transport::Dbx => '0.04', reason => <<'REASON' ]
The wrapper to the Outlook's dbx files consists of a c-library
named libdbx (website http://sourceforge.net/project/ol2mbox/),
and a wrapper which is distributed separately from Mail::Box.
You get read-only access to the dbx folders.
REASON
, [ Mail::SpamAssassin => '2.00', reason => <<'REASON', warning => <<'WARN' ]
Searching for spam in a mail folder needs the popular spam killer.
REASON
This distr is large: installing will take quite a while. You
can install it later. When your CPAN cache is small, this may
break your Mail::Box installing process.
WARN
, [ Mail::IMAPClient => '2.2.8', reason => <<'REASON' ]
Required for IMAP4 support.
REASON
, [ Mail::Internet => '1.0', distr => 'MailTools', reason => <<'REASON' ]
Many existing e-mail applications use Mail::Internet objects. If
you want automatic conversions for compatibility, you need this.
REASON
, [ MIME::Entity => '3.0', distr => 'MIME::Tools', reason => <<'REASON' ]
MIME::Entity extends Mail::Internet messages with multipart handling
and composition. Install this when you want compatibility with
distrs which are based on this kind of messages.
REASON
, [ HTML::TreeBuilder => '3.13', reason => <<'REASON' ]
The tree builder is used by the HTML::Format* packages.
Version 3.12 is wrong, so you should install a newer version
if you want smart html conversions.
REASON
, [ Time::HiRes => '1.51', reason => <<'REASON' ]
When installed, unique message-ids will be created using gettimeofday.
Otherwise, generated message-ids will not be thread/fork safe.
REASON
, [ HTML::FormatText => '2.01', distr => 'HTML::FormatText'
, reason => <<'REASON' ]
Plug-in which converts HTML to Postscript or plain text.
REASON
);
my %prereq =
( Date::Parse => 0.0
, File::Spec => 0.7
, File::Remove => 0.20
, Errno => 0.0
, Scalar::Util => 1.13
, Object::Realize::Later => 0.14
, Mail::Address => 0.0
, MIME::Types => 1.004
, Sys::Hostname => 0.0
, Test::More => 0.47
, Test::Harness => 2.62
, MIME::Base64 => 0.0
, URI => 1.23
, IO::Scalar => 0.0
, Digest::HMAC_MD5 => 0.0
, User::Identity => 0.90
, Time::Zone => 0.0
);
my $has_readkey;
BEGIN
{ eval "require Term::ReadKey";
$has_readkey = not length $@;
}
my $default_install_answer
= $ENV{MAILBOX_INSTALL_OPTIONALS}
|| $ENV{INSTALL_MAILBOX_OPTIONALS}; # deprecated
print <<'INTRO';
*
**** Installing MailBox
*
INTRO
print <<'REQUIRED';
* First, I will check the sanity of all required modules... sometimes
* they do not load, for instance if you have installed a new release
* of Perl without upgrading the libraries.
REQUIRED
my @errors;
while(my ($module, $version) = each %prereq)
{ eval "require $module";
if($@ && $@ =~ m/^Can't locate /)
{ print " $module is not yet installed\n" }
elsif($@)
{ print " $module produced an error:\n$@";
push @errors, $module;
}
elsif($module->VERSION < $version)
{ print " $module version ",$module->VERSION
, " is outdated; requires $version\n";
}
else
{ print " $module version ",$module->VERSION
, " is ok (required is $version)\n";
}
}
if($errors)
{ die <<'FIX';
*** ERROR! You have to install @errors manually,
*** before you can retry to install MailBox.
FIX
exit 1;
}
print <<'OPTIONAL';
* Now, let me ask you whether you want some optional modules to be
* installed as well. You can always install these modules later, by
* hand, without a need to re-install MailBox.
*
OPTIONAL
foreach my $optional (@optional)
{ my ($module, $version, %args) = @$optional;
my $requirements = $args{requires} || sub {1};
next unless $requirements->();
print "\n";
eval "require $module";
if($@)
{ if($@ =~ m/^Can't locate /)
{ print "**** Optional $module is not installed\n" }
else { print "**** Optional $module compilation failed:\n$@\n" }
}
elsif($module->VERSION < $version )
{ print "**** Optional $module too old: requires $version but is ",
$module->VERSION,"\n";
}
else
{ my $v = $module->VERSION;
my $r = $v eq $version ? ''
: $version == 0 ? " (any version will do)"
: " (at least $version required)";
print "**** Found optional $module version $v$r\n";
next;
}
my $reason = $args{reason};
$reason =~ s/^/ /gm;
$reason =~ s/\A /Use:/;
print $reason;
if(my $warn = $args{warning})
{ $warn =~ s/^/ /gm;
$warn =~ s/\A /WARN/;
print $warn;
}
my $install = $default_install_answer
|| prompt( "Do you want to install $module? yes/no/all"
, -t STDIN ? 'y' : 'n');
$install = $default_install_answer = 'y'
if $install eq 'a';
next unless $install eq 'y';
my $distr = $args{distr} || $module;
$prereq{$distr} = $version;
print " Added $distr version $version to the requirements\n";
}
my $tests = $ENV{MAILBOX_RUN_TESTS}
|| prompt "Do you want to run the (large set of) tests? yes/no", "yes";
if($tests =~ m/n/i)
{ open F, ">", "skiptests";
close F;
}
else
{ unlink "skiptests";
}
print <<'MAKEFILE';
**** Writing Makefile
MAKEFILE
WriteMakefile
( NAME => 'Mail::Box'
, VERSION_FROM => 'lib/Mail/Box.pm'
, AUTHOR => 'Mark Overmeer'
, ABSTRACT => 'E-mail handling'
, PREREQ_PM => \%prereq
);
print <<'DONE';
**** Done
DONE
|